phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [20848] update property


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [20848] update property
Date: Fri, 20 Nov 2009 10:29:01 +0000

Revision: 20848
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20848
Author:   sigurdne
Date:     2009-11-20 10:29:01 +0000 (Fri, 20 Nov 2009)
Log Message:
-----------
update property

Modified Paths:
--------------
    people/sigurdne/modules/property/trunk/help/NO/location.edit.odt
    people/sigurdne/modules/property/trunk/help/NO/location.index.odt
    people/sigurdne/modules/property/trunk/help/NO/location.view.odt
    people/sigurdne/modules/property/trunk/help/NO/project.edit.odt
    people/sigurdne/modules/property/trunk/help/NO/project.index.odt
    people/sigurdne/modules/property/trunk/help/NO/project.view.odt
    people/sigurdne/modules/property/trunk/help/NO/request.edit.odt
    people/sigurdne/modules/property/trunk/help/NO/request.index.odt
    people/sigurdne/modules/property/trunk/help/NO/request.view.odt
    people/sigurdne/modules/property/trunk/help/NO/template.edit_template.odt
    people/sigurdne/modules/property/trunk/help/NO/template.index.odt
    people/sigurdne/modules/property/trunk/help/NO/tts.add.odt
    people/sigurdne/modules/property/trunk/help/NO/tts.index.odt
    people/sigurdne/modules/property/trunk/help/NO/tts.view.odt
    people/sigurdne/modules/property/trunk/help/NO/wo_hour.index.odt
    people/sigurdne/modules/property/trunk/help/NO/workorder.edit.odt
    people/sigurdne/modules/property/trunk/help/NO/workorder.index.odt
    people/sigurdne/modules/property/trunk/inc/class.XmlToArray.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boXport.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boactor.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boadmin.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boadmin_location.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boagreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boalarm.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boasync.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bobudget.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bocategory.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bodocument.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boentity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bofiles.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bogab.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boifc.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boinvestment.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boinvoice.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boproject.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bor_agreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.borequest.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boresponsible.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bos_agreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.botenant_claim.inc.php
    people/sigurdne/modules/property/trunk/inc/class.botts.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bowo_hour.inc.php
    people/sigurdne/modules/property/trunk/inc/class.boworkorder.inc.php
    people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php
    people/sigurdne/modules/property/trunk/inc/class.custom_functions.inc.php
    people/sigurdne/modules/property/trunk/inc/class.excel.inc.php
    people/sigurdne/modules/property/trunk/inc/class.historylog.inc.php
    people/sigurdne/modules/property/trunk/inc/class.import.inc.php
    people/sigurdne/modules/property/trunk/inc/class.interlink.inc.php
    people/sigurdne/modules/property/trunk/inc/class.menu.inc.php
    people/sigurdne/modules/property/trunk/inc/class.ods.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soadmin.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soadmin_entity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soadmin_location.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soalarm.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soasync.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sob_account.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sobudget.inc.php
    people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php
    people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php
    people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php
    people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php
    people/sigurdne/modules/property/trunk/inc/class.solookup.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sop_of_town.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sor_agreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sorequest.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sos_agreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sostandard_2.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sowo_hour.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiXport.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiactor.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiadmin.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiadmin_entity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiadmin_location.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiagreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uialarm.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiasync.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uib_account.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uibudget.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uidocument.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uientity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uigab.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiinvestment.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uimigrate.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uipricebook.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uir_agreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uirequest.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiresponsible.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uis_agreement.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uistandard_2.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uistandard_3.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uitemplate.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uitenant_claim.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiwo_hour.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiworkorder.inc.php
    people/sigurdne/modules/property/trunk/inc/cron/cron.php
    people/sigurdne/modules/property/trunk/inc/hook_home.inc.php
    people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php
    people/sigurdne/modules/property/trunk/login.php
    people/sigurdne/modules/property/trunk/setup/default_records.inc.php
    people/sigurdne/modules/property/trunk/setup/phpgw_en.lang
    people/sigurdne/modules/property/trunk/setup/phpgw_no.lang
    people/sigurdne/modules/property/trunk/setup/setup.inc.php
    people/sigurdne/modules/property/trunk/setup/tables_current.inc.php
    people/sigurdne/modules/property/trunk/setup/tables_update.inc.php
    people/sigurdne/modules/property/trunk/templates/base/actor.xsl
    people/sigurdne/modules/property/trunk/templates/base/admin.xsl
    people/sigurdne/modules/property/trunk/templates/base/admin_entity.xsl
    people/sigurdne/modules/property/trunk/templates/base/admin_location.xsl
    people/sigurdne/modules/property/trunk/templates/base/agreement.xsl
    people/sigurdne/modules/property/trunk/templates/base/alarm_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/attrib_history.xsl
    people/sigurdne/modules/property/trunk/templates/base/attributes_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/b_account_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/budget.xsl
    people/sigurdne/modules/property/trunk/templates/base/category.xsl
    people/sigurdne/modules/property/trunk/templates/base/columns.xsl
    people/sigurdne/modules/property/trunk/templates/base/config.tpl
    people/sigurdne/modules/property/trunk/templates/base/css/base.css
    people/sigurdne/modules/property/trunk/templates/base/date_search.xsl
    people/sigurdne/modules/property/trunk/templates/base/document.xsl
    people/sigurdne/modules/property/trunk/templates/base/entity.xsl
    people/sigurdne/modules/property/trunk/templates/base/files.xsl
    people/sigurdne/modules/property/trunk/templates/base/group_select.xsl
    people/sigurdne/modules/property/trunk/templates/base/location.xsl
    people/sigurdne/modules/property/trunk/templates/base/lookup.xsl
    people/sigurdne/modules/property/trunk/templates/base/project.xsl
    people/sigurdne/modules/property/trunk/templates/base/r_agreement.xsl
    people/sigurdne/modules/property/trunk/templates/base/request.xsl
    people/sigurdne/modules/property/trunk/templates/base/responsible.xsl
    people/sigurdne/modules/property/trunk/templates/base/s_agreement.xsl
    people/sigurdne/modules/property/trunk/templates/base/tenant_claim.xsl
    people/sigurdne/modules/property/trunk/templates/base/tts.xsl
    people/sigurdne/modules/property/trunk/templates/base/user_id_select.xsl
    people/sigurdne/modules/property/trunk/templates/base/wo_hour.xsl
    people/sigurdne/modules/property/trunk/templates/base/workorder.xsl
    
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh

Added Paths:
-----------
    people/sigurdne/modules/property/trunk/help/NO/wo_hour.deviation.odt
    people/sigurdne/modules/property/trunk/help/NO/wo_hour.edit.odt
    people/sigurdne/modules/property/trunk/help/NO/wo_hour.edit_deviation.odt
    people/sigurdne/modules/property/trunk/help/NO/wo_hour.prizebook.odt
    people/sigurdne/modules/property/trunk/help/NO/wo_hour.view.odt
    people/sigurdne/modules/property/trunk/help/NO/workorder.add.odt
    people/sigurdne/modules/property/trunk/help/NO/workorder.view.odt
    people/sigurdne/modules/property/trunk/inc/class.boevent.inc.php
    people/sigurdne/modules/property/trunk/inc/class.html2pdf.inc.php
    people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sopending_action.inc.php
    people/sigurdne/modules/property/trunk/inc/class.test.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uicommon.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uidebug_json.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uigab.inc_.php
    people/sigurdne/modules/property/trunk/inc/cron/README
    people/sigurdne/modules/property/trunk/inc/cron/default/
    people/sigurdne/modules/property/trunk/inc/cron/default/catch_ppc.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/forward_mail_as_sms.php
    people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php
    people/sigurdne/modules/property/trunk/inc/cron/default/lag_lang_filer.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_utgaatt_objekt.php
    people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/synkroniser_med_boei.php
    people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php
    people/sigurdne/modules/property/trunk/inc/cron/default/update_phpgw.php
    
people/sigurdne/modules/property/trunk/inc/cron/default/update_workorder_status.php
    people/sigurdne/modules/property/trunk/inc/custom/README
    people/sigurdne/modules/property/trunk/inc/custom/default/
    
people/sigurdne/modules/property/trunk/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
    
people/sigurdne/modules/property/trunk/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
    
people/sigurdne/modules/property/trunk/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
    
people/sigurdne/modules/property/trunk/inc/custom/default/kalkuler_risiko_for_ros.php
    people/sigurdne/modules/property/trunk/inc/export/README
    people/sigurdne/modules/property/trunk/inc/export/default/
    people/sigurdne/modules/property/trunk/inc/export/default/Agresso
    people/sigurdne/modules/property/trunk/inc/export/default/Basware_X114
    people/sigurdne/modules/property/trunk/inc/export/default/Ecolink
    people/sigurdne/modules/property/trunk/inc/export/default/GABNr
    people/sigurdne/modules/property/trunk/inc/export/default/Kemner_kvittering
    people/sigurdne/modules/property/trunk/inc/hook_config.inc.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/
    people/sigurdne/modules/property/trunk/inc/html2pdf/_LGPL.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/FAQ.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/acceptpagebreak.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addfont.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addlink.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addpage.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/aliasnbpages.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/cell.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/close.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/error.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/footer.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/fpdf.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getstringwidth.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getx.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/gety.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/header.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/image.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/index.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/line.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/link.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/ln.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/multicell.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/output.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/pageno.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/rect.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setauthor.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setautopagebreak.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcompression.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcreator.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdisplaymode.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdrawcolor.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfillcolor.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfont.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfontsize.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setkeywords.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setleftmargin.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlinewidth.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlink.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setmargins.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setrightmargin.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setsubject.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settextcolor.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settitle.htm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settopmargin.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setx.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setxy.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/sety.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/text.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/write.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/courier.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helvetica.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticab.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticabi.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticai.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1250.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1251.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1252.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1253.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1254.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1255.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1257.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1258.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp874.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-1.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-11.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-15.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-16.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-2.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-4.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-5.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-7.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-9.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-r.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-u.map
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/makefont.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/symbol.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/times.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesb.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesbi.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesi.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/zapfdingbats.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.css
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/histo.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/install.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/license.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c1.txt
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c2.txt
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.afm
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.ttf
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.z
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/countries.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/index.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/logo.png
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/logo_pb.png
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/makefont.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.htm
    people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_lisez_moi.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/00_fpdf_codebar.class.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/01_fpdf_bookmark.class.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/02_fpdf_formulaire.class.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/99_fpdf_protection.class.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/mypdf.class.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/_read_me.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/about.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple00.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple01.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple02.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple03.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple04.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple05.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple06.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple07.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple08.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple09.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple10.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple11.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple12.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple13.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple14.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js1.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js2.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js3.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/qrcode.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/regle.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/about.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/bas_page.png
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple00.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple01.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple02.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple03.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple04.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple05.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.css
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07a.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07b.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple08.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple09.png.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10a.gif
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10b.jpg
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10c.gif
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple11.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple12.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple13.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple14.php
    
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/logoHTMLtoPDF.gif
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/off.png
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/puce.gif
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/puce2.gif
    people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/regle.png
    people/sigurdne/modules/property/trunk/inc/html2pdf/html2pdf.class.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/ca.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/da.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/de.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/en.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/es.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/fr.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/it.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/nl.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/pt.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/langues/tr.txt
    people/sigurdne/modules/property/trunk/inc/html2pdf/parsingHTML.class.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/qrcode/
    people/sigurdne/modules/property/trunk/inc/html2pdf/qrcode/qrcode.class.php
    people/sigurdne/modules/property/trunk/inc/html2pdf/styleHTML.class.php
    people/sigurdne/modules/property/trunk/inc/import/README
    people/sigurdne/modules/property/trunk/inc/import/default/
    people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK
    people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK_csv
    people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner
    
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner_xml
    people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service
    
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service_xml
    
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_basware_X205
    
people/sigurdne/modules/property/trunk/inc/import/default/import_fra_Service_xls
    people/sigurdne/modules/property/trunk/js/newdesign/
    people/sigurdne/modules/property/trunk/js/newdesign/CRUDTable.php
    people/sigurdne/modules/property/trunk/js/yahoo/
    people/sigurdne/modules/property/trunk/js/yahoo/account.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/actor.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute.js
    
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute_group.js
    people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.category.js
    
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.function_group.js
    people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute.js
    
people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute_group.js
    people/sigurdne/modules/property/trunk/js/yahoo/admin_location.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit_item.js
    people/sigurdne/modules/property/trunk/js/yahoo/agreement.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/agreement.view.js
    people/sigurdne/modules/property/trunk/js/yahoo/agreement.view_item.js
    people/sigurdne/modules/property/trunk/js/yahoo/alarm.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/alarm.list_alarm.js
    people/sigurdne/modules/property/trunk/js/yahoo/budget.basis.js
    people/sigurdne/modules/property/trunk/js/yahoo/budget.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/budget.obligations.js
    people/sigurdne/modules/property/trunk/js/yahoo/category.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/custom.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/custom.view.js
    people/sigurdne/modules/property/trunk/js/yahoo/document.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/document.list_doc.js
    people/sigurdne/modules/property/trunk/js/yahoo/document.view.js
    people/sigurdne/modules/property/trunk/js/yahoo/entity.attrib_history.js
    people/sigurdne/modules/property/trunk/js/yahoo/entity.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/entity.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/event.schedule.js
    people/sigurdne/modules/property/trunk/js/yahoo/gab.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/gab.list_detail.js
    people/sigurdne/modules/property/trunk/js/yahoo/investment.history.js
    people/sigurdne/modules/property/trunk/js/yahoo/investment.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/invoice.consume.js
    people/sigurdne/modules/property/trunk/js/yahoo/invoice.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/invoice.list_sub.js
    people/sigurdne/modules/property/trunk/js/yahoo/invoice.paid.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/location.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/location.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/location.summary.js
    people/sigurdne/modules/property/trunk/js/yahoo/lookup.entity.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/lookup.tenant.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/lookup.vendor.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/pricebook.activity.js
    people/sigurdne/modules/property/trunk/js/yahoo/pricebook.agreement_group.js
    people/sigurdne/modules/property/trunk/js/yahoo/project.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/project.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/property.js
    people/sigurdne/modules/property/trunk/js/yahoo/property2.js
    people/sigurdne/modules/property/trunk/js/yahoo/request.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/request.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/responsible.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/schedule.js
    people/sigurdne/modules/property/trunk/js/yahoo/template.hour.js
    people/sigurdne/modules/property/trunk/js/yahoo/template.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/tenant_claim.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/tts.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/tts.index.simple.js
    people/sigurdne/modules/property/trunk/js/yahoo/tts.view.js
    people/sigurdne/modules/property/trunk/js/yahoo/ui_agreement.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/uiasync.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit_item.js
    people/sigurdne/modules/property/trunk/js/yahoo/uisagreement.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/uistandard_2.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/uistandard_3.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/uitenant.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.deviation.js
    people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.prizebook.js
    people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.save_template.js
    people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.template.js
    people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.view.js
    people/sigurdne/modules/property/trunk/js/yahoo/workorder.edit.js
    people/sigurdne/modules/property/trunk/js/yahoo/workorder.index.js
    people/sigurdne/modules/property/trunk/setup/default/
    people/sigurdne/modules/property/trunk/setup/default/README
    people/sigurdne/modules/property/trunk/setup/default/phpgw_no.lang_example
    people/sigurdne/modules/property/trunk/templates/base/cat_sub_select.xsl
    people/sigurdne/modules/property/trunk/templates/base/contact_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/contact_view.xsl
    people/sigurdne/modules/property/trunk/templates/base/css/property.css
    people/sigurdne/modules/property/trunk/templates/base/ecodimb_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/ecodimb_view.xsl
    people/sigurdne/modules/property/trunk/templates/base/event.xsl
    people/sigurdne/modules/property/trunk/templates/base/event_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/event_schedule.xsl
    
people/sigurdne/modules/property/trunk/templates/base/event_schedule_week.xsl
    people/sigurdne/modules/property/trunk/templates/base/project_group_form.xsl
    people/sigurdne/modules/property/trunk/templates/base/project_group_view.xsl
    people/sigurdne/modules/property/trunk/templates/base/yui_property_i18n.xsl
    people/sigurdne/modules/property/trunk/templates/portico/
    people/sigurdne/modules/property/trunk/templates/portico/css/
    people/sigurdne/modules/property/trunk/templates/portico/css/base.css
    people/sigurdne/modules/property/trunk/templates/portico/images/
    
people/sigurdne/modules/property/trunk/templates/portico/images/agreement.png
    people/sigurdne/modules/property/trunk/templates/portico/images/budget.png
    people/sigurdne/modules/property/trunk/templates/portico/images/check.png
    people/sigurdne/modules/property/trunk/templates/portico/images/custom.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/documentation.png
    people/sigurdne/modules/property/trunk/templates/portico/images/entity_1.png
    people/sigurdne/modules/property/trunk/templates/portico/images/entity_2.png
    people/sigurdne/modules/property/trunk/templates/portico/images/helpdesk.png
    people/sigurdne/modules/property/trunk/templates/portico/images/ifc.png
    people/sigurdne/modules/property/trunk/templates/portico/images/invoice.png
    people/sigurdne/modules/property/trunk/templates/portico/images/location.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/location_1.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/location_2.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/location_3.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/location_4.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/location_gabnr.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/location_summary.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/location_tenant.png
    people/sigurdne/modules/property/trunk/templates/portico/images/navbar.png
    people/sigurdne/modules/property/trunk/templates/portico/images/project.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/project_request.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/project_template.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/project_tenant_claim.png
    
people/sigurdne/modules/property/trunk/templates/portico/images/project_workorder.png
    people/sigurdne/modules/property/trunk/templates/portico/images/report.png

Modified: people/sigurdne/modules/property/trunk/help/NO/location.edit.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/location.index.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/location.view.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/project.edit.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/project.index.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/project.view.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/request.edit.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/request.index.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/request.view.odt
===================================================================
(Binary files differ)

Modified: 
people/sigurdne/modules/property/trunk/help/NO/template.edit_template.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/template.index.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/tts.add.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/tts.index.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/tts.view.odt
===================================================================
(Binary files differ)

Added: people/sigurdne/modules/property/trunk/help/NO/wo_hour.deviation.odt
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/help/NO/wo_hour.deviation.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/help/NO/wo_hour.edit.odt
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/help/NO/wo_hour.edit.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/help/NO/wo_hour.edit_deviation.odt
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/help/NO/wo_hour.edit_deviation.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: people/sigurdne/modules/property/trunk/help/NO/wo_hour.index.odt
===================================================================
(Binary files differ)

Added: people/sigurdne/modules/property/trunk/help/NO/wo_hour.prizebook.odt
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/help/NO/wo_hour.prizebook.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/help/NO/wo_hour.view.odt
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/help/NO/wo_hour.view.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/help/NO/workorder.add.odt
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/help/NO/workorder.add.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: people/sigurdne/modules/property/trunk/help/NO/workorder.edit.odt
===================================================================
(Binary files differ)

Modified: people/sigurdne/modules/property/trunk/help/NO/workorder.index.odt
===================================================================
(Binary files differ)

Added: people/sigurdne/modules/property/trunk/help/NO/workorder.view.odt
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/help/NO/workorder.view.odt
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: people/sigurdne/modules/property/trunk/inc/class.XmlToArray.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.XmlToArray.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.XmlToArray.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -525,7 +525,7 @@
                        $children = array(); // Contains node data
                        if (isset($vals[$i]['tag']))
                        {
-                               if( trim($vals[$i]['value']) != '' )
+                               if( isset($vals[$i]['value']) && 
trim($vals[$i]['value']) != '' )
                                {
                                        $children = $this->_onValue( 
$vals[$i]['value'] );
                                }

Modified: people/sigurdne/modules/property/trunk/inc/class.boXport.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boXport.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boXport.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -109,11 +109,11 @@
 
                function select_import_conv($selected='')
                {
-                       $dir_handle = @opendir(PHPGW_APP_INC . '/import');
-                       $i=0; $myfilearray = '';
+                       $dir_handle = @opendir(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}");
+                       $i=0; $myfilearray = array();
                        while ($file = readdir($dir_handle))
                        {
-                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_APP_INC . '/import/' . $file) )
+                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}") )
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
@@ -153,11 +153,11 @@
 
                function select_export_conv($selected='')
                {
-                       $dir_handle = @opendir(PHPGW_APP_INC . '/export');
-                       $i=0; $myfilearray = '';
+                       $dir_handle = @opendir(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}");
+                       $i=0; $myfilearray = array();
                        while ($file = readdir($dir_handle))
                        {
-                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_APP_INC . '/export/' . $file) )
+                               if ((substr($file, 0, 1) != '.') && 
is_file(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}") )
                                {
                                        $myfilearray[$i] = $file;
                                        $i++;
@@ -197,7 +197,7 @@
 
                function select_rollback_file($selected='')
                {
-                       $this->config->read_repository();
+                       $this->config->read();
                        $file_catalog = 
$this->config->config_data['export_path'];
 
                        $dir_handle = @opendir($file_catalog);
@@ -244,7 +244,7 @@
 
                function import($invoice_common,$download)
                {
-                       include (PHPGW_APP_INC . '/import/' . 
$invoice_common['conv_type']);
+                       include (PHPGW_SERVER_ROOT . 
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$invoice_common['conv_type']}");
                        $invoice = new import_conv;
 
                        $buffer = $invoice->import($invoice_common,$download);
@@ -268,7 +268,7 @@
                        $pre_transfer = $data['pre_transfer'];
                        $force_period_year = $data['force_period_year'];
 
-                       include(PHPGW_SERVER_ROOT.'/'.'property'.'/inc/export/' 
. $conv_type);
+                       include(PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
                        $invoice = new export_conv;
 
                        $buffer = 
$invoice->overfor($download,$pre_transfer,$force_period_year);
@@ -278,7 +278,7 @@
 
                function rollback($conv_type,$role_back_date,$rollback_file)
                {
-                       include (PHPGW_APP_INC . '/export/' . $conv_type);
+                       include (PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
                        $invoice = new export_conv;
                        $buffer = 
$invoice->RullTilbake($role_back_date,$rollback_file);
                        return $buffer;

Modified: people/sigurdne/modules/property/trunk/inc/class.boactor.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boactor.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boactor.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id$
+       * @version $Id$
        */
 
        /**
@@ -59,10 +59,9 @@
 
                function property_boactor($session=false)
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject('property.soactor');
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->custom           = 
createObject('property.custom_fields');
+                       $this->bocommon         = & $this->so->bocommon;
+                       $this->custom           = & $this->so->custom;
 
                        if ($session)
                        {
@@ -155,10 +154,11 @@
                        return (!!($has & $needed) == true);
                }
 
-               function read()
+               function read($dry_run='')
                {
                        $actor = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,'member_id'=>$this->member_id));
+                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,
+                                                                               
        'member_id'=>$this->member_id, 'dry_run' => $dry_run));
                        $this->total_records = $this->so->total_records;
 
                        $this->uicols   = $this->so->uicols;
@@ -185,6 +185,20 @@
                        return $values;
                }
 
+               /**
+               * Arrange attributes within groups
+               *
+               * @param string  $location    the name of the location of the 
attribute
+               * @param array   $attributes  the array of the attributes to be 
grouped
+               *
+               * @return array the grouped attributes
+               */
+
+               public function get_attribute_groups($location, $attributes = 
array())
+               {
+                       return $this->custom->get_attribute_groups('property', 
$location, $attributes);
+               }
+
                function save($actor,$values_attribute='')
                {
                        if(is_array($values_attribute))
@@ -218,7 +232,8 @@
                        {
                                
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property']["actor_columns_"
 . $this->role];
                        }
-                       $columns = $this->custom->find('property','.' . 
$this->role, 0, '','','',true);
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = $this->custom->find('property','.' . 
$this->role, 0, '','','',true, false, $filter);
                        
$column_list=$this->bocommon->select_multi_list($selected,$columns);
 
                        return $column_list;
@@ -236,4 +251,3 @@
                        return 
$this->bocommon->preserve_attribute_values($values,$values_attribute);
                }
        }
-

Modified: people/sigurdne/modules/property/trunk/inc/class.boadmin.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boadmin.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boadmin.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -4,7 +4,7 @@
        *
        * @author Sigurd Nes <address@hidden>
        * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software 
Foundation, Inc. http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v3 or later
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
@@ -14,7 +14,7 @@
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -49,6 +49,7 @@
                        $this->acl                      = & 
$GLOBALS['phpgw']->acl;
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->right            = array(1,2,4,8,16);
+                       $this->account_id       = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        if ($session)
                        {
@@ -192,7 +193,7 @@
                        foreach ( $totalacl as $user_id => $rights )
                        {
                                $user_checked[] = $user_id;
-                               $this->acl->set_account_id($user_id, true);
+                               $this->acl->set_account_id($user_id, true, 
$this->acl_app, $this->location, $account_type = 'accounts');
                                $this->acl->delete($this->acl_app, 
$this->location, $grantor, $type);
                                $this->acl->add($this->acl_app, 
$this->location, $rights, $grantor, $type);
                                $this->acl->save_repository($this->acl_app, 
$this->location);
@@ -253,7 +254,7 @@
                                }
                                else
                                {
-                                       $grantor = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                                       $grantor = $this->account_id;
                                }
                        }
 
@@ -271,10 +272,12 @@
                        if($type == 'groups')
                        {
                                $check_account_type = array('accounts');
+                               $acl_account_type = 'accounts';
                        }
                        else
                        {
                                $check_account_type = 
array('groups','accounts');
+                               $acl_account_type = 'both';
                        }
 
                        $grantor = -1;
@@ -286,7 +289,7 @@
                                }
                                else
                                {
-                                       $grantor = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                                       $grantor = $this->account_id;
                                }
                        }
 
@@ -321,7 +324,7 @@
                                                $user_list[$j]['initials']      
                = $this->so->get_initials($account->id);
                                        }
 
-                                       
$this->acl->set_account_id($account->id, true);
+                                       
$this->acl->set_account_id($account->id, true, $this->acl_app, $this->location, 
$acl_account_type);
 
                                        $count_right=count($right);
 

Modified: 
people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -55,6 +55,11 @@
                public $order;
 
                /**
+               * @var string $type entity set
+               */
+
+               public $type;
+               /**
                * @var integer $entity_id entity type
                */
                public $entity_id;
@@ -83,9 +88,14 @@
                        'check_perms'           => true
                );
 
+               var $type_app = array
+               (
+                       'entity'        => 'property',
+                       'catch'         => 'catch'
+               );
+
                function __construct($session=false)
                {
-                       $this->so                       = 
CreateObject('property.soadmin_entity');
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->custom           = 
createObject('property.custom_fields');
 
@@ -99,43 +109,23 @@
                        $query  = phpgw::get_var('query');
                        $sort   = phpgw::get_var('sort');
                        $order  = phpgw::get_var('order');
+                       $type   = phpgw::get_var('type');
                        $cat_id = phpgw::get_var('cat_id', 'int');
                        $allrows        = phpgw::get_var('allrows', 'bool');
                        $entity_id      = phpgw::get_var('entity_id', 'int');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
+                       $this->start                    = $start ? $start : 0;
+                       $this->query                    = isset($query) ? 
$query : $this->query;
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->type                             = isset($type)  
&& $type && $this->type_app[$type] ? $type : 'entity';
+                       $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
+                       $this->entity_id                = isset($entity_id) && 
$entity_id ? $entity_id : '';
+                       $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
+                       $this->so                               = 
CreateObject('property.soadmin_entity','', '', $this->bocommon);
+                       $this->so->type                 = $this->type;
+                       $this->so->type_app             = $this->type_app;
 
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if(isset($entity_id))
-                       {
-                               $this->entity_id = $entity_id;
-                       }
-                       if(isset($allrows))
-                       {
-                               $this->allrows = $allrows;
-                       }
                }
 
 
@@ -249,6 +239,7 @@
                        else
                        {
                                $receipt = $this->so->add_entity($values);
+                               execMethod('phpgwapi.menu.clear');
                        }
                        return $receipt;
                }
@@ -265,31 +256,67 @@
                        else
                        {
                                $receipt = $this->so->add_category($values);
+                               execMethod('phpgwapi.menu.clear');
                        }
                        return $receipt;
                }
 
-               function 
delete($cat_id='',$entity_id='',$attrib_id='',$acl_location='',$custom_function_id='')
+               function 
delete($cat_id='',$entity_id='',$attrib_id='',$acl_location='',$custom_function_id='',
 $group_id ='')
                {
-                       if(!$attrib_id && !$cat_id && $entity_id && 
!$custom_function_id)
+                       if(!$attrib_id && !$cat_id && $entity_id && 
!$custom_function_id  && !$group_id)
                        {
                                $this->so->delete_entity($entity_id);
+                               execMethod('phpgwapi.menu.clear');
                        }
-                       else if(!$attrib_id && $cat_id && $entity_id && 
!$custom_function_id)
+                       else if(!$attrib_id && $cat_id && $entity_id && 
!$custom_function_id  && !$group_id)
                        {
                                $this->so->delete_category($entity_id, $cat_id);
+                               execMethod('phpgwapi.menu.clear');
                        }
-                       else if($attrib_id && $cat_id && $entity_id && 
!$custom_function_id)
+                       else if($group_id && $cat_id && $entity_id && 
!$custom_function_id && !$attrib_id)
                        {
-                               $this->custom->delete('property', 
".entity.{$entity_id}.{$cat_id}", $attrib_id);
+                               
$this->custom->delete_group($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $group_id);
+                       }
+                       else if($attrib_id && $cat_id && $entity_id && 
!$custom_function_id  && !$group_id)
+                       {
+                               
$this->custom->delete($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id);
                                $this->so->delete_history($entity_id, 
$cat_id,$attrib_id);
                        }
                        else if($custom_function_id && $acl_location)
                        {
-                               
$GLOBALS['phpgw']->custom_functions->delete('property', 
$acl_location,$custom_function_id);
+                               
$GLOBALS['phpgw']->custom_functions->delete($this->type_app[$this->type], 
$acl_location,$custom_function_id);
                        }
                }
 
+               function get_attrib_group_list($entity_id,$cat_id, $selected)
+               {
+                       $group_list = $this->read_attrib_group($entity_id, 
$cat_id, true);
+                       
+                       foreach($group_list as &$group)
+                       {
+                               if( $group['id'] ==  $selected )
+                               {
+                                       $group['selected'] = true;
+                       }
+               }
+//_debug_array($group_list);die();
+                       return $group_list;
+               }
+
+               function read_attrib_group($entity_id='',$cat_id='',$allrows='')
+               {
+                       if($allrows)
+                       {
+                               $this->allrows = $allrows;
+                       }
+
+                       $attrib = 
$this->custom->find_group($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query, 
$this->sort, $this->order, $this->allrows);
+
+                       $this->total_records = $this->custom->total_records;
+
+                       return $attrib;
+               }
+
                function read_attrib($entity_id='',$cat_id='',$allrows='')
                {
                        if($allrows)
@@ -297,7 +324,7 @@
                                $this->allrows = $allrows;
                        }
 
-                       $attrib = $this->custom->find('property', '.entity.' . 
$entity_id . '.' . $cat_id, $this->start, $this->query, $this->sort, 
$this->order, $this->allrows);
+                       $attrib = 
$this->custom->find($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $this->start, $this->query, 
$this->sort, $this->order, $this->allrows);
 
                        $this->total_records = $this->custom->total_records;
 
@@ -306,57 +333,96 @@
 
                function read_single_attrib($entity_id,$cat_id,$id)
                {
-                       return $this->custom->get('property', '.entity.' . 
$entity_id . '.' . $cat_id, $id, true);
+                       return $this->custom->get($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $id, true);
                }
 
+               function read_single_attrib_group($entity_id,$cat_id,$id)
+               {
+                       return 
$this->custom->get_group($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $id, true);
+               }
+
+               function resort_attrib_group($id,$resort)
+               {
+                       $this->custom->resort_group($id, $resort, 
$this->type_app[$this->type], 
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
+               }
+
                function resort_attrib($id,$resort)
                {
-                       $this->custom->resort($id, $resort, 'property', 
'.entity.' . $this->entity_id . '.' . $this->cat_id);
+                       $this->custom->resort($id, $resort, 
$this->type_app[$this->type], 
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
                }
 
+               public function save_attrib_group($group, $action='')
+               {
+                       $receipt = array();
+                       $group['appname'] = $this->type_app[$this->type];
+                       $group['location'] = 
".{$this->type}.{$group['entity_id']}.{$group['cat_id']}";
+                       if ( $action=='edit' && $group['id'] )
+                       {
+                               if ( $this->custom->edit_group($group) )
+                               {
+                                       
$receipt['message'][]=array('msg'=>lang('group has been updated'));
+                                       return $receipt;
+                               }
+
+                               $receipt['error'][]=array('msg'=>lang('unable 
to update group'));
+                               return $receipt;
+                       }
+                       else
+                       {
+                               $id = $this->custom->add_group($group);
+                               if ( $id <= 0  )
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('unable to add group'));
+                                       return $receipt;
+                               }
+                               else if ( $id == -1 )
+                               {
+                                       $receipt['id']= 0;
+                                       $receipt['error'][]= array('msg' => 
lang('group already exists, please choose another name'));
+                                       $receipt['error'][]= array('msg' => 
lang('Attribute group has NOT been saved'));
+                                       return $receipt;
+               }
+
+                               $receipt['id']= $id;
+                               $receipt['message'][]=array('msg'=>lang('group 
has been created'));
+                               return $receipt;
+                       }
+               }
                public function save_attrib($attrib, $action='')
                {
-                       $attrib['appname'] = 'property';
-                       $attrib['location'] = '.entity.' . $attrib['entity_id'] 
. '.' . $attrib['cat_id'];
+                       $receipt = array();
+                       $attrib['appname'] = $this->type_app[$this->type];
+                       $attrib['location'] = 
".{$this->type}.{$attrib['entity_id']}.{$attrib['cat_id']}";
                        if ( $action=='edit' && $attrib['id'] )
                        {
                                if ( $this->custom->edit($attrib) )
                                {
-                                       return array
-                                       (
-                                               'msg'   => array('msg' => 
lang('Field has been updated'))
-                                       );
+                                       $receipt = $this->custom->receipt;
+                                       
$receipt['message'][]=array('msg'=>lang('Field has been updated'));
+                                       return $receipt;
                                }
-
-                               return array('error' => lang('Unable to update 
field'));
+                               $receipt['error'][]=array('msg'=>lang('Unable 
to update field'));
+                               return $receipt;
                        }
                        else
                        {
                                $id = $this->custom->add($attrib);
                                if ( $id <= 0  )
                                {
-                                       $this->custom->add($attrib);
-
-                                       return array('error' => lang('Unable to 
add field'));
+                                       
$receipt['error'][]=array('msg'=>lang('Unable to add field'));
+                                       return $receipt;
                                }
                                else if ( $id == -1 )
                                {
-                                       return array
-                                       (
-                                               'id'    => 0,
-                                               'error' => array
-                                               (
-                                                       array('msg' => 
lang('field already exists, please choose another name')),
-                                                       array('msg' => 
lang('Attribute has NOT been saved'))
-                                               )
-                                       );
+                                       $receipt['id']= 0;
+                                       $receipt['error'][]= array('msg' => 
lang('field already exists, please choose another name'));
+                                       $receipt['error'][]= array('msg' => 
lang('Attribute has NOT been saved'));
+                                       return $receipt;
                                }
 
-                               return array
-                               (
-                                       'id'    => $id,
-                                       'msg'   => array('msg' => lang('Custom 
field has been created'))
-                               );
+                               $receipt['id']= $id;
+                               $receipt['message'][]=array('msg'=>lang('Custom 
field has been created'));
+                               return $receipt;
                        }
                }
 
@@ -369,11 +435,11 @@
 
                        if (!$acl_location && $entity_id && $cat_id)
                        {
-                               $acl_location = '.entity.' . $entity_id . '.' . 
$cat_id;
+                               $acl_location = 
".{$this->type}.{$entity_id}.{$cat_id}";
                        }
 
                        $values = 
$GLOBALS['phpgw']->custom_functions->find(array('start' => $this->start,'query' 
=> $this->query,'sort' => $this->sort,'order' => $this->order,
-                                                                               
        'appname'=>'property','location' => 
$acl_location,'allrows'=>$this->allrows));
+                                                                               
        'appname'=> $this->type_app[$this->type],'location' => 
$acl_location,'allrows'=>$this->allrows));
 
                        $this->total_records = 
$GLOBALS['phpgw']->custom_functions->total_records;
 
@@ -382,16 +448,16 @@
 
                function resort_custom_function($id,$resort)
                {
-                       $location = '.entity.' . $this->entity_id . '.' . 
$this->cat_id;
-                       return $GLOBALS['phpgw']->custom_functions->resort($id, 
$resort, 'property', $location);
+                       $location = 
".{$this->type}.{$this->entity_id}.{$this->cat_id}";
+                       return $GLOBALS['phpgw']->custom_functions->resort($id, 
$resort, $this->type_app[$this->type], $location);
                }
 
                function save_custom_function($custom_function,$action='')
                {
-                       $custom_function['appname']='property';
+                       $custom_function['appname']= 
$this->type_app[$this->type];
                        if(!$custom_function['location'] && 
$custom_function['entity_id'] && $custom_function['cat_id'])
                        {
-                               $custom_function['location'] = '.entity.' . 
$custom_function['entity_id'] . '.' . $custom_function['cat_id'];
+                               $custom_function['location'] = 
".{$this->type}.{$custom_function['entity_id']}.{$custom_function['cat_id']}";
                        }
 
                        if ($action=='edit')
@@ -412,16 +478,16 @@
                function select_custom_function($selected='')
                {
                        $admin_custom = createObject('admin.bo_custom');
-                       return $admin_custom->select_custom_function($selected, 
'property');
+                       return $admin_custom->select_custom_function($selected, 
$this->type_app[$this->type]);
                }
 
                function 
read_single_custom_function($entity_id='',$cat_id='',$id,$location='')
                {
                        if (!$location && $entity_id && $cat_id)
                        {
-                               $location = '.entity.' . $entity_id . '.' . 
$cat_id;
+                               $location = 
".{$this->type}.{$entity_id}.{$cat_id}";
                        }
-                       return 
$GLOBALS['phpgw']->custom_functions->get('property',$location,$id);
+                       return 
$GLOBALS['phpgw']->custom_functions->get($this->type_app[$this->type],$location,$id);
                }
        }
 

Modified: 
people/sigurdne/modules/property/trunk/inc/class.boadmin_location.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boadmin_location.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boadmin_location.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -91,31 +91,11 @@
                        $order  = phpgw::get_var('order');
                        $allrows        = phpgw::get_var('allrows', 'bool');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
-
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($allrows))
-                       {
-                               $this->allrows = $allrows;
-                       }
+                       $this->start                    = $start ? $start : 0;
+                       $this->query                    = isset($query) ? 
$query : $this->query;
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
                }
 
 
@@ -181,26 +161,140 @@
                        return $receipt;
                }
 
-               function delete($type_id,$id,$attrib='')
+               function delete($type_id,$id,$attrib='',$group_id)
                {
                        if($id && !$attrib)
                        {
-                               $this->so->delete($id);
+                               $receipt = $this->so->delete($id);
                        }
                        else if($type_id && $id && $attrib)
                        {
-                               
$this->custom->delete('property',".location.{$type_id}", $id , 
"fm_location{$type_id}_history", true );
-                               
$this->custom->delete('property',".location.{$type_id}", $id , 
"fm_location{$type_id}" );
+                               $ok = 0;
+                               $receipt = array();
+                               
+                               
if($this->custom->delete('property',".location.{$type_id}", $id , 
"fm_location{$type_id}_history", true ))
+                               {
+                                       $ok++;
+                               }
+                               
if($this->custom->delete('property',".location.{$type_id}", $id , 
"fm_location{$type_id}" ))
+                               {
+                                       $ok++;
+                               }
+                               if ($ok == 2)
+                               {
+                                       $receipt['message'][] = array('msg' => 
lang('attibute has been deleted'));
+                               }
+                               else
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('something went wrong'));
+                               }
                        }
+                       else if($type_id && $group_id)
+                       {
+                               
if($this->custom->delete_group('property',".location.{$type_id}", $group_id))
+                               {
+                                       $receipt['message'][] = array('msg' => 
lang('attibute group %1 has been deleted',$group_id));
+                               }
+                               else
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('something went wrong'));
+                               }
+                       }
+
+                       return $receipt;
                }
 
-               function read_attrib($type_id)
+
+               function get_attrib_group_list($type_id, $selected)
                {
+                       $location = ".location.{$type_id}";
+                       $group_list = $this->read_attrib_group($location, true);
+                       
+                       foreach($group_list as &$group)
+                       {
+                               if( $group['id'] ==  $selected )
+                               {
+                                       $group['selected'] = true;
+                               }
+                       }
+                       return $group_list;
+               }
+
+               function read_attrib_group($location, $allrows='')
+               {
                        if($allrows)
                        {
                                $this->allrows = $allrows;
                        }
 
+                       $attrib = $this->custom->find_group('property', 
$location, $this->start, $this->query, $this->sort, $this->order, 
$this->allrows);
+                       $this->total_records = $this->custom->total_records;
+
+                       return $attrib;
+               }
+
+               function read_single_attrib_group($location, $id)
+               {
+                       return $this->custom->get_group('property', $location, 
$id, true);
+               }
+
+               function resort_attrib_group($location, $id, $resort)
+               {
+                       $this->custom->resort_group($id, $resort, 'property', 
$location);
+               }
+
+               public function save_attrib_group($group, $action='')
+               {
+                       $group['appname'] = 'property';
+
+                       if ( $action=='edit' && $group['id'] )
+                       {
+                               if ( $this->custom->edit_group($group) )
+                               {
+                                       return array
+                                       (
+                                               'msg'   => array('msg' => 
lang('group has been updated'))
+                                       );
+                               }
+
+                               return array('error' => lang('Unable to update 
group'));
+                       }
+                       else
+                       {
+                               $id = $this->custom->add_group($group);
+                               if ( $id <= 0  )
+                               {
+                                       return array('error' => lang('Unable to 
add group'));
+                               }
+                               else if ( $id == -1 )
+                               {
+                                       return array
+                                       (
+                                               'id'    => 0,
+                                               'error' => array
+                                               (
+                                                       array('msg' => 
lang('group already exists, please choose another name')),
+                                                       array('msg' => 
lang('Attribute group has NOT been saved'))
+                                               )
+                                       );
+                               }
+
+                               return array
+                               (
+                                       'id'    => $id,
+                                       'msg'   => array('msg' => lang('group 
has been created'))
+                               );
+                       }
+               }
+
+
+               function read_attrib($type_id, $allrows = '')
+               {
+                       if($allrows || phpgw::get_var('allrows') == 1)
+                       {
+                               $this->allrows = true;
+                       }
+
                        $attrib = $this->custom->find('property', '.location.' 
. $type_id, $this->start, $this->query, $this->sort, $this->order, 
$this->allrows);
 
                        $this->total_records = $this->custom->total_records;

Modified: people/sigurdne/modules/property/trunk/inc/class.boagreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boagreement.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boagreement.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -105,10 +105,9 @@
                        {
                                $this->sort = $sort;
                        }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
+
+                       $this->order    = isset($order) && $order ? $order : '';
+
                        if(isset($cat_id))
                        {
                                $this->cat_id = $cat_id;
@@ -232,7 +231,7 @@
                function read_event($data)
                {
                        $boalarm                = 
CreateObject('property.boalarm');
-                       $event  = $this->so->read_single($data);
+                       $event  = $this->so->read_single($data['agreement_id']);
                        $event['alarm_date']=$event['termination_date'];
                        $event['alarm'] = 
$boalarm->read_alarms($type='agreement',$data['agreement_id']);
                        return $event;
@@ -290,6 +289,20 @@
                        return $values;
                }
 
+               /**
+               * Arrange attributes within groups
+               *
+               * @param string  $location    the name of the location of the 
attribute
+               * @param array   $attributes  the array of the attributes to be 
grouped
+               *
+               * @return array the grouped attributes
+               */
+
+               public function get_attribute_groups($location, $attributes = 
array())
+               {
+                       return $this->custom->get_attribute_groups('property', 
$location, $attributes);
+               }
+
                function save($values,$values_attribute='',$action='')
                {
                        $values['start_date']   = 
$this->bocommon->date_to_timestamp($values['start_date']);
@@ -367,7 +380,8 @@
                                $selected = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']["agreement_columns"])?$GLOBALS['phpgw_info']['user']['preferences']['property']["agreement_columns"]:'';
                        }
 
-                       $columns = $this->custom->find('property','.agreement', 
0, '','','',true);
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = $this->custom->find('property','.agreement', 
0, '','','',true, false, $filter);
 
                        
$column_list=$this->bocommon->select_multi_list($selected,$columns);
 

Modified: people/sigurdne/modules/property/trunk/inc/class.boalarm.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boalarm.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boalarm.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -368,8 +368,8 @@
                                return false;   // event not found
                        }
 
-                       $this->config           = 
CreateObject('phpgwapi.config');
-                       $this->config->read_repository();
+                       $this->config           = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read();
                        $this->send                     = 
CreateObject('phpgwapi.send');
 
                        $members = array();
@@ -467,10 +467,8 @@
                                $receipt['error'][] = array('msg'=> 'group: 
'.$group_name);
                                $receipt['error'][] = array('msg'=> 'err_code: 
'.$this->send->err['code']);
                                $receipt['error'][] = array('msg'=> 'err_msg: 
'. htmlspecialchars($this->send->err['msg']));
-                               $receipt['error'][] = array('msg'=> 'err_desc: 
'. $GLOBALS['phpgw']->err['desc']);
+                               $receipt['error'][] = array('msg'=> 'err_desc: 
'. $this->send->err['desc']);
                        }
-
-//_debug_array($receipt);
 //                     return $receipt;
                }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.boasync.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boasync.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boasync.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -40,6 +40,7 @@
                var $sort;
                var $order;
                var $cat_id;
+               var $allrows;
 
                var $public_functions = array
                (
@@ -85,38 +86,16 @@
                        $query  = phpgw::get_var('query');
                        $sort   = phpgw::get_var('sort');
                        $order  = phpgw::get_var('order');
-                       $filter = phpgw::get_var('filter', 'int');
                        $cat_id = phpgw::get_var('cat_id', 'int');
+                       $allrows        = phpgw::get_var('allrows', 'bool');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
+                       $this->start                    = $start ? $start : 0;
+                       $this->query                    = isset($query) ? 
$query : $this->query;
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
+                       $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
 
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(!empty($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
                }
 
                function save_sessiondata($data)
@@ -142,7 +121,8 @@
 
                function read()
                {
-                       $method = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order));
+                       $method = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'allrows' => $this->allrows));
 
                        $this->total_records = $this->so->total_records;
 

Modified: people/sigurdne/modules/property/trunk/inc/class.bobudget.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bobudget.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bobudget.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -45,6 +45,7 @@
                var $grouping;
                var $revision;
                var $allrows;
+               var $details;
 
                var $public_functions = array
                (
@@ -57,12 +58,9 @@
 
                function property_bobudget($session=false)
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject('property.sobudget');
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->cats                                     = 
CreateObject('phpgwapi.categories');
-                       $this->cats->app_name           = 'property.project';
-                       $this->cats->supress_info       = true;
+                       $this->cats                                     = & 
$this->so->cats;
 
                        if ($session)
                        {
@@ -76,64 +74,30 @@
                        $order          = phpgw::get_var('order');
                        $filter         = phpgw::get_var('filter', 'int');
                        $cat_id         = phpgw::get_var('cat_id', 'int');
+                       $dimb_id                                = 
phpgw::get_var('dimb_id', 'int');
                        $allrows        = phpgw::get_var('allrows', 'bool');
                        $district_id    = phpgw::get_var('district_id', 'int');
                        $year           = phpgw::get_var('year', 'int');
                        $grouping       = phpgw::get_var('grouping', 'int');
                        $revision       = phpgw::get_var('revision', 'int');
-                       $this->allrows = phpgw::get_var('allrows', 'bool');
+                       $allrows                                = 
phpgw::get_var('allrows', 'bool');
+                       $details                                = 
phpgw::get_var('details', 'bool');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
+                       $this->start                    = $start;
+                       $this->query                    = isset($query) ? 
$query : $this->query;
+                       $this->filter                   = isset($filter) && 
$filter ? $filter : '';
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
+                       $this->dimb_id                  = isset($dimb_id) && 
$dimb_id ? $dimb_id : '';
+                       $this->part_of_town_id  = isset($part_of_town_id) && 
$part_of_town_id ? $part_of_town_id : '';
+                       $this->district_id              = isset($district_id) 
&& $district_id ? $district_id : '';
+                       $this->grouping                 = isset($grouping) && 
$grouping ? $grouping : '';
+                       $this->revision                 = isset($revision) && 
$revision ? $revision : 1;
+                       $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
+                       $this->year                             = isset($year) 
&& $year ? $year : '';
+                       $this->details                  = $details;
 
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(!empty($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id) && !empty($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       else
-                       {
-                               $this->cat_id = '';
-                       }
-
-                       if(isset($district_id))
-                       {
-                               $this->district_id = $district_id;
-                       }
-                       if(isset($year))
-                       {
-                               $this->year = $year;
-                       }
-                       if(isset($grouping))
-                       {
-                               $this->grouping = $grouping;
-                       }
-                       if(isset($revision))
-                       {
-                               $this->revision = $revision;
-                       }
-
                        if(isset($year) && !$this->year == $year && 
!$GLOBALS['phpgw_info']['menuaction']=='property.uibudget.obligations')
                        {
                                $this->grouping = '';
@@ -154,12 +118,13 @@
                {
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data','budget');
 
-                       $this->start    = $data['start'];
-                       $this->query    = $data['query'];
-                       $this->filter   = $data['filter'];
-                       $this->sort             = $data['sort'];
-                       $this->order    = $data['order'];
-                       $this->cat_id   = $data['cat_id'];
+                       $this->start                    = 
isset($data['start'])?$data['start']:'';
+                       $this->filter                   = 
isset($data['filter'])?$data['filter']:'';
+                       $this->sort                             = 
isset($data['sort'])?$data['sort']:'';
+                       $this->order                    = 
isset($data['order'])?$data['order']:'';;
+                       $this->cat_id                   = 
isset($data['cat_id'])?$data['cat_id']:'';
+                       $this->dimb_id                  = 
isset($data['dimb_id'])?$data['dimb_id']:'';
+                       $this->details                  = 
isset($data['details'])?$data['details']:'';
                }
 
                function check_perms($has, $needed)
@@ -172,14 +137,18 @@
                {
                        $budget = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                        'filter' => 
$this->filter,'cat_id' => $this->cat_id,'allrows'=>$this->allrows,
-                                                       'district_id' => 
$this->district_id,'year' => $this->year,'grouping' => 
$this->grouping,'revision' => $this->revision,));
+                                                       'district_id' => 
$this->district_id,'year' => $this->year,'grouping' => 
$this->grouping,'revision' => $this->revision,
+                                                       'cat_id' => 
$this->cat_id, 'dimb_id' => $this->dimb_id));
 
                        $this->total_records = $this->so->total_records;
 
-                       for ($i=0; $i<count($budget); $i++)
+                       foreach ($budget as & $entry)
                        {
-                               $budget[$i]['entry_date']  = 
$GLOBALS['phpgw']->common->show_date($budget[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+//                             $entry['entry_date']    = 
$GLOBALS['phpgw']->common->show_date($entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $category = 
$this->cats->return_single($entry['cat_id']);
+                               $entry['category']              
=$category[0]['name'];
                        }
+
                        return $budget;
                }
 
@@ -201,9 +170,12 @@
 
                function read_obligations()
                {
-                       $obligations = 
$this->so->read_obligations(array('start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
-                                                       'filter' => 
$this->filter,'cat_id' => $this->cat_id,'allrows'=>$this->allrows,
-                                                       'district_id' => 
$this->district_id,'year' => $this->year,'grouping' => 
$this->grouping,'revision' => $this->revision,));
+                       //cramirez: add strtoupper function for $this->sort. in 
YUI use asc/desc (lowercase letters)
+                       $obligations = 
$this->so->read_obligations(array('start' => $this->start, 'query' => 
$this->query,
+                                                       'sort' => 
strtoupper($this->sort), 'order' => $this->order, 'filter' => $this->filter,
+                                                       'cat_id' => 
$this->cat_id, 'allrows'=>$this->allrows, 'district_id' => $this->district_id,
+                                                       'year' => $this->year, 
'grouping' => $this->grouping, 'revision' => $this->revision,
+                                                       'details' => 
$this->details));
 
                        $this->total_records = $this->so->total_records;
                        return $obligations;
@@ -317,10 +289,6 @@
 
                function get_year_filter_list($selected ='',$basis = '')
                {
-                       if(!isset($_GET['year']))
-                       {
-                               $selected = date('Y');
-                       }
                        $year_list = $this->so->get_year_filter_list($basis);
                        return 
$this->bocommon->select_list($selected,$year_list);
                }
@@ -329,11 +297,16 @@
                {
                        $year_list = $this->so->get_year_filter_list();
 
+                       if(!$year_list)
+                       {
+                               $year_list = array(array('id' =>date('Y'), 
'name' =>date('Y')));
+                       }
+                       $k = date('Y') - $year_list[0]['id'] + 5;
                        $j = count($year_list);
-                       for ($i=0; $i < 4; $i++)
+                       for ($i=0; $i < $k; $i++)
                        {
                                // FIXME
-                               if($year_list[$j-1]['id'] < date('Y') + 3)
+                       //      if($year_list[$j-1]['id'] < date('Y') + 3)
                                {
                                        $year_list[$j+$i]['id'] = 
$year_list[$j+$i-1]['id'] + 1;
                                        $year_list[$j+$i]['name'] = 
$year_list[$j+$i-1]['id'] + 1;

Modified: people/sigurdne/modules/property/trunk/inc/class.bocategory.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bocategory.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bocategory.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free 
Software Foundation, Inc. http://www.fsf.org/
        * This file is part of phpGroupWare.
        *
        * phpGroupWare is free software; you can redistribute it and/or modify
@@ -40,16 +40,8 @@
                var $sort;
                var $order;
                var $cat_id;
+               var $location_info = array();
 
-               var $public_functions = array
-               (
-                       'read'                          => true,
-                       'read_single'           => true,
-                       'save'                          => true,
-                       'delete'                        => true,
-                       'check_perms'           => true
-               );
-
                var $soap_functions = array(
                        'list' => array(
                                'in'  => 
array('int','int','struct','string','int'),
@@ -69,11 +61,11 @@
                        )
                );
 
-               function property_bocategory($session=false)
+               function __construct($session=false)
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject('property.socategory');
                        $this->socommon = CreateObject('property.socommon');
+                       $this->custom           = & $this->so->custom;
 
                        if ($session)
                        {
@@ -87,45 +79,23 @@
                        $order  = phpgw::get_var('order');
                        $filter = phpgw::get_var('filter', 'int');
                        $cat_id = phpgw::get_var('cat_id', 'int');
-                       $allrows= phpgw::get_var('allrows', 'bool');
+                       $allrows                        = 
phpgw::get_var('allrows', 'bool');
+                       $type                           = 
phpgw::get_var('type');
+                       $type_id                        = 
phpgw::get_var('type_id', 'int');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
+                       $this->start            = $start ? $start : 0;
+                       $this->query            = isset($_REQUEST['query']) ? 
$query : $this->query;
+                       $this->sort                     = 
isset($_REQUEST['sort']) ? $sort : $this->sort;
+                       $this->order            = isset($_REQUEST['order']) ? 
$order : $this->order;
+                       $this->filter           = isset($_REQUEST['filter']) ? 
$filter : $this->filter;
+                       $this->cat_id           = isset($_REQUEST['cat_id'])  ? 
$cat_id :  $this->cat_id;
+                       $this->allrows          = isset($allrows) ? $allrows : 
false;
 
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(!empty($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if(isset($allrows))
-                       {
-                               $this->allrows = $allrows;
-                       }
+                       $this->location_info = 
$this->so->get_location_info($type, $type_id);
+
                }
 
-
-               function save_sessiondata($data)
+               public function save_sessiondata($data)
                {
                        if ($this->use_session)
                        {
@@ -137,7 +107,7 @@
                {
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data','category');
 
-                       //_debug_array($data);
+       //              _debug_array($data);
 
                        $this->start    = $data['start'];
                        $this->query    = $data['query'];
@@ -148,48 +118,69 @@
                        $this->allrows  = $data['allrows'];
                }
 
+               public function get_location_info($type,$type_id)
+               {
+                       return $this->so->get_location_info($type,$type_id);
+               }
 
-               function read($type='',$type_id='')
+               public function read()
                {
-                       $category = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'type' => $type,type_id=>$type_id,'allrows'=>$this->allrows));
+                       $values = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'allrows'=>$this->allrows));
 
                        $this->total_records = $this->so->total_records;
+                       $this->uicols = $this->so->uicols;
 
-                       return $category;
+                       return $values;
                }
 
-               function read_single($id,$type,$type_id)
+               public function read_single($data=array())
                {
-                       return $this->so->read_single($id,$type,$type_id);
+                       $custom_fields = false;
+                       
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
+                       {
+                               $custom_fields = true;
+                               $values = array();
+                               $values['attributes'] = 
$this->custom->find('property', $this->location_info['acl_location'], 0, '', 
'ASC', 'attrib_sort', true, true);
                }
 
-               function select_part_of_town($part_of_town_id)
+                       if(isset($data['id']) && $data['id'])
+                       {
+                               $values = $this->so->read_single($data, 
$values);
+                       }
+                       if($custom_fields)
                {
-                       return 
$this->socommon->select_part_of_town($part_of_town_id);
+                               $values = $this->custom->prepare($values, 
'property',$this->location_info['acl_location'], $data['view']);
+                       }
+                       return $values;
                }
 
-               function save($category,$action='',$type ='',$type_id)
+               public function save($data,$action='',$values_attribute = 
array())
                {
+                       if(is_array($values_attribute))
+                       {
+                               $values_attribute = 
$this->custom->convert_attribute_save($values_attribute);
+                       }
+
                        if ($action=='edit')
                        {
-                               if ($category['id'] != '')
+                               if ($data['id'] != '')
                                {
 
-                                       $receipt = 
$this->so->edit($category,$type,$type_id);
+                                       $receipt = 
$this->so->edit($data,$values_attribute);
                                }
                        }
                        else
                        {
-                               $receipt = 
$this->so->add($category,$type,$type_id);
+                               $receipt = 
$this->so->add($data,$values_attribute);
                        }
 
                        return $receipt;
                }
 
-               function delete($id,$type,$type_id)
+               public function delete($id)
                {
-                       $this->so->delete($id,$type,$type_id);
+                       $this->so->delete($id);
                }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -67,8 +67,9 @@
                        )
                );
 
-               function property_bocommon()
+               function __construct()
                {
+//_debug_array($bt = debug_backtrace());
                        $this->socommon                 = 
CreateObject('property.socommon');
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
@@ -128,26 +129,25 @@
 
                function msgbox_data($receipt)
                {
-                       $msgbox_data_error=array();
+                       $msgbox_data_error       = array();
+                       $msgbox_data_message = array();
                        if (isSet($receipt['error']) AND 
is_array($receipt['error']))
                        {
-                               foreach($receipt['error'] as $errors)
+                               foreach($receipt['error'] as $dummy => $error)
                                {
-                                       $msgbox_data_error += 
array($errors['msg']=> false);
+                                       $msgbox_data_error[$error['msg']] = 
false;
                                }
                        }
 
-                       $msgbox_data_message=array();
-
                        if (isSet($receipt['message']) AND 
is_array($receipt['message']))
                        {
-                               foreach($receipt['message'] as $messages)
+                               foreach($receipt['message'] as $dummy => 
$message)
                                {
-                                       $msgbox_data_message += 
array($messages['msg']=> true);
+                                       $msgbox_data_message[$message['msg']] = 
true;
                                }
                        }
 
-                       $msgbox_data = $msgbox_data_error + 
$msgbox_data_message;
+                       $msgbox_data = array_merge($msgbox_data_error, 
$msgbox_data_message);
 
                        return $msgbox_data;
                }
@@ -269,7 +269,7 @@
                }
 
 
-               function 
get_user_list($format='',$selected='',$extra='',$default='',$start='', 
$sort='', $order='', $query='',$offset='')
+               function 
get_user_list($format='',$selected='',$extra='',$default='',$start='', 
$sort='', $order='', $query='',$offset='', $enabled = false)
                {
                        switch($format)
                        {
@@ -302,11 +302,14 @@
 
                        $accounts = & $GLOBALS['phpgw']->accounts;
                        $users = $accounts->get_list('accounts', $start, $sort, 
$order, $query,$offset);
+
                        unset($accounts);
                        if (is_array($users))
                        {
                                foreach($users as $user)
                                {
+                                       if (($enabled && $user->enabled) || 
!$enabled)
+                                       {
                                        $all_users[] = array
                                        (
                                                'user_id'       => $user->id,
@@ -314,6 +317,7 @@
                                        );
                                }
                        }
+                       }
 
                        if (count($all_users)>0)
                        {
@@ -393,13 +397,18 @@
                }
 
 
-               function 
get_user_list_right($right='',$selected='',$acl_location='',$extra='',$default='')
+               function 
get_user_list_right($rights,$selected='',$acl_location='',$extra='',$default='')
                {
                        if(!$selected && $default)
                        {
                                $selected = $default;
                        }
 
+                       if (!is_array($rights))
+                       {
+                               $rights = array($rights);
+                       }
+
                        if (is_array($extra))
                        {
                                foreach($extra as $extra_user)
@@ -413,19 +422,53 @@
                                }
                        }
 
-                       if(!$users = $this->socommon->fm_cache('acl_userlist_'. 
$right . '_' . $acl_location))
+                       if(!$users = $this->socommon->fm_cache('acl_userlist_'. 
$rights[0] . '_' . $acl_location))
                        {
-                               $users = 
$GLOBALS['phpgw']->acl->get_user_list_right($right, $acl_location);
-                               $this->socommon->fm_cache('acl_userlist_'. 
$right . '_' . $acl_location,$users);
+                               $users_gross = array();
+                               foreach ($rights as $right)
+                               {
+                                       $users_gross = 
array_merge($users_gross, $GLOBALS['phpgw']->acl->get_user_list_right($right, 
$acl_location));
+                               }
+                               
+                               $accounts       = array();
+                               $users                  = array();
+
+                               foreach ($users_gross as $entry => $user)
+                               {
+
+                                       if( !array_search($user['account_id'], 
$accounts ) )
+                                       {
+                                               $users[] = $user;
+                                       }
+                                       $accounts[] = $user['account_id'];
+                               }
+                               unset($users_gross);
+                               unset($accounts);
+
+                               foreach ($users as $key => $row) 
+                               {
+                                       $account_lastname[$key]  = 
$row['account_lastname'];
+                                       $account_firstname[$key] = 
$row['account_firstname'];
+                               }
+
+                               // Sort the data with account_lastname 
ascending, account_firstname ascending
+                               // Add $data as the last parameter, to sort by 
the common key
+                               if($users)
+                               {
+                                       array_multisort($account_lastname, 
SORT_ASC, $account_firstname, SORT_ASC, $users);
+                               }
+
+                               $this->socommon->fm_cache('acl_userlist_'. 
$rights[0] . '_' . $acl_location,$users);
                        }
 
                        if (isset($users_extra) && is_array($users_extra) && 
is_array($users))
                        {
-                               $users = $users_extra + $users;
+                               $users = array_merge($users_extra, $users);
                        }
 
+                       $user_list = array();
 
-                       while (is_array($users) && list(,$user) = each($users))
+                       foreach ($users as $user)
                        {
                                if ($user['account_lid']==$selected)
                                {
@@ -501,7 +544,8 @@
                                {
                                        $user_list[] = array
                                        (
-                                               'user_id'       => 
$user['account_id'],
+                                               //'user_id'     => 
$user['account_id'],
+                                               'id'    => $user['account_id'],
                                                'name'          => $name,
                                                'selected'      => 'selected'
                                        );
@@ -510,7 +554,8 @@
                                {
                                        $user_list[] = array
                                        (
-                                               'user_id'       => 
$user['account_id'],
+                                               //'user_id'     => 
$user['account_id'],
+                                               'id'    => $user['account_id'],
                                                'name'          => $name
                                        );
                                }
@@ -569,6 +614,43 @@
                        return $vendor;
                }
 
+
+               function initiate_ui_contact_lookup($data)
+               {
+//_debug_array($data);
+
+                       $field = $data['field'];
+                       if( isset($data['type']) && $data['type']=='view')
+                       {
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('contact_view'));
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('contact_form'));
+                       }
+
+                       $contact['value_contact_id']            = 
$data['contact_id'];
+//                     $contact['value_contact_name']          = 
$data['contact_name'];
+
+                       if(isset($data['contact_id']) && $data['contact_id'] && 
!$data['contact_name'])
+                       {
+                               $contacts                                       
                = CreateObject('phpgwapi.contacts');
+                               $contact_data                                   
        = $contacts->read_single_entry($data['contact_id'], 
array('fn','tel_work','email'));
+                               $contact['value_contact_name']          = 
$contact_data[0]['fn'];
+                               $contact['value_contact_email']         = 
$contact_data[0]['email'];
+                               $contact['value_contact_tel']           = 
$contact_data[0]['tel_work'];
+
+                               unset($contacts);
+                       }
+
+                       $contact['field']                                       
        = $field;
+                       $contact['contact_link']                                
= $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilookup.addressbook', 'column' => $field));
+                       $contact['lang_contact']                                
= lang('contact');
+                       $contact['lang_select_contact_help']    = lang('click 
this link to select');
+//_debug_array($contact);
+                       return $contact;
+               }
+
                function initiate_ui_tenant_lookup($data)
                {
                        if($data['type']=='view')
@@ -648,12 +730,171 @@
                                $b_account_data = 
$b_account_object->read_single($data['b_account_id']);
                                $b_account['value_b_account_name']      = 
$b_account_data['descr'];
                        }
-
+                       $b_account['disabled']                          = 
isset($data['disabled']) && $data['disabled'] ? true : false;
 //_debug_array($b_account);
                        return $b_account;
                }
 
+               function initiate_project_group_lookup($data)
+               {
+                       $project_group = array();
 
+                       if( isset($data['type']) && $data['type']=='view')
+                       {
+                               if(!isset($data['project_group']) || 
!$data['project_group'])
+                               {
+                                       return $project_group;
+                               }
+
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('project_group_view'));
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('project_group_form'));
+                       }
+
+                       $project_group['value_project_group']                   
        = $data['project_group'];
+                       $project_group['value_project_group_descr']             
        = $data['project_group_descr'];
+                       $project_group['project_group_url']                     
                = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilookup.project_group'));
+                       $project_group['lang_select_project_group_help']        
= lang('click to select project group');
+                       $project_group['lang_project_group']                    
        = lang('project group');
+                       if($data['project_group'] && 
(!isset($data['project_group_descr']) || !$data['project_group_descr']))
+                       {
+                               $project_group_object                           
= CreateObject('property.socategory');
+                               
$project_group_object->get_location_info('project_group',false);
+                               $project_group_data                             
        = $project_group_object->read_single(array('id'=> 
$data['project_group']));
+                               $project_group['value_project_group_descr']     
= $project_group_data['descr'];
+                       }
+
+                       return $project_group;
+               }
+
+               function initiate_ecodimb_lookup($data)
+               {
+                       $ecodimb = array();
+
+                       if( isset($data['type']) && $data['type']=='view')
+                       {
+                               if(!isset($data['ecodimb']) || 
!$data['ecodimb'])
+                               {
+                                       return $ecodimb;
+                               }
+
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('ecodimb_view'));
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('ecodimb_form'));
+                       }
+
+                       $ecodimb['value_ecodimb']                               
= $data['ecodimb'];
+                       $ecodimb['value_ecodimb_descr']                 = 
$data['ecodimb_descr'];
+                       $ecodimb['ecodimb_url']                                 
= $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilookup.ecodimb'));
+                       $ecodimb['lang_select_ecodimb_help']    = lang('click 
to select dimb');
+                       $ecodimb['lang_ecodimb']                                
= lang('dimb');
+                       if($data['ecodimb'] && (!isset($data['ecodimb_descr']) 
|| !$data['ecodimb_descr']))
+                       {
+                               $ecodimb_object                                 
= CreateObject('property.socategory');
+                               
$ecodimb_object->get_location_info('dimb',false);
+                               $ecodimb_data                                   
= $ecodimb_object->read_single(array('id'=> $data['ecodimb']));
+                               $ecodimb['value_ecodimb_descr'] = 
$ecodimb_data['descr'];
+                       }
+                       $ecodimb['disabled']                            = 
isset($data['disabled']) && $data['disabled'] ? true : false;
+
+                       return $ecodimb;
+               }
+
+
+               function initiate_event_lookup($data)
+               {
+                       $event = array();
+                       $event['name'] = $data['name']; // attribute name
+                       $event['event_name'] = $data['event_name']; // Human 
readable description
+                       if( isset($data['type']) && $data['type']=='view')
+                       {
+                               if(!isset($data['event']) || !$data['event'])
+                               {
+//                                     return $event;
+                               }
+
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('event_view'));
+                       }
+                       else
+                       {
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('event_form'));
+                       }
+
+                       // If the record is not saved - issue a warning
+                       if(isset($data['item_id']) || $data['item_id'])
+                       {
+                               $event['item_id'] = $data['item_id'];
+                       }
+                       else if(isset($data['location_code']) || 
$data['location_code'])
+                       {
+                               $event['item_id'] = 
execMethod('property.solocation.get_item_id', $data['location_code']);
+                       }
+                       else
+                       {
+                               $event['warning']                       = 
lang('Warning: the record has to be saved in order to plan an event');
+                       }
+
+                       if(isset($data['event_id']) && $data['event_id'])
+                       {
+                               $event['value']                 = 
$data['event_id'];
+                               $event_info                     = 
execMethod('property.soevent.read_single', $data['event_id']);
+                               $event['descr']                 = 
$event_info['descr'];
+                               $event['enabled']               = 
$event_info['enabled'] ? lang('yes') : lang('no');
+                               $event['lang_enabled']  = lang('enabled');
+
+                               $job_id                                 = 
"property{$data['location']}::{$data['item_id']}::{$data['name']}";
+                               $job                                    = 
execMethod('phpgwapi.asyncservice.read', $job_id);
+
+                               $event['next']                  = 
$GLOBALS['phpgw']->common->show_date($job[$job_id]['next'],$dateformat);
+                               $event['lang_next_run'] = lang('next run');
+
+                               $criteria = array
+                               (
+                                       'start_date'            => 
$event_info['start_date'],
+                                       'end_date'                      => 
$event_info['end_date'],
+                                       'location_id'           => 
$event_info['location_id'],
+                                       'location_item_id'      => 
$event_info['location_item_id']
+                               );
+
+                               $event['count'] = 0;
+                               $boevent        = 
CreateObject('property.boevent');
+                               $boevent->find_scedules($criteria);
+                               $schedules =  $boevent->cached_events;
+                               foreach($schedules as $day => $set)
+                               {
+                                       foreach ($set as $entry)
+                                       {
+                                               if($entry['enabled'] && 
(!isset($entry['exception']) || !$entry['exception']==true))
+                                               {
+                                                       $event['count']++;
+                                               }
+                                       }
+                               }
+
+                               unset($event_info);
+                               unset($job_id);
+                               unset($job);
+                       }
+
+                       $event['event_link'] = 
$GLOBALS['phpgw']->link('/index.php',array
+                       (
+                               'menuaction'    => 'property.uievent.edit',
+                               'location'              => $data['location'],
+                               'attrib_id'             => $event['name'],
+                               'item_id'               => 
isset($event['item_id']) ? $event['item_id'] : '',
+                               'id'                    => 
isset($event['value']) && $event['value'] ? $event['value'] : '')
+                       );
+
+                       $event['function_name'] = 'lookup_'. $event['name'] 
.'()';
+
+                       return $event;
+               }
+
+
                function initiate_ui_alarm($data)
                {
                        $boalarm                = 
CreateObject('property.boalarm');
@@ -815,6 +1056,42 @@
                        return 
(isset($datatype_precision[$datatype])?$datatype_precision[$datatype]:'');
                }
 
+               /**
+                * Convert a datatype to a format to output
+                *
+                * @param string $datatype the dataype to convert
+                *
+                * @return string the format - incoming of translation is not 
found
+                */
+               function translate_datatype_format($datatype)
+               {
+                       $datatype_text = array(
+                               'V' => 'varchar',
+                               'I' => 'number',
+                               'C' => 'char',
+                               'N' => 'float',
+                               'D' => 'date',
+                               'T' => 'memo',
+                               'R' => 'radio',
+                               'CH' => 'checkbox',
+                               'LB' => 'listbox',
+                               'AB' => 'contact',
+                               'VENDOR' => 'vendor',
+                               'email' => 'email',
+                               'link' => 'link',
+                               'pwd' => 'password',
+                               'user' => 'phpgw_user'
+                       );
+
+
+                       if ( isset($datatype_text[$datatype]) )
+                       {
+                               return $datatype_text[$datatype];
+                       }
+                       return $datatype;
+               }
+
+
                function save_attributes($values_attribute,$type)
                {
 
@@ -1009,6 +1286,9 @@
                                $uicols['name'][]               = 'loc' . 
$location_types[$i]['id'];
                                $uicols['descr'][]              = 
$location_types[$i]['name'];
                                $uicols['statustext'][]         = 
$location_types[$i]['descr'];
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
                        }
 /*
                        $fm_location_cols = 
$soadmin_location->read_attrib(array('type_id'=>$type_id,'lookup_type'=>$type_id));
@@ -1043,6 +1323,9 @@
                                $uicols['name'][]                       = 
'loc1_name';
                                $uicols['descr'][]                      = 
lang('Property Name');
                                $uicols['statustext'][]                 = 
lang('Property Name');
+                               $uicols['exchange'][]           = true;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
 
                                for ($i=2;$i<($type_id+1);$i++)
                                {
@@ -1051,6 +1334,9 @@
                                        $uicols['name'][]               = 'loc' 
. $i . '_name';
                                        $uicols['descr'][]              = '';
                                        $uicols['statustext'][]         = '';
+                                       $uicols['exchange'][]           = true;
+                                       $uicols['align'][]                      
= '';
+                                       $uicols['datatype'][]           = '';
                                }
                        }
 
@@ -1062,6 +1348,9 @@
                                $uicols['name'][]                       = 
'address';
                                $uicols['descr'][]                      = 
lang('address');
                                $uicols['statustext'][]         = 
lang('address');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
                        }
 
                        $config_count   = count($config);
@@ -1079,18 +1368,27 @@
                                                $uicols['name'][]               
        = 'street_name';
                                                $uicols['descr'][]              
        = lang('street name');
                                                $uicols['statustext'][]         
= lang('street name');
+                                               $uicols['exchange'][]           
= false;
+                                               $uicols['align'][]              
        = '';
+                                               $uicols['datatype'][]           
= '';
 
                                                $cols_return[]                  
        = 'street_number';
                                                $uicols['input_type'][]         
= 'hidden';
                                                $uicols['name'][]               
        = 'street_number';
                                                $uicols['descr'][]              
        = lang('street number');
                                                $uicols['statustext'][]         
= lang('street number');
+                                               $uicols['exchange'][]           
= false;
+                                               $uicols['align'][]              
        = '';
+                                               $uicols['datatype'][]           
= '';
 
                                                $cols_return[]                  
        = $config[$i]['column_name'];
                                                $uicols['input_type'][]         
= 'hidden';
                                                $uicols['name'][]               
        = $config[$i]['column_name'];
                                                $uicols['descr'][]              
        = lang($config[$i]['input_text']);
                                                $uicols['statustext'][]         
= lang($config[$i]['input_text']);
+                                               $uicols['exchange'][]           
= false;
+                                               $uicols['align'][]              
        = '';
+                                               $uicols['datatype'][]           
= '';
                                                if($lookup)
                                                {
                                                        $cols_extra[]           
        = 'street_name';
@@ -1106,6 +1404,9 @@
                                                $uicols['name'][]               
        = $config[$i]['column_name'];
                                                $uicols['descr'][]              
        = $config[$i]['input_text'];
                                                $uicols['statustext'][]         
= $config[$i]['input_text'];
+                                               $uicols['exchange'][]           
= false;
+                                               $uicols['align'][]              
        = '';
+                                               $uicols['datatype'][]           
= '';
 
                                                if($lookup)
                                                {
@@ -1141,7 +1442,9 @@
                        }
 
                        $parts= 
$this->socommon->select_part_of_town($district_id);
-
+                       $part_of_town_list = array();
+                       //address@hidden 09/09/08 validate for YUI.
+                       if(is_array($parts)&& (count($parts))){
                        foreach($parts as $entry)
                        {
                                if ($entry['id']==$selected)
@@ -1164,6 +1467,8 @@
                                        );
                                }
                        }
+                       }
+
                        return $part_of_town_list;
                }
 
@@ -1276,43 +1581,19 @@
 
                function select_datatype($selected='', $sub_module = '')
                {
-                       $datatypes[0]['id']= 'V';
-                       $datatypes[0]['name']= lang('varchar');
-                       $datatypes[1]['id']= 'C';
-                       $datatypes[1]['name']= lang('Character');
-                       $datatypes[2]['id']= 'I';
-                       $datatypes[2]['name']= lang('Integer');
-                       $datatypes[3]['id']= 'N';
-                       $datatypes[3]['name']= lang('Decimal');
-                       $datatypes[4]['id']= 'D';
-                       $datatypes[4]['name']= lang('Date');
-                       $datatypes[5]['id']= 'T';
-                       $datatypes[5]['name']= lang('Memo');
-                       $datatypes[6]['id']= 'R';
-                       $datatypes[6]['name']= lang('Multiple radio');
-                       $datatypes[7]['id']= 'CH';
-                       $datatypes[7]['name']= lang('Multiple Checkbox');
-                       $datatypes[8]['id']= 'LB';
-                       $datatypes[8]['name']= lang('ListBox');
-                       $datatypes[9]['id']= 'AB';
-                       $datatypes[9]['name']= lang('Contact');
-                       $datatypes[10]['id']= 'VENDOR';
-                       $datatypes[10]['name']= lang('Vendor');
-                       $datatypes[11]['id']= 'email';
-                       $datatypes[11]['name']= lang('Email');
-                       $datatypes[12]['id']= 'link';
-                       $datatypes[12]['name']= lang('Link');
 
-                       if($sub_module == 'actor')
+                       $custom                 = 
createObject('phpgwapi.custom_fields');
+
+                       foreach( $custom->datatype_text as $key => $name)
                        {
-                               $datatypes[13]['id']= 'pwd';
-                               $datatypes[13]['name']= lang('Password');
-                               $datatypes[14]['id']= 'user';
-                               $datatypes[14]['name']= lang('phpgw user');
+                               $datatypes[] = array
+                               (
+                                       'id'    => $key,
+                                       'name'  => $name,
+                               );
                        }
 
                        return $this->select_list($selected,$datatypes);
-
                }
 
                function select_nullable($selected='')
@@ -1403,10 +1684,12 @@
                                }
 
                                $line = 0;
+
                                foreach($content as $row)
                                {
                                        $line++;
-                                       for ($i=0; $i<count($row); $i++)
+                                       $rows = count($row);
+                                       for ($i=0; $i < $rows; $i++)
                                        {
                                                $worksheet1->write($line,$i, 
$this->utf2ascii($row[$i]));
                                        }
@@ -1591,6 +1874,7 @@
                */
                public function preserve_attribute_values($values, 
$values_attributes)
                {
+
                        if ( !is_array($values_attributes ) )
                        {
                                return array();
@@ -1600,12 +1884,13 @@
                        {       
                                foreach ( $values['attributes'] as &$val_attrib 
)
                                {
+
                                        if ( $val_attrib['id'] != 
$attribute['attrib_id'] )
                                        {
                                                continue;
                                        }
 
-                                       if( !isset($attribute['value']) )
+                                       if( !isset($attribute['value']) && 
!isset($values['extra'][$val_attrib['name']]))
                                        {
                                                continue;
                                        }
@@ -1634,6 +1919,10 @@
                                                        }
                                                }
                                        }
+                                       else if 
(isset($values['extra'][$val_attrib['name']]))
+                                       {
+                                               $val_attrib['value'] 
=$values['extra'][$val_attrib['name']];
+                                       }
                                        else
                                        {
                                                $val_attrib['value'] = 
$attribute['value'];
@@ -1709,7 +1998,7 @@
                                {
                                        foreach ($insert_record['extra'] as 
$key => $column)
                                        {
-                                               if(isset($_POST[$key]) && 
$_POST[$key])
+                                               if(isset($_POST[$key]))
                                                {
                                                        
$values['extra'][$column]       = phpgw::get_var($key, 'string', 'POST');
                                                }
@@ -1726,21 +2015,22 @@
                        return $values;
                }
 
-               function get_menu()
+               function get_menu($app = 'property')
                {
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = false;
                        
if(!isset($GLOBALS['phpgw_info']['user']['preferences']['property']['horisontal_menus'])
 || 
$GLOBALS['phpgw_info']['user']['preferences']['property']['horisontal_menus'] 
== 'no')
                        {
                                return;
                        }
                        $GLOBALS['phpgw']->xslttpl->add_file(array('menu'));
 
-                       if(!$menu = 
$GLOBALS['phpgw']->session->appsession($GLOBALS['phpgw_info']['flags']['menu_selection'],
 'menu'))
+                       if(!$menu = 
$GLOBALS['phpgw']->session->appsession($GLOBALS['phpgw_info']['flags']['menu_selection'],
 "menu_{$app}"))
                        {
-                               $menu_gross = 
execMethod('property.menu.get_menu');
+                               $menu_gross = 
execMethod("{$app}.menu.get_menu", 'horisontal');
                                $selection = 
explode('::',$GLOBALS['phpgw_info']['flags']['menu_selection']);
                                $level=0;
                                $menu['navigation'] = 
$this->get_sub_menu($menu_gross['navigation'],$selection,$level);
-                               
$GLOBALS['phpgw']->session->appsession(isset($GLOBALS['phpgw_info']['flags']['menu_selection'])
 && $GLOBALS['phpgw_info']['flags']['menu_selection'] ? 
$GLOBALS['phpgw_info']['flags']['menu_selection'] : 
'property_missing_selection', 'menu', $menu);
+                               
$GLOBALS['phpgw']->session->appsession(isset($GLOBALS['phpgw_info']['flags']['menu_selection'])
 && $GLOBALS['phpgw_info']['flags']['menu_selection'] ? 
$GLOBALS['phpgw_info']['flags']['menu_selection'] : 
'property_missing_selection', "menu_{$app}", $menu);
                                unset($menu_gross);
                        }
                        return $menu;
@@ -1805,4 +2095,88 @@
                {
                        return $this->socommon->get_location_list($required);
                }
+
+
+
+               public function select2String($array_values, $id = 'id', $name 
= 'name',$name2 = '' )
+        {
+             $str_array_values = "";
+             for($i = 0; $i < count($array_values); $i++)
+             {
+                foreach( $array_values[$i] as $key => $value )
+                {
+                    if ($key == $id)
+                    {
+                     $str_array_values .= $value;
+                     $str_array_values .= "#";
+                    }
+                    if ($key == $name)
+                    {
+                      $str_array_values .= $value;
+                      $str_array_values .= "@";
+                    }
+                 if ($key == $name2)
+                 {
+                 // eliminate hte last @ in $str_array_values
+                 $str_array_values = substr($str_array_values, 0, 
strrpos($str_array_values,'@'));
+                 $str_array_values .= " ".$value;
+                 $str_array_values .= "@";
+                 }
+                }
+             }
+             return $str_array_values;
+        }
+        
+               public function make_menu_date($array,$id_buttons,$name_hidden) 
+               {
+                       $split_values = array ();                       
+                       foreach ($array as $value)
+                       {
+                               array_push($split_values,array (text => 
"$value[id]", value => $value[id], onclick => array(fn => onDateClick, obj => 
array (id_button=>$id_buttons, opt=>$value[id], hidden_name=>$name_hidden))));
+                       }       
+                       return  $split_values;  
+               }
+               
+               public function make_menu_user($array,$id_buttons,$name_hidden) 
 
+               {
+                       $split_values = array ();                       
+                       foreach ($array as $value)
+                       {
+                               array_push($split_values,array (text => 
"$value[name]", value => $value[id], onclick => array(fn => onUserClick, obj => 
array (id_button=>$id_buttons, id=>$value[id], name =>$value[name], 
hidden_name=>$name_hidden))));
+                       }       
+                       return  $split_values;  
+               }
+               
+               public function choose_select($array, $index_return) 
+               {
+                       foreach ($array as $value)
+                       {
+                               if($value["selected"]=="selected")
+                               {
+                                       return  $value[$index_return];
+                               }
+                       }       
+                       //for avoid erros, return the last value
+                       return $array[count($array)-1][$index_return];
+               }               
+
+               /**
+               * pending action for items across the system.
+               *
+               * @param array   $data array containing string  'appname'       
                - the name of the module being looked up
+               *                                                               
                string  'location'                      - the location within 
the module to look up
+               *                                                               
                integer 'id'                            - id of the referenced 
item - could possibly be a bigint
+               *                                                               
                integer 'responsible'           - the user_id asked for approval
+               *                                                               
                string  'responsible_type'  - what type of responsible is asked 
for action (user,vendor or tenant)
+               *                                                               
                string  'action'                        - what type of action 
is pending
+               *                                                               
                string  'remark'                        - a general remark - if 
any
+               *                                                               
                integer 'deadline'                      - unix timestamp if any 
deadline is given.
+               *
+               * @return integer $reminder  number of request for this action
+               */
+
+               public function set_pending_action($action_params)
+               {
+                       return 
$this->socommon->set_pending_action($action_params);
+               }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.bodocument.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bodocument.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bodocument.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -42,6 +42,7 @@
                var $cat_id;
                var $entity_id;
                var $status_id;
+               var $allrows;
 
                var $public_functions = array
                (
@@ -54,13 +55,14 @@
 
                function property_bodocument($session=false)
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so                       = 
CreateObject('property.sodocument');
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->solocation       = 
CreateObject('property.solocation');
                        $this->historylog       = 
CreateObject('property.historylog','document');
                        $this->contacts         = 
CreateObject('property.soactor');
-                       $this->contacts->role='vendor';
+                       $this->contacts->role   ='vendor';
+                       $this->cats                             = & 
$this->so->cats;
+                       $this->bofiles                  = 
CreateObject('property.bofiles');
 
                        if ($session)
                        {
@@ -78,54 +80,19 @@
                        $entity_id      = phpgw::get_var('entity_id', 'int');
                        $doc_type       = phpgw::get_var('doc_type');
                        $query_location = phpgw::get_var('query_location');
+                       $allrows                = phpgw::get_var('allrows', 
'bool');
 
-
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
-
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(isset($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if(isset($status_id))
-                       {
-                               $this->status_id = $status_id;
-                       }
-                       if($entity_id)
-                       {
-                               $this->entity_id = $entity_id;
-                       }
-                       if(isset($doc_type))
-                       {
-                               $this->doc_type = $doc_type;
-                       }
-                       if(isset($query_location))
-                       {
-                               $this->query_location = $query_location;
-                       }
-
+                       $this->start                    = $start ? $start : 0;
+                       $this->query                    = isset($query) ? 
$query : '';
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->filter                   = isset($filter) && 
$filter ? $filter : '';
+                       $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
+                       $this->status_id                = isset($status_id) && 
$status_id ? $status_id : '';
+                       $this->entity_id                = isset($entity_id) && 
$entity_id ? $entity_id : '';
+                       $this->doc_type                 = isset($doc_type) && 
$doc_type ? $doc_type : '';
+                       $this->query_location   = isset($query_location) && 
$query_location ? $query_location : '';
+                       $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
                }
 
                function save_sessiondata($data)
@@ -198,20 +165,37 @@
                        return $document;
                }
 
+               function get_files_at_location($location_code)
+               {
+                       return $this->so->get_files_at_location($location_code);
+               }
+
+
                function read_at_location($location_code='')
                {
+                       $use_svn = false;
+                       if(ereg('svn[s:][:/]/', 
$GLOBALS['phpgw_info']['server']['files_dir']))
+                       {
+               //              $use_svn = true;
+                       }
+
+
                        $document = $this->so->read_at_location(array('start' 
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'entity_id' => 
$this->entity_id,
-                                                                               
        'location_code' => $location_code,'doc_type'=>$this->doc_type));
+                                                                               
        'location_code' => $location_code,'doc_type'=>$this->doc_type, 
'allrows' => $this->allrows));
                        $this->total_records = $this->so->total_records;
 
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 
-                       for ($i=0; $i<count($document); $i++)
+                       foreach ($document as & $entry)
                        {
-                               $document[$i]['user'] = 
$GLOBALS['phpgw']->accounts->id2name($document[$i]['user_id']);
-                               $document[$i]['document_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['start_date'],$dateformat);
-                               $document[$i]['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($document[$i]['entry_date'],$dateformat);
+                               $entry['user'] = 
$GLOBALS['phpgw']->accounts->id2name($entry['user_id']);
+                               $entry['document_date'] = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$dateformat);
+                               $entry['entry_date']    = 
$GLOBALS['phpgw']->common->show_date($entry['entry_date'],$dateformat);
+                               if($use_svn)
+                       {
+                                       $entry['journal']               = 
$this->get_file($entry['document_id'], true);
+                               }
                        }
 
                        return $document;
@@ -223,6 +207,11 @@
                        $dateformat                                             
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $document['document_date']              = 
$GLOBALS['phpgw']->common->show_date($document['document_date'],$dateformat);
 
+                       if(ereg('svn[s:][:/]/', 
$GLOBALS['phpgw_info']['server']['files_dir']))
+                       {
+                               $document['journal']                    = 
$this->get_file($document_id, true, $document);
+                       }
+
                        if(isset($document['vendor_id']) && 
$document['vendor_id'])
                        {
                                $custom                                 = 
createObject('property.custom_fields');
@@ -253,7 +242,6 @@
                                
$document['p'][$document['p_entity_id']]['p_cat_id']=$document['p_cat_id'];
                                
$document['p'][$document['p_entity_id']]['p_cat_name'] = $category['name'];
                        }
-
                        return $document;
                }
 
@@ -330,7 +318,13 @@
                                }
                                else if ($value['status'] == 'T' || 
$value['status'] == 'TO')
                                {
-                                       $record_history[$i]['value_new_value']  
= $this->so->read_single_category($value['new_value']);
+                                       $category                               
                                = 
$this->cats->return_single($value['new_value']);
+                                       $record_history[$i]['value_new_value']  
= $category[0]['name'];
+                                       if($value['old_value'])
+                                       {
+                                               $category                       
                                        = 
$this->cats->return_single($value['old_value']);
+                                               
$record_history[$i]['value_old_value']  = $category[0]['name'];
+                                       }
                                }
                                else if ($value['status'] != 'O' && 
$value['new_value'])
                                {
@@ -347,22 +341,49 @@
                        return $record_history;
                }
 
-               function save($values)
+               function get_file($document_id, $get_journal = false, $values = 
array())
                {
+                       if(!$values)
+                       {
+                               $values = $this->read_single($document_id);
+                       }
 
-                       $document_date  = 
$this->bocommon->date_array($values['document_date']);
-                       $values['document_date']        = mktime 
(2,0,0,$document_date['month'],$document_date['day'],$document_date['year']);
+                       if($values['p_num'])
+                       {
+                               $file   = 
"{$this->bofiles->fakebase}/document/entity_{$values['p_entity_id']}_{$values['p_cat_id']}/{$values['p_num']}/{$values['doc_type']}/{$values['document_name']}";
+                       }
+                       else
+                       {
+                               $file   = 
"{$this->bofiles->fakebase}/document/{$values['location_code']}/{$values['doc_type']}/{$values['document_name']}";
+                       }
 
-                       while (is_array($values['location']) && list(,$value) = 
each($values['location']))
+                       if($this->bofiles->vfs->file_exists(array(
+                                       'string' => $file,
+                                       'relatives' => Array(RELATIVE_NONE)
+                               )))
                        {
-                               if($value)
+
+                               if($get_journal)
                                {
-                                       $location[] = $value;
+                                       return 
$this->bofiles->vfs->get_journal(array(
+                                                       'string' => $file,
+                                                       'relatives' => 
Array(RELATIVE_NONE)
+                                                       ));
                                }
+                               else
+                               {
+                                       return $file;
+                               }
                        }
+                       return false;
+                       }
 
-                       $values['location_code']=implode("-", $location);
+               function save($values)
+               {
 
+                       $document_date  = 
$this->bocommon->date_array($values['document_date']);
+                       $values['document_date']        = mktime 
(2,0,0,$document_date['month'],$document_date['day'],$document_date['year']);
+
 //_debug_array($values);
                        if ($values['document_id'])
                        {

Modified: people/sigurdne/modules/property/trunk/inc/class.boentity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boentity.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boentity.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -42,6 +42,7 @@
                var $cat_id;
                var $allrows;
                var $part_of_town_id;
+               var $location_code;
 
                /**
                * @var object $custom reference to custom fields object
@@ -76,11 +77,16 @@
                        )
                );
 
+               var $type_app = array
+               (
+                       'entity'        => 'property',
+                       'catch'         => 'catch'
+               );
+
                function property_boentity($session=false)
                {
                        $this->solocation       = 
CreateObject('property.solocation');
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->custom           = 
createObject('property.custom_fields');
 
                        if ($session)
                        {
@@ -100,20 +106,23 @@
                        $start_date     = phpgw::get_var('start_date');
                        $end_date       = phpgw::get_var('end_date');
                        $allrows        = phpgw::get_var('allrows', 'bool');
+                       $type           = phpgw::get_var('type');
+                       $location_code          = 
phpgw::get_var('location_code');
+                       $this->type     = isset($type)  && $type && 
$this->type_app[$type] ? $type : 'entity';
+                       $this->location_code    = isset($location_code)  && 
$location_code ? $location_code : '';
 
-
                        $this->soadmin_entity   = 
CreateObject('property.soadmin_entity',$entity_id,$cat_id);
                        $this->so               = 
CreateObject('property.soentity',$entity_id,$cat_id);
-                       $this->category_dir = 'entity_' . $entity_id . '_' . 
$cat_id;
+                       $this->custom                                   = & 
$this->so->custom;
+                       $this->soadmin_entity->type             = $this->type;
+                       $this->soadmin_entity->type_app = $this->type_app;
+                       $this->so->type                                 = 
$this->type;
+                       $this->so->type_app                             = 
$this->type_app;
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
+                       $this->category_dir = 
"{$this->type}_{$entity_id}_{$cat_id}";
+
+                       $this->start                    = $start ? $start : 0;
+
                        if(isset($_POST['query']) || isset($_GET['query']))
                        {
                                $this->query = $query;
@@ -164,13 +173,13 @@
                {
                        if ($this->use_session)
                        {
-                               
$GLOBALS['phpgw']->session->appsession('session_data','entity',$data);
+                               
$GLOBALS['phpgw']->session->appsession('session_data',$this->type,$data);
                        }
                }
 
                function read_sessiondata()
                {
-                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','entity');
+                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data',$this->type);
                        //_debug_array($data);
                        $this->start            = 
isset($data['start'])?$data['start']:'';
                        $this->query            = 
isset($data['query'])?$data['query']:'';
@@ -188,9 +197,10 @@
                {
                        if(!$selected)
                        {
-                               
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property']["entity_columns_"
 . $this->entity_id . '_' . $this->cat_id];
+                               
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]["{$this->type}_columns_{$this->entity_id}_{$this->cat_id}"];
                        }
-                       $columns = $this->custom->find('property','.entity.' . 
$entity_id . '.' . $cat_id, 0, '','','',true);
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = 
$this->custom->find($this->type_app[$this->type],".{$this->type}.{$entity_id}.{$cat_id}",
 0, '','','',true, false, $filter);
                        
$column_list=$this->bocommon->select_multi_list($selected,$columns);
                        return $column_list;
                }
@@ -230,7 +240,7 @@
                        return 
$this->bocommon->select_list($selected,$status_entries);
                }
 
-               function read($data='')
+               function read($data= array())
                {
                        if(isset($this->allrows))
                        {
@@ -239,8 +249,11 @@
 
                        $entity = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' => 
$this->district_id,
-                                                                               
        
'lookup'=>isset($data['lookup'])?$data['lookup']:'','allrows'=>isset($data['allrows'])?$data['allrows']:'','entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'status'=>$this->status,
-                                                                               
        
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),'end_date'=>$this->bocommon->date_to_timestamp($data['end_date'])));
+                                                                               
        
'lookup'=>isset($data['lookup'])?$data['lookup']:'','allrows'=>isset($data['allrows'])?$data['allrows']:'',
+                                                                               
        
'entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'status'=>$this->status,
+                                                                               
        'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),
+                                                                               
        'end_date'=>$this->bocommon->date_to_timestamp($data['end_date']),
+                                                                               
        'dry_run'=>$data['dry_run'], 'type'=>$data['type'], 'location_code' => 
$this->location_code));
 
                        $this->total_records = $this->so->total_records;
                        $this->uicols   = $this->so->uicols;
@@ -273,16 +286,16 @@
                        return $entity;
                }
 
-               function read_single($data)
+               function read_single($data, $values = array())
                {
-                       $values['attributes'] = 
$this->custom->find('property','.entity.' . $data['entity_id'] .'.' . 
$data['cat_id'], 0, '', 'ASC', 'attrib_sort', true, true);
+                       $values['attributes'] = 
$this->custom->find($this->type_app[$this->type],".{$this->type}.{$data['entity_id']}.{$data['cat_id']}",
 0, '', 'ASC', 'attrib_sort', true, true);
                        if(isset($data['id']) && $data['id'])
                        {
                                $values = $this->so->read_single($data, 
$values);
                        }
-                       $values = $this->custom->prepare($values, 
'property','.entity.' . $data['entity_id'] .'.' . $data['cat_id'], 
$data['view']);
+                       $values = $this->custom->prepare($values, 
$this->type_app[$this->type],".{$this->type}.{$data['entity_id']}.{$data['cat_id']}",
 $data['view']);
 
-                       $soadmin_entity = 
CreateObject('property.soadmin_entity');
+       //              $soadmin_entity = 
CreateObject('property.soadmin_entity');
 
                        if($values['location_code'])
                        {
@@ -299,7 +312,7 @@
 
                        if($values['p_num'])
                        {
-                               $category = 
$soadmin_entity->read_single_category($values['p_entity_id'],$values['p_cat_id']);
+                               $category = 
$this->soadmin_entity->read_single_category($values['p_entity_id'],$values['p_cat_id']);
                                
$values['p'][$values['p_entity_id']]['p_num']=$values['p_num'];
                                
$values['p'][$values['p_entity_id']]['p_entity_id']=$values['p_entity_id'];
                                
$values['p'][$values['p_entity_id']]['p_cat_id']=$values['p_cat_id'];
@@ -308,23 +321,60 @@
 
                        $vfs = CreateObject('phpgwapi.vfs');
                        $vfs->override_acl = 1;
-                       $values['files'] = $vfs->ls (array(
-                            'string' => 
"/property/{$this->category_dir}/{$values['location_data']['loc1']}/{$data['id']}",
+                       
+                       $loc1 = isset($values['location_data']['loc1']) && 
$values['location_data']['loc1'] ? $values['location_data']['loc1'] : 'dummy';
+
+                       if($this->type_app[$this->type] == 'catch')
+                       {
+                               $loc1 = 'dummy';
+                       }
+
+                       $files = $vfs->ls (array(
+                            'string' => 
"/property/{$this->category_dir}/{$loc1}/{$data['id']}",
                             'relatives' => array(RELATIVE_NONE)));
 
                        $vfs->override_acl = 0;
 
-                       if(!isset($values['files'][0]['file_id']) || 
!$values['files'][0]['file_id'])
+                       $values['jasperfiles']  = array();
+                       $values['files']                = array();
+                       foreach ($files as $file)
                        {
-                               unset($values['files']);
+                               if (strpos($file['name'], 'jasper::')===0)// 
check for jasper
+                       {
+                                       $values['jasperfiles'][] = array
+                                       (
+                                               'name'          => $file['name']
+                                       );
+                               }
+                               else
+                               {
+                                       $values['files'][] = array
+                                       (
+                                               'name'          => $file['name']
+                                       );
+                               }
                        }
 
                        $interlink      = CreateObject('property.interlink');
-                       $values['origin'] = 
$interlink->get_relation('property', 
".entity.{$data['entity_id']}.{$data['cat_id']}", $data['id'], 'origin');
-                       $values['target'] = 
$interlink->get_relation('property', 
".entity.{$data['entity_id']}.{$data['cat_id']}", $data['id'], 'target');
+                       $values['origin'] = 
$interlink->get_relation($this->type_app[$this->type], 
".{$this->type}.{$data['entity_id']}.{$data['cat_id']}", $data['id'], 'origin');
+                       $values['target'] = 
$interlink->get_relation($this->type_app[$this->type], 
".{$this->type}.{$data['entity_id']}.{$data['cat_id']}", $data['id'], 'target');
                        return $values;
                }
 
+               /**
+               * Arrange attributes within groups
+               *
+               * @param string  $location    the name of the location of the 
attribute
+               * @param array   $attributes  the array of the attributes to be 
grouped
+               *
+               * @return array the grouped attributes
+               */
+
+               public function get_attribute_groups($location, $attributes = 
array())
+               {
+                       return 
$this->custom->get_attribute_groups($this->type_app[$this->type], $location, 
$attributes);
+               }
+
                function 
save($values,$values_attribute,$action='',$entity_id,$cat_id)
                {
                        while (is_array($values['location']) && list(,$value) = 
each($values['location']))
@@ -355,8 +405,8 @@
 
                        $criteria = array
                        (
-                               'appname'       => 'property',
-                               'location'      => 
".entity.{$entity_id}.{$cat_id}",
+                               'appname'       => $this->type_app[$this->type],
+                               'location'      => 
".{$this->type}.{$entity_id}.{$cat_id}",
                                'allrows'       => true
                        );
 
@@ -370,10 +420,11 @@
                                        continue;
                                }
 
-                               $file = PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                               $file = PHPGW_SERVER_ROOT . 
"/{$this->type_app[$this->type]}/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+
                                if ( $entry['active'] && is_file($file) )
                                {
-                                       require_once PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                                       require_once $file;
                                }
                        }
 
@@ -393,11 +444,50 @@
                        }
                }
 
+               function get_history_type_for_location($acl_location)
+               {
+                       switch($acl_location)
+                       {
+                               case '.project.request':
+                                       $history_type ='request';
+                                       break;
+                               case '.project.workorder':
+                                       $history_type ='workorder';
+                                       break;
+                               case '.project':
+                                       $history_type ='project';
+                                       break;
+                               case '.tts':
+                                       $history_type ='tts';
+                                       break;
+                               case '.document':
+                                       $history_type ='document';
+                                       break;
+                               case 'entity':
+                                       $this->table='fm_entity_history';
+                                       $this->attrib_id_field = 
',history_attrib_id';
+                                       break;
+                               case '.s_agreement':
+                                       $history_type ='s_agreement';
+                                       break;
+                               case '.s_agreement.detail':
+                                       $history_type ='s_agreement';
+                               default:
+                                       $history_type = 
str_replace('.','_',substr($acl_location,-strlen($acl_location)+1));
+                       }
+                       if(!$history_type)
+                       {
+                                       throw new Exception(lang('Unknown 
history type for acl_location: %1', $acl_location));
+                       }
+                       return $history_type;
+               }
+               
                function read_attrib_history($data)
                {
                //      _debug_array($data);
-                       $historylog = 
CreateObject('property.historylog','entity_' . $data['entity_id'] .'_' . 
$data['cat_id']);
-                       $history_values = 
$historylog->return_array(array(),array('SO'),'history_timestamp','ASC',$data['id'],$data['attrib_id']);
+                       $history_type = 
$this->get_history_type_for_location($data['acl_location']);
+                       $historylog = 
CreateObject('property.historylog',$history_type);
+                       $history_values = 
$historylog->return_array(array(),array('SO'),'history_timestamp','ASC',$data['id'],$data['attrib_id'],
 $data['detail_id']);
                        $this->total_records = count($history_values);
                //      _debug_array($history_values);
                        return $history_values;
@@ -405,7 +495,8 @@
 
                function delete_history_item($data)
                {
-                       $historylog = 
CreateObject('property.historylog','entity_' . $data['entity_id'] .'_' . 
$data['cat_id']);
+                       $history_type = 
$this->get_history_type_for_location($data['acl_location']);
+                       $historylog = CreateObject('property.historylog', 
$history_type);
                        $historylog->delete_single_record($data['history_id']);
                }
 

Added: people/sigurdne/modules/property/trunk/inc/class.boevent.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boevent.inc.php            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.boevent.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,1159 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free 
Software Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage admin
+       * @version $Id$
+       */
+
+       /*
+        * Import the datetime class for date processing
+        */
+       phpgw::import_class('phpgwapi.datetime');
+
+if ( !extension_loaded('mcal') )
+{
+       define('MCAL_RECUR_NONE',0);
+       define('MCAL_RECUR_DAILY',1);
+       define('MCAL_RECUR_WEEKLY',2);
+       define('MCAL_RECUR_MONTHLY_MDAY',3);
+       define('MCAL_RECUR_MONTHLY_WDAY',4);
+       define('MCAL_RECUR_YEARLY',5);
+       
+       define('MCAL_M_SUNDAY',1);
+       define('MCAL_M_MONDAY',2);
+       define('MCAL_M_TUESDAY',4);
+       define('MCAL_M_WEDNESDAY',8);
+       define('MCAL_M_THURSDAY',16);
+       define('MCAL_M_FRIDAY',32);
+       define('MCAL_M_SATURDAY',64);
+       
+       define('MCAL_M_WEEKDAYS',62);
+       define('MCAL_M_WEEKEND',65);
+       define('MCAL_M_ALLDAYS',127);
+}
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_boevent
+       {
+               var $start;
+               var $query;
+               var $filter;
+               var $sort;
+               var $order;
+               var $cat_id;
+               var $location_info = array();
+               var $cached_events;
+               protected $event_functions = array
+               (
+                       'send_sms'      => 'send SMS'
+               );
+
+               var $public_functions = array
+               (
+                       'event_schedule_data'           => true,
+                       'event_schedule_week_data'      => true
+               );
+
+       
+               function __construct($session=false)
+               {
+                       $this->so                       = 
CreateObject('property.soevent');
+                       $this->custom           = 
CreateObject('property.custom_fields');//& $this->so->custom;
+       //              $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->sbox             = CreateObject('phpgwapi.sbox');
+                       $this->asyncservice = 
CreateObject('phpgwapi.asyncservice');
+
+                       if ($session)
+                       {
+                               $this->read_sessiondata();
+                               $this->use_session = true;
+                       }
+
+                       $start                          = 
phpgw::get_var('start', 'int', 'REQUEST', 0);
+                       $query                          = 
phpgw::get_var('query');
+                       $sort                           = 
phpgw::get_var('sort');
+                       $order                          = 
phpgw::get_var('order');
+                       $filter                         = 
phpgw::get_var('filter', 'int');
+                       $cat_id                         = 
phpgw::get_var('cat_id', 'int');
+                       $allrows                        = 
phpgw::get_var('allrows', 'bool');
+                       $type                           = 
phpgw::get_var('type');
+                       $type_id                        = 
phpgw::get_var('type_id', 'int');
+
+                       $this->start            = $start ? $start : 0;
+                       $this->query            = isset($_REQUEST['query']) ? 
$query : $this->query;
+                       $this->sort                     = 
isset($_REQUEST['sort']) ? $sort : $this->sort;
+                       $this->order            = isset($_REQUEST['order']) ? 
$order : $this->order;
+                       $this->filter           = isset($_REQUEST['filter']) ? 
$filter : $this->filter;
+                       $this->cat_id           = isset($_REQUEST['cat_id'])  ? 
$cat_id :  $this->cat_id;
+                       $this->allrows          = isset($allrows) ? $allrows : 
false;
+
+                       //$this->location_info = 
$this->so->get_location_info($type, $type_id);
+
+               }
+
+               public function save_sessiondata($data)
+               {
+                       if ($this->use_session)
+                       {
+                               
$GLOBALS['phpgw']->session->appsession('session_data','category',$data);
+                       }
+               }
+
+               function read_sessiondata()
+               {
+                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','category');
+
+       //              _debug_array($data);
+
+                       $this->start    = $data['start'];
+                       $this->query    = $data['query'];
+                       $this->filter   = $data['filter'];
+                       $this->sort             = $data['sort'];
+                       $this->order    = $data['order'];
+                       $this->cat_id   = $data['cat_id'];
+                       $this->allrows  = $data['allrows'];
+               }
+
+               public function read()
+               {
+                       $values = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'allrows'=>$this->allrows));
+
+                       $this->total_records = $this->so->total_records;
+                       $this->uicols = $this->so->uicols;
+
+                       return $values;
+               }
+
+               public function read_single($id)
+               {
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $values = $this->so->read_single($id);
+                       if($values)
+                       {
+                               $values['start_date']           = 
$GLOBALS['phpgw']->common->show_date($values['start_date'],$dateformat);
+                               $values['end_date']             = 
$GLOBALS['phpgw']->common->show_date($values['end_date'],$dateformat);
+                               if($values['rpt_day'])
+                               {
+                                       $rpt_day = array
+                                       (
+                                               1               => 'Sunday',
+                                               2               => 'Monday',
+                                               4               => 'Tuesday',
+                                               8               => 'Wednesday',
+                                               16              => 'Thursday',
+                                               32              => 'Friday',
+                                               64              => 'Saturday'
+                                       );
+
+                                       foreach ($rpt_day as $mask => $name)
+                                       {
+                                               if($mask & $values['rpt_day'])
+                                               {
+                                                       
$values['repeat_day'][$mask] = $name;
+                                               }
+                                       }
+                               }
+
+                               $location       = phpgw::get_var('location');
+                               $job_id = 
"property{$location}::{$values['location_item_id']}::{$values['attrib_id']}";
+                               $job = execMethod('phpgwapi.asyncservice.read', 
$job_id);
+
+                               $values['next'] = 
$GLOBALS['phpgw']->common->show_date($job[$job_id]['next'],$dateformat);
+                       }
+
+       //              $this->find_scedules($criteria);
+
+                       return $values;
+               }
+
+               public function save($data)
+               {
+                       $data['start_date'] = 
phpgwapi_datetime::date_to_timestamp($data['start_date']);
+                       $data['end_date'] = 
phpgwapi_datetime::date_to_timestamp($data['end_date']);
+
+                       if (isset($data['id']) && $data['id'] > 0 && 
$this->so->read_single($data['id']))
+                       {
+                               $receipt = $this->so->edit($data);
+                       }
+                       else
+                       {
+                               $receipt = $this->so->add($data);
+                       }
+
+                       $action_object          = 
CreateObject('property.socategory');
+                       $action_object->get_location_info('event_action',false);
+                       $action = $action_object->read_single(array('id'=> 
$data['action']),$values = array());
+
+                       $rpt_day = array
+                       (
+                               1               => 0, //'Sunday',
+                               2               => 1, //'Monday',
+                               4               => 2, //'Tuesday',
+                               8               => 3, //'Wednesday',
+                               16              => 4, //'Thursday',
+                               32              => 5, //'Friday',
+                               64              => 6  //'Saturday'
+                       );
+
+                       $repeat_day = array();
+                       if ($data['repeat_day'])
+                       {
+                               foreach ($data['repeat_day'] as $day)
+                               {
+                                       if (isset($rpt_day[$day]))
+                                       {
+                                               $repeat_day[] = $rpt_day[$day];
+                                       }
+                               }
+                               $repeat_day = implode(',', $repeat_day);
+                       }
+
+                       if(!isset($data['repeat_type']) || 
!$data['repeat_type'])
+                       {
+                               $times = $data['start_date'];
+                       }
+                       else
+                       {
+                               $dow = $rpt_day[$data['repeat_day'][0]];
+                               switch($data['repeat_type'])
+                               {
+                                       case '0':
+                                               $times = $data['start_date'];
+                                               break;
+                                       case '1': //'Daily'
+                                               if($data['repeat_interval'])
+                                               {
+                                                       $times = array('day' => 
"*/{$data['repeat_interval']}");
+                                               }
+                                               else
+                                               {
+                                                       $times = array('day' => 
"*/1");
+                                               }
+                                               break;
+                                       case '2': //'Weekly'
+                                               if($data['repeat_interval'])
+                                               {
+                                                       $day = 
$data['repeat_interval'] * 7;
+                                                       $times = array('day' => 
"*/{$day}");
+                                               }
+                                               else
+                                               {
+                                                       $times = array('day' => 
"*/7");
+                                               }
+                                               if ($data['repeat_day'])
+                                               {
+                                                       $times['dow'] = 
$repeat_day;
+                                               }
+                                               break;
+                                       case '3': //'Monthly (by day)'
+                                               if( !isset($data['repeat_day']) 
|| !is_array($data['repeat_day']) )
+                                               {
+                                                       $dow = 1;
+                                               }
+                                               
+                                               if($data['repeat_interval'])
+                                               {
+                                                       $times = array('month' 
=> "*/{$data['repeat_interval']}", 'dow' => $dow);
+                                               }
+                                               else
+                                               {
+                                                       $times = array('month' 
=> "*/1", 'dow' => $dow);
+                                               }
+                                               break;
+                                       case '4': //'Monthly (by date)'
+                                               if($data['repeat_interval'])
+                                               {
+                                                       $times = array('month' 
=> "*/{$data['repeat_interval']}", 'day' => 1);
+                                               }
+                                               else
+                                               {
+                                                       $times = array('day' => 
1);
+                                               }
+                                               break;
+                                       case '5': //'Yearly'
+                                               $month = date(n, 
$data['start_date']);
+                                               if($data['repeat_interval'])
+                                               {
+                                                       $times = array('year' 
=> "*/{$data['repeat_interval']}", 'month' => $month);
+                                               }
+                                               else
+                                               {
+                                                       $times = array('month' 
=> $month);
+                                               }
+                                               break;
+                                       default:
+                                               $times = $data['start_date'];
+                                               break;
+                               }
+                       }
+
+                       //$times['min']= '*'; // for testing the  - every minute
+
+                       $account_id = 
execMethod('property.soresponsible.get_responsible_user_id', 
$data['responsible']);
+
+                       $timer_data = array
+                       (
+                               'start'         => $data['start_date'],
+                               'enabled'       => true,
+                               'owner'         => $account_id,
+                               'enabled'       => !! $data['enabled'],
+                               'action'        => $action['action']
+                       );
+                               
+                       if($data['end_date'])
+                       {
+                               $timer_data['end'] = $data['end_date'];
+                       }
+
+                       if($action['data'])
+                       {
+                               str_replace(";", '', $action['data']);
+                               eval('$action_data = ' . 
htmlspecialchars_decode($action['data']) . ';');
+                               $timer_data = array_merge($timer_data, 
$action_data);
+                       }
+
+                       $location       = phpgw::get_var('location');
+
+                       $id = 
"property{$location}::{$data['item_id']}::{$data['attrib_id']}";
+                       $timer_data['id'] = $id;
+
+                       $this->asyncservice->cancel_timer($id);
+                       $this->asyncservice->set_timer($times, $id, 
'property.boevent.action', $timer_data, $account_id);
+
+                       return $receipt;
+               }
+
+               public function action($data)
+               {
+                       $parts = explode('::',$data['id']);
+                       $id = end($parts);
+
+                       if($data['enabled'] && 
!$this->so->check_event_exception($id,$data['time']))
+                       {
+                               list($module, $classname) = explode('.', 
$data['action'], 2);
+                               if ( is_file(PHPGW_INCLUDE_ROOT . 
"/{$module}/class.{$classname}.inc.php") )
+                               {
+                                       $message = execMethod($data['action'], 
$data);
+                               }
+                               else
+                               {
+                                       $message = "No such file: 
{$module}/class.{$classname}.inc.php";
+                               }
+
+                               $this->so->cron_log(array
+                                       (
+                                               'cron'          => true, // or 
false for manual...
+                                               'action'        => 
$data['action'],
+                                               'message'       => $message
+                                       )
+                               );
+                       }
+               }
+
+               public function delete($id)
+               {
+                       $values = $this->read_single($id);
+                       $location       = phpgw::get_var('location');
+                       $job_id = 
"property{$location}::{$values['location_item_id']}::{$values['attrib_id']}";
+                       $job = execMethod('phpgwapi.asyncservice.cancel_timer', 
$job_id);
+
+                       return $this->so->delete($id);
+               }
+
+               public function get_rpt_type_list($selected='')
+               {
+                       $rpt_type = array
+                       (
+                               0       => 'None',
+                               1       => 'Daily',
+                               2       => 'Weekly',
+                               3       => 'Monthly (by date)',
+                               4       => 'Monthly (by day)',
+                               5       => 'Yearly'
+                       );
+
+
+                       return $this->sbox->getArrayItem('values[repeat_type]', 
$selected, $rpt_type);
+               }
+
+               public function get_rpt_day_list($selected=array())
+               {
+                       $rpt_day = array
+                       (
+                               1               => 'Sunday',
+                               2               => 'Monday',
+                               4               => 'Tuesday',
+                               8               => 'Wednesday',
+                               16              => 'Thursday',
+                               32              => 'Friday',
+                               64              => 'Saturday'
+                       );
+
+                       $title = lang('(for weekly)');
+                       $i = 0; $boxes = '';
+                       foreach ($rpt_day as $mask => $name)
+                       {
+                               $boxes .= '<input type="checkbox" title = "' . 
$title . '"name="values[repeat_day][]" 
value="'.$mask.'"'.(isset($selected[$mask]) && $selected[$mask] ? ' checked' : 
'').'></input> '.lang($name)."\n";
+                               if (++$i == 5) $boxes .= '<br />';
+                       }
+                       return $boxes;
+               }
+
+               public function get_responsible($selected = '')
+               {
+                       $responsible = CreateObject('property.soresponsible');
+                       
+                       $location = phpgw::get_var('location');
+                       $values = $responsible->read_type(array('start' => 0, 
'query' =>'', 'sort' => '',
+                                                                               
                'order' => '', 'location' => $location, 'allrows'=>true,
+                                                                               
                'filter' => ''));
+
+                       $list = array(0 => lang('none'));
+                       foreach($values as $entry)
+                       {
+                               $list[$entry['id']] = $entry['name'];
+                       }
+
+                       return $this->sbox->getArrayItem('values[responsible]', 
$selected, $list, true);
+               }
+
+               public function get_action($selected = '')
+               {
+/*                     $action_object                                  = 
CreateObject('property.socategory');
+                       $action_object->get_location_info('event_action',false);
+                       $values                                 = 
$action_object->read(array('allrows'=> true));
+*/
+                       $list = array(0 => lang('none'));
+/*
+                       foreach($values as $entry)
+                       {
+                               $list[$entry['id']] = $entry['name'];
+                       }
+*/
+                       $list = array_merge($list,$this->event_functions);
+
+                       return $this->sbox->getArrayItem('values[action]', 
$selected, $list, true);
+               }
+               
+               protected function send_sms()
+               {
+                       $data = array
+                       (
+                               'p_num_text'    => 'xxxxxxxx',//number
+                               'message'               => 'dette er en melding'
+                       );
+
+                       execMethod('sms.bosms.send_sms', $data);
+               }
+
+               /**
+               * Find recurring events
+               *
+               * @param array $date the date array to convert, must contain 
keys 'start_date', 'end_date', 'appname', 'location'
+               * @return array events
+               */
+
+               function find_scedules($params)
+               {                       
+                       if(!is_array($params))
+                       {
+                               return False;
+                       }
+
+                       if(!isset($params['location_id']) || 
!$params['location_id'])
+                       {
+                               if(!isset($params['appname']) || 
!$params['appname'] || !isset($params['location']) || !$params['location'])
+                               {
+                                       throw new 
Exception("property_boevent::find_scedules - Missing location info in input");
+                               }
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($params['appname'], $params['location']);
+                       }
+                       else
+                       {
+                               $location_id = $params['location_id'];
+                       }
+
+                       if(!isset($params['location_item_id']) || 
!$params['location_item_id'])
+                       {
+                                       throw new 
Exception("property_boevent::find_scedules - Missing location_item_id in 
input");
+                       }
+                       $location_item_id = $params['location_item_id'];
+
+                       if($params['start_date'])
+                       {
+                               $syear = date('Y',$params['start_date']);
+                               $smonth = date('m',$params['start_date']);
+                               $sday = date('d',$params['start_date']);
+                       }
+
+                       $eyear = $params['end_date'] ? 
date('Y',$params['end_date']) : 0;
+                       $emonth = $params['end_date'] ? 
date('m',$params['end_date']) : 0;
+                       $eday = $params['end_date'] ? 
date('d',$params['end_date']) : 0;
+
+                       $owner_id = 
(isset($params['owner'])?$params['owner']:0);
+                       if($owner_id==0 && $this->is_group)
+                       {
+                               unset($owner_id);
+                               $owner_id = $this->g_owner;
+                               if($this->debug)
+                               {
+                                       echo '<!-- owner_id in 
('.implode($owner_id,',').') -->'."\n";
+                               }
+                       }
+                       
+                       if(!$eyear && !$emonth && !$eday)
+                       {
+                               $edate = mktime(23,59,59,$smonth + 1,$sday + 
1,$syear);
+                               $eyear = date('Y',$edate);
+                               $emonth = date('m',$edate);
+                               $eday = date('d',$edate);
+                       }
+                       else
+                       {
+                               if(!$eyear)
+                               {
+                                       $eyear = $syear;
+                               }
+                               if(!$emonth)
+                               {
+                                       $emonth = $smonth + 1;
+                                       if($emonth > 12)
+                                       {
+                                               $emonth = 1;
+                                               $eyear++;
+                                       }
+                               }
+                               if(!$eday)
+                               {
+                                       $eday = $sday + 1;
+                               }
+                               $edate = mktime(23,59,59,$emonth,$eday,$eyear);
+                       }
+                       
+                       if($this->debug)
+                       {
+                               echo '<!-- Start Date : 
'.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+                               echo '<!-- End   Date : 
'.sprintf("%04d%02d%02d",$eyear,$emonth,$eday).' -->'."\n";
+                       }
+
+                       $find_criteria = array
+                       (
+                               'syear'                         => $syear,
+                               'smonth'                        => $smonth,
+                               'sday'                          => $sday,
+                               'eyear'                         => $eyear,
+                               'emonth'                        => $emonth,
+                               'eday'                          => $eday,
+                               'tz_offset'                     => 0,
+                               'extra'                         => '',
+                               'owner_id'                      => $owner_id,
+                               'location_id'           => $location_id,
+                               'location_item_id'      => $location_item_id
+                       );
+
+                       $cached_event_ids                       = 
$this->so->list_events($find_criteria);
+                       $cached_event_ids_repeating     = 
$this->so->list_repeated_events($find_criteria);
+//_debug_array($cached_event_ids_repeating);die();
+                       unset($find_criteria);
+
+                       if($this->debug)
+                       {
+                               echo '<!-- events cached : 
'.count($cached_event_ids).' : for : 
'.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+                               echo '<!-- repeating events cached : 
'.count($cached_event_ids_repeating).' : for : 
'.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
+                       }
+
+                       $this->cached_events = array();
+                       
+                       if(!$cached_event_ids && !$cached_event_ids_repeating)
+                       {
+                               return;
+                       }
+
+
+                       foreach($cached_event_ids as $cached_event_id)
+                       {
+                               $event = 
$this->so->read_single($cached_event_id);
+                               $startdate = 
intval(date('Ymd',$event['start_date']));
+                               $enddate = 
intval(date('Ymd',$event['end_date']));
+                               $this->cached_events[$startdate][] = $event;
+                               if($startdate != $enddate && 
!$cached_event_ids_repeating)
+                               {
+                                       $start['year'] = 
intval(substr($startdate,0,4));
+                                       $start['month'] = 
intval(substr($startdate,4,2));
+                                       $start['mday'] = 
intval(substr($startdate,6,2));
+                                       
for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=intval(date('Ymd',mktime(0,0,0,$start['month'],$start['mday']
 + $k,$start['year']))))
+                                       {
+                                               $c_evt_day = 0;
+                                               
if(isset($this->cached_events[$j]) && is_array($this->cached_events[$j]))
+                                               {
+                                                       $c_evt_day = 
count($this->cached_events[$j])-1;
+                                               }
+                                               if($this->debug)
+                                               {
+                                                       echo 'Date: '.$j.' 
Count : '.count($this->cached_events[$j])."\n";
+                                               }
+
+                                               
if(!isset($this->cached_events[$j][$c_evt_day])
+                                                       
||$this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
+                                               {
+                                                       if($this->debug)
+                                                       {
+                                                               echo "Adding 
Event ID {$event['id']} for Date: {$j}</br>";
+                                                       }
+                                                       
$this->cached_events[$j][] = $event;
+                                               }
+                                       }
+                               }
+                       }
+
+                       $this->repeating_events = array();
+                       if($cached_event_ids_repeating)
+                       {
+//_debug_array($cached_event_ids_repeating);die();
+                               $i = 0;
+                               foreach($cached_event_ids_repeating as 
$cached_event_id)
+                               {
+                                       $this->repeating_events[] = 
$this->so->read_single($cached_event_id);
+
+                                       if($this->debug)
+                                       {
+                                               echo 'Cached Events ID: 
'.$cached_event_id.' 
('.sprintf("%04d%02d%02d",$this->repeating_events[$i]['start']['year'],$this->repeating_events[$i]['start']['month'],$this->repeating_events[$i]['start']['mday']).')</br>';
+                                       }
+                                       $i++;
+                               }
+//                             $edate -= phpgwapi_datetime::user_timezone();
+//                             for($date=mktime(0,0,0,$smonth,$sday,$syear) - 
phpgwapi_datetime::tz_offset;$date<=$edate;$date += 86400)
+                               
for($date=mktime(0,0,0,$smonth,$sday,$syear);$date<=$edate;$date += 
phpgwapi_datetime::SECONDS_IN_DAY)
+                               {
+                                       if($this->debug)
+                                       {
+                                               $search_date = 
date('Ymd',$date);
+                                               echo 'Calling 
check_repeating_events('.$search_date.')</br>';
+                                       }
+                                       $this->check_repeating_events($date);
+                                       if($this->debug)
+                                       {
+                                               echo 'Total events found 
matching '.$search_date.' = '.count($this->cached_events[$search_date]).'</br>';
+                                               
for($i=0;$i<count($this->cached_events[$search_date]);$i++)
+                                               {
+                                                       echo '<!-- Date: 
'.$search_date.' ['.$i.'] = '.$this->cached_events[$search_date][$i]['id'].' 
-->'."\n";
+                                               }
+                                       }
+                               }
+                       }
+                       $retval = array();
+                       
for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday
 + $k,$syear)))
+                       {
+                               if(isset($this->cached_events[$j]) && 
is_array($this->cached_events[$j]))
+                               {
+                                       $retval[$j] = $this->cached_events[$j];
+                               }
+                       }
+//_debug_array($this->cached_events);die();
+                       return $retval;
+//                     return $this->cached_events;
+               }
+
+               function check_repeating_events($datetime)
+               {
+                       @reset($this->repeating_events);
+                       $search_date_full = date('Ymd',$datetime);
+                       $search_date_year = date('Y',$datetime);
+                       $search_date_month = date('m',$datetime);
+                       $search_date_day = date('d',$datetime);
+                       $search_date_dow = date('w',$datetime);
+                       $search_date_week = date('YW',$datetime);
+                       $search_beg_day = 
mktime(13,0,0,$search_date_month,$search_date_day,$search_date_year);
+                       if($this->debug)
+                       {
+                               echo '<!-- Search Date Full = 
'.$search_date_full.' -->'."\n";
+                       }
+                       $repeated = $this->repeating_events;
+                       $r_events = count($repeated);
+                       for ($i=0;$i<$r_events;$i++)
+                       {
+                               if($this->repeating_events[$i]['repeat_type'] 
!=0)
+                               {
+                                       $rep_events = 
$this->repeating_events[$i];
+
+                                       $id = $rep_events['id'];
+                                       $rep_events['start']['month']   = 
date('m',$rep_events['start_date']);
+                                       $rep_events['start']['mday']    = 
date('d',$rep_events['start_date']);
+                                       $rep_events['start']['year']    = 
date('Y',$rep_events['start_date']);
+
+//                                     $event_beg_day = 
mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']);
+                                       $event_beg_day = 
$rep_events['start_date'];
+                                       $event_beg_week = 
date('YW',$rep_events['start_date']);
+
+                                       if(isset($rep_events['end_date']) && 
$rep_events['end_date'])
+                                       {
+                                               $event_recur_time = 
$rep_events['end_date'];
+                                       }
+                                       else
+                                       {
+                                               $event_recur_time = 
mktime(0,0,0,1,1,2030);
+                                       }
+/*
+                                       
if($rep_events['recur_enddate']['month'] != 0 && 
$rep_events['recur_enddate']['mday'] != 0 && 
$rep_events['recur_enddate']['year'] != 0)
+                                       {
+                                               $event_recur_time = 
$this->maketime($rep_events['recur_enddate']);
+                                       }
+                                       else
+                                       {
+                                               $event_recur_time = 
mktime(0,0,0,1,1,2030);
+                                       }
+*/
+                                       $end_recur_date = 
date('Ymd',$event_recur_time);
+                                       $full_event_date = 
date('Ymd',$event_beg_day);
+
+                                       if($this->debug)
+                                       {
+                                               echo '<!-- 
check_repeating_events - Processing ID - '.$id.' -->'."\n";
+                                               echo '<!-- 
check_repeating_events - Recurring End Date - '.$end_recur_date.' -->'."\n";
+                                       }
+
+                                       // only repeat after the beginning, and 
if there is an rpt_end before the end date
+                                       if (($search_date_full > 
$end_recur_date) || ($search_date_full < $full_event_date))
+                                       {
+                                               continue;
+                                       }
+
+                                       if ($search_date_full == 
$full_event_date)
+                                       {
+                                               
$this->sort_event($rep_events,$search_date_full);
+                                               continue;
+                                       }
+                                       else
+                                       {                               
+                                               $freq = 
(isset($rep_events['repeat_interval']) && $rep_events['repeat_interval'] 
?$rep_events['repeat_interval']:1);
+                                               $type = 
$rep_events['repeat_type'];
+                                               switch($type)
+                                               {
+                                                       case MCAL_RECUR_DAILY:
+                                                               if($this->debug)
+                                                               {
+                                                                       echo 
'<!-- check_repeating_events - MCAL_RECUR_DAILY - '.$id.' -->'."\n";
+                                                               }
+//                                                             if ($freq == 1 
&& $rep_events['recur_enddate']['month'] != 0 && 
$rep_events['recur_enddate']['mday'] != 0 && 
$rep_events['recur_enddate']['year'] != 0 && $search_date_full <= 
$end_recur_date)
+                                                               if ($freq == 1 
&& $rep_events['end_date'] && $search_date_full <= $end_recur_date)
+                                                               {
+                                                                       
$this->sort_event($rep_events,$search_date_full);
+                                                               }
+                                                               elseif 
(floor(($search_beg_day - $event_beg_day)/86400) % $freq)
+                                                               {
+                                                                       
continue;
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$this->sort_event($rep_events,$search_date_full);
+                                                               }
+                                                       break;
+                                                       case MCAL_RECUR_WEEKLY:
+                                                               $test = 
(($search_beg_day - $event_beg_day)/604800)/$freq;
+                                                               $test_subtract 
= floor($test);
+
+                                                               //if 
(floor(($search_beg_day - $event_beg_day)/604800) % $freq)
+                                                               
if(!$rep_events['rpt_day'])
+                                                               {
+                                                                       
if(!($test - $test_subtract))
+                                                                       {
+                                                                               
$this->sort_event($rep_events,$search_date_full);
+                                                                       }
+                                                               }
+                                                               else
+                                                               {
+                                                                       $test = 
($search_date_week - $event_beg_week)/$freq;
+                                                                       
$test_subtract = floor($test);
+                                                                       
if(($test - $test_subtract))
+                                                                       {
+                                                                               
continue;
+                                                                       }
+
+                                                                       $check 
= 0;
+                                                                       
switch($search_date_dow)
+                                                                       {
+                                                                               
case 0:
+                                                                               
        $check = MCAL_M_SUNDAY;
+                                                                               
        break;
+                                                                               
case 1:
+                                                                               
        $check = MCAL_M_MONDAY;
+                                                                               
        break;
+                                                                               
case 2:
+                                                                               
        $check = MCAL_M_TUESDAY;
+                                                                               
        break;
+                                                                               
case 3:
+                                                                               
        $check = MCAL_M_WEDNESDAY;
+                                                                               
        break;
+                                                                               
case 4:
+                                                                               
        $check = MCAL_M_THURSDAY;
+                                                                               
        break;
+                                                                               
case 5:
+                                                                               
        $check = MCAL_M_FRIDAY;
+                                                                               
        break;
+                                                                               
case 6:
+                                                                               
        $check = MCAL_M_SATURDAY;
+                                                                               
        break;
+                                                                       }
+
+                                                                       if 
($rep_events['rpt_day'] & $check)
+                                                                       {
+                                                                               
$this->sort_event($rep_events,$search_date_full);
+                                                                       }
+                                                               }
+                                                               break;
+                                                       case 
MCAL_RECUR_MONTHLY_WDAY:
+                                                               if 
((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month 
- $rep_events['start']['month']) % $freq)
+                                                               {
+                                                                       
continue;
+                                                               }
+         
+                                                               if 
((phpgwapi_datetime::day_of_week($rep_events['start']['year'],$rep_events['start']['month'],$rep_events['start']['mday'])
 == 
phpgwapi_datetime::day_of_week($search_date_year,$search_date_month,$search_date_day))
 &&
+                                                                       
(ceil($rep_events['start']['mday']/7) == ceil($search_date_day/7)))
+                                                               {
+                                                                       
$this->sort_event($rep_events,$search_date_full);
+                                                               }
+                                                               break;
+                                                       case 
MCAL_RECUR_MONTHLY_MDAY:
+                                                               if 
((($search_date_year - $rep_events['start']['year']) * 12 + $search_date_month 
- $rep_events['start']['month']) % $freq)
+                                                               {
+                                                                       
continue;
+                                                               }
+                                                               if 
($search_date_day == $rep_events['start']['mday'])
+                                                               {
+                                                                       
$this->sort_event($rep_events,$search_date_full);
+                                                               }
+                                                               break;
+                                                       case MCAL_RECUR_YEARLY:
+                                                               if 
(($search_date_year - $rep_events['start']['year']) % $freq)
+                                                               {
+                                                                       
continue;
+                                                               }
+                                                               if 
(date('dm',$datetime) == date('dm',$event_beg_day))
+                                                               {
+                                                                       
$this->sort_event($rep_events,$search_date_full);
+                                                               }
+                                                               break;
+                                               }
+                                       }
+                               }
+                       }       // end for loop
+               }       // end function
+
+
+               function sort_event($event,$date)
+               {
+                       $inserted = False;
+                       $event['start']['month']        = 
date('m',$event['start_date']);
+                       $event['start']['mday']         = 
date('d',$event['start_date']);
+                       $event['start']['year']         = 
date('Y',$event['start_date']);
+
+                       if(isset($event['repeat_exception']))
+                       {
+//                             $event_time = 
mktime($event['start']['hour'],$event['start']['min'],0,intval(substr($date,4,2)),intval(substr($date,6,2)),intval(substr($date,0,4)))
 - phpgwapi_datetime::user_timezone();
+                               $event_time = 
mktime($event['start']['hour'],$event['start']['min'],0,intval(substr($date,4,2)),intval(substr($date,6,2)),intval(substr($date,0,4)));
+                               while($inserted == false && 
list($key,$exception_time) = each($event['repeat_exception']))
+                               {
+                                       if($this->debug)
+                                       {
+                                               echo '<!-- checking exception 
datetime '.$exception_time.' to event datetime '.$event_time.' -->'."\n";
+                                       }
+                                       if($exception_time == $event_time)
+                                       {
+//_debug_array(date('Y-m-d',$event_time));die();
+//                                             _debug_array($event);
+//                                             
_debug_array($this->cached_events);die();
+//                                             $inserted = true;
+                                               $event['exception'] = true;
+
+/*
+                                               
for($i=0;$i<count($this->cached_events[$date]);$i++)
+                                               {
+                                                       
if($this->cached_events[$date][$i]['id'] == $event['id'])
+                                                       {
+                                                       die();
+                                                       }
+                                               }
+*/
+                                       }
+                               }
+                       }
+                       if(isset($this->cached_events[$date]) && 
$this->cached_events[$date] && $inserted == false)
+                       {
+                               
+                               if($this->debug)
+                               {
+                                       echo '<!-- Cached Events found for 
'.$date.' -->'."\n";
+                               }
+                               $year = substr($date,0,4);
+                               $month = substr($date,4,2);
+                               $day = substr($date,6,2);
+
+                               if($this->debug)
+                               {
+                                       echo '<!-- Date : '.$date.' Count : 
'.count($this->cached_events[$date]).' -->'."\n";
+                               }
+                               
+                               
for($i=0;$i<count($this->cached_events[$date]);$i++)
+                               {
+                                       $events = 
$this->cached_events[$date][$i];
+                                       
if($this->cached_events[$date][$i]['id'] == $event['id'] || 
$this->cached_events[$date][$i]['reference'] == $event['id'])
+                                       {
+                                               if($this->debug)
+                                               {
+                                                       echo '<!-- Item already 
inserted! -->'."\n";
+                                               }
+                                               $inserted = True;
+                                               break;
+                                       }
+                                       /* This puts all spanning events across 
multiple days up at the top. */
+                                       
if($this->cached_events[$date][$i]['repeat_type'] == MCAL_RECUR_NONE)
+                                       {
+                                               
if($this->cached_events[$date][$i]['start']['mday'] != $day && 
$this->cached_events[$date][$i]['end']['mday'] >= $day)
+                                               {
+                                                       continue;
+                                               }
+                                       }
+                                       
if(date('Hi',mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$day,$year))
 < 
date('Hi',mktime($this->cached_events[$date][$i]['start']['hour'],$this->cached_events[$date][$i]['start']['min'],$this->cached_events[$date][$i]['start']['sec'],$month,$day,$year)))
+                                       {
+               //                              
for($j=count($this->cached_events[$date]);$j>=$i;$j--)
+                                               
for($j=count($this->cached_events[$date]);$j>=($i+1);$j--)
+                                               {
+                                                       
$this->cached_events[$date][$j] = $this->cached_events[$date][$j-1];
+                                               }
+                                               if($this->debug)
+                                               {
+                                                       echo '<!-- Adding event 
ID: '.$event['id'].' to cached_events -->'."\n";
+                                               }
+                                               $inserted = True;
+                                               $this->cached_events[$date][$i] 
= $event;
+                                               break;
+                                       }
+                               }
+                       }
+                       if(!$inserted)
+                       {
+                               if($this->debug)
+                               {
+                                       echo '<!-- Adding event ID: 
'.$event['id'].' to cached_events -->'."\n";
+                               }
+                               $this->cached_events[$date][] = $event;
+                       }
+               }
+
+               public function init_schedule_week($id, $buildingmodule, 
$resourcemodule, $search = null)
+               {
+                       $date = new DateTime(phpgw::get_var('date'));
+                       // Make sure $from is a monday
+                       if($date->format('w') != 1)
+                       {
+                               $date->modify('last monday');
+                       }
+
+                       $prev_date = clone $date;
+                       $next_date = clone $date;
+                       $prev_date->modify('-1 week');
+                       $next_date->modify('+1 week');
+                       $resource = $this->read_single($id);
+            if ($search)
+            {
+                $resource['buildings_link'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $search, "type" => 
"building"));
+            }
+            else
+            {
+                $resource['buildings_link'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $buildingmodule . 
'.index'));
+            }
+
+                       $resource['building_link'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $buildingmodule . 
'.show', 'id' => $resource['building_id']));
+                       $resource['resource_link'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $resourcemodule . 
'.show', 'id' => $resource['id']));
+                       $resource['date'] = $date->format('Y-m-d');
+                       $resource['week'] = intval($date->format('W'));
+                       $resource['year'] = intval($date->format('Y'));
+                       $resource['prev_link'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $resourcemodule . 
'.schedule_week', 'id' => $resource['id'], 'date'=> 
$prev_date->format('Y-m-d')));
+                       $resource['next_link'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $resourcemodule . 
'.schedule_week', 'id' => $resource['id'], 'date'=> 
$next_date->format('Y-m-d')));
+                       for($i = 0; $i < 7; $i++)
+                       {
+                               $resource['days'][] = array('label' => 
sprintf('%s<br/>%s %s', lang($date->format('l')), lang($date->format('M')), 
$date->format('d')), 'key' => $date->format('D'));
+                               $date->modify('+1 day');
+                       }
+                       return $resource;
+               }
+
+
+               /**
+               * Find recurring events for a week
+               *
+               * @return array schedule
+               */
+
+               public function event_schedule_week_data()
+               {
+//                 $date = new DateTime(phpgw::get_var('date')); Use this one 
when moving to php 5.3
+
+                       $datetime = CreateObject('phpgwapi.datetime');
+                       $date = $datetime->convertDate(phpgw::get_var('date'), 
'Y-m-d', $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       $datetime_start = $datetime->date_to_timestamp($date);
+           
+                       $id = phpgw::get_var('resource_id', 'int');
+       
+                       $event = $this->so->read_single($id);
+                       $criteria = array
+                       (
+                               'start_date'            => $datetime_start,
+                               'end_date'                      => 
$datetime_start + (86400 * 6),
+                               'location_id'           => 
$event['location_id'],
+                               'location_item_id'      => 
$event['location_item_id']
+                       );
+
+                       $this->find_scedules($criteria);
+                       $schedules =  $this->cached_events;
+
+                       $total_records = 0;
+                       foreach($schedules as $_date => $set)
+                       {
+                               if(count($set) > $total_records)
+                               {
+                                       $total_records = count($set);
+                               }
+                       }
+
+                       $lang_exception  = lang('exception');
+                       $values = array();
+                       for($i = 0; $i < $total_records; $i++)
+                       {
+                               $values[$i] = array
+                               (
+                                       'resource'                      => 
'descr',
+                                       'resource_id'           => 11,
+                                       'time'                          => $i+1,
+                                       '_from'                         => 
'16:30',
+                                       '_to'                           => 
'17:00'
+                               );
+
+                               foreach($schedules as $_date => $set)
+                               {
+                                       $__date = substr($_date,0,4) . '-' . 
substr($_date,4,2) . '-' . substr($_date,6,2);
+                                       $date = new DateTime($__date);
+                                       $day_of_week = $date->format('D');
+                                       $values[$i][$day_of_week] = array
+                                       (
+                                               'exception' => 
$set[$i]['exception'],
+                                               'lang_exception' => 
$lang_exception,
+                                               'type' => 'event',
+                                               'name' => $set[$i]['descr'],
+                                               'link' => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'booking.uievent.show', 'location_id' => $set[$i]['location_id'], 
'location_item_id' => $set[$i]['location_item_id']))
+                                       );
+                               }
+                       }
+
+                       $data = array
+                       (
+                               'ResultSet' => array(
+                                       "totalResultsAvailable" => 
$total_records, 
+                                       "Result" => $values
+                               )
+                       );
+//_debug_array($data);die();
+                       return $data;
+
+               }
+
+               /**
+               * Find recurring events for a period defined by the event
+               *
+               * @return array schedule
+               */
+
+               public function event_schedule_data()
+               {
+                       $id = phpgw::get_var('id', 'int');
+       
+                       $event = $this->so->read_single($id);
+
+                       $criteria = array
+                       (
+                               'start_date'            => $event['start_date'],
+                               'end_date'                      => 
$event['end_date'],
+                               'location_id'           => 
$event['location_id'],
+                               'location_item_id'      => 
$event['location_item_id']
+                       );
+
+                       $this->find_scedules($criteria);
+                       $schedules =  $this->cached_events;
+
+                       $total_records = 0;
+
+                       $lang_exception  = lang('exception');
+                       $values = array();
+
+                       $i = 1;
+                       foreach($schedules as $_date => $set)
+                       {
+                               $__date = substr($_date,0,4) . '-' . 
substr($_date,4,2) . '-' . substr($_date,6,2);
+                               $date = phpgwapi_datetime::convertDate($__date, 
'Y-m-d', $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+
+                               foreach($set as $entry)
+                               {
+                                       $values[] = array
+                                       (
+                                               'time'                          
=> $i,
+                                               'date'                          
=> array
+                                               (
+                                                       'exception' => 
$entry['exception'],
+                                                       'lang_exception' => 
$lang_exception,
+                                                       'type' => 'event',
+                                                       'name' => $date,
+                                                       'link' => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'booking.uievent.show', 'location_id' => $entry['location_id'], 
'location_item_id' => $entry['location_item_id']))
+                                               )
+                                       );
+
+                                       $i++;
+                               }
+                       }
+
+                       $data = array
+                       (
+                               'ResultSet' => array(
+                                       "totalResultsAvailable" => 
$total_records, 
+                                       "Result" => $values
+                               )
+                       );
+
+                       return $data;
+               }
+
+               public function set_exceptions($data = array())
+               {
+                       if(!isset($data['event_id']) || !$data['event_id'])
+                       {
+                                       throw new 
Exception("property_boevent::set_exceptions - Missing event_id info in input");
+                       }
+                       $this->so->set_exceptions($data);
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.boevent.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/inc/class.bofiles.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bofiles.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bofiles.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -8,13 +8,13 @@
         * @package phpgroupware
         * @subpackage property
         * @category core
-        * @version $Id: class.botts.inc.php 836 2008-03-15 14:39:28Z sigurd $
+        * @version $Id: class.bofiles.inc.php 4058 2009-11-06 14:50:54Z sigurd 
$
         */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -61,6 +61,21 @@
                }
 
                /**
+                * Set the account id used for cron jobs where there is no 
user-session
+                *
+                * @param integer $account_id the account id to use - 0 = 
current user
+                *
+                * @return null
+                */
+               public function set_account_id($account_id = 0)
+               {
+                       if($account_id)
+                       {
+                               $this->vfs->working_id = $account_id;
+                       }
+               }
+
+               /**
                * Create catalog - starting with fakebase
                *
                * @param string $type part of path pointing to end target
@@ -179,7 +194,7 @@
                * @return null
                */
 
-               function view_file($type = '', $file = '')
+               function view_file($type = '', $file = '', $jasper = '')
                {
                        $GLOBALS['phpgw_info']['flags']['noheader'] = true;
                        $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
@@ -187,10 +202,15 @@
 
                        if(!$file)
                        {
-                               $file_name = 
realpath(urldecode(phpgw::get_var('file_name')));
-                               $id        = phpgw::get_var('id', 'int');
+                               $file_name = 
urldecode(phpgw::get_var('file_name'));
+                               $id        = phpgw::get_var('id');
                                $file      = 
"{$this->fakebase}/{$type}/{$id}/{$file_name}";
                        }
+                       // prevent path traversal
+                       if ( preg_match('/\.\./', $file) )
+                       {
+                               return false;
+                       }
 
                        if($this->vfs->file_exists(array(
                                'string' => $file,
@@ -204,6 +224,10 @@
                                                'nofiles'               => true
                                        ));
 
+                               $browser = CreateObject('phpgwapi.browser');
+
+                               if(!$jasper)
+                               {
                                $this->vfs->override_acl = 1;
 
                                $document = $this->vfs->read(array(
@@ -212,11 +236,55 @@
 
                                $this->vfs->override_acl = 0;
 
-                               $browser = CreateObject('phpgwapi.browser');
                                
$browser->content_header($ls_array[0]['name'],$ls_array[0]['mime_type'],$ls_array[0]['size']);
-
                                echo $document;
                        }
+                               else //Execute the jasper report
+                               {
+                                       //class_path
+                               //      $dirname = PHPGW_API_INC . 
'/jasper/lib';
+                                       $dirname = 'phpgwapi/inc/jasper/lib';
+                                       $file_list = array();
+                               //      $file_list[] = PHPGW_API_INC . 
'/jasper/bin';
+                                       $file_list[] = 
'phpgwapi/inc/jasper/bin';
+                                       $dir = new DirectoryIterator($dirname); 
+                                       if ( is_object($dir) )
+                                       {
+                                               foreach ( $dir as $_file )
+                                               {
+                                                       if ( $_file->isDot()
+                                                               || 
!$_file->isFile()
+                                                               || 
!$_file->isReadable()
+                                                               || 
mime_content_type($_file->getPathname()) == 'text/xml')
+                                                       {
+                                                               continue;
+                                                       }
+
+                                                       $file_list[] = (string) 
"{$dirname}/{$_file}";
+                                               }
+                                       }
+                                       
+                                       if (stristr(PHP_OS, 'WIN')) 
+                                       { 
+                                               $sep = ';';// Win 
+                                       }
+                                       else
+                                       { 
+                                               $sep = ':';// Other
+                                       }
+
+                                       $class_path = implode($sep, $file_list);
+                                       $type = 'pdf';
+                                       $select_criteria = '//Record';
+                                       $template = "{$this->rootdir}/{$file}";
+
+                                       $cmd = "java -Djava.awt.headless=true 
-cp {$class_path} XmlJasperInterface -o{$type} -f{$template} 
-x{$select_criteria} < " . PHPGW_SERVER_ROOT . 
"/catch/test_data/jasper/tilstand.xml";
+
+                                       
$browser->content_header('report.pdf','application/pdf');
+
+                                       passthru($cmd);
+                               }
+                       }
                }
 
                /**
@@ -231,7 +299,7 @@
                {
                        $attachments = array();
 
-                       foreach ($values['file_action'] as $file_name)
+                       foreach ($values as $file_name)
                        {
                                $file = "{$this->fakebase}{$path}{$file_name}";
 

Modified: people/sigurdne/modules/property/trunk/inc/class.bogab.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bogab.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bogab.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -52,15 +52,9 @@
 
                function property_bogab($session=false)
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->solocation       = 
CreateObject('property.solocation');
-                       $this->config           = 
CreateObject('phpgwapi.config');
-                       $this->config->read_repository();
-                       $this->gab_insert_level = 
(isset($this->config->config_data['gab_insert_level'])?$this->config->config_data['gab_insert_level']:3);
+                       $this->so               = 
CreateObject('property.sogab');
 
-                       $this->so               = 
CreateObject('property.sogab',$this->gab_insert_level);
-
                        if ($session)
                        {
                                $this->read_sessiondata();
@@ -135,7 +129,7 @@
                }
 
 
-               function 
read($loc1='',$gaards_nr='',$bruksnr='',$feste_nr='',$seksjons_nr='',$address='',$check_payments
 = '',$allrows='')
+               function 
read($location_code='',$gaards_nr='',$bruksnr='',$feste_nr='',$seksjons_nr='',$address='',$check_payments
 = '',$allrows='')
                {
                        if($allrows)
                        {
@@ -143,7 +137,7 @@
                        }
 
                        $gab = $this->so->read(array('start' => 
$this->start,'sort' => $this->sort,'order' => 
$this->order,'allrows'=>$this->allrows,
-                                                                               
        'cat_id' => $this->cat_id,'loc1' => $loc1,
+                                                                               
        'cat_id' => $this->cat_id,'location_code' => $location_code,
                                                                                
        'gaards_nr' => $gaards_nr,'bruksnr' => $bruksnr,'feste_nr' => $feste_nr,
                                                                                
        'seksjons_nr' => $seksjons_nr,'address' => $address,'check_payments' => 
$check_payments));
                        $this->total_records = $this->so->total_records;
@@ -151,10 +145,11 @@
                        return $gab;
                }
 
-               function read_detail($gab_id='')
+               //address@hidden $allrows - variable to display all records
+               function read_detail($gab_id='', $allrows=0)
                {
                        $gab = $this->so->read_detail(array('start' => 
$this->start,'sort' => $this->sort,'order' => $this->order,
-                                                                               
        'cat_id' => $this->cat_id,'gab_id' => 
$gab_id,'allrows'=>$this->allrows));
+                                                                               
        'cat_id' => $this->cat_id,'gab_id' => $gab_id,'allrows'=>$allrows));
                        $this->total_records = $this->so->total_records;
 
                        $this->uicols   = $this->so->uicols;

Modified: people/sigurdne/modules/property/trunk/inc/class.boifc.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boifc.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boifc.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -283,10 +283,10 @@
                                        continue;
                                }
 
-                               $file = PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                               $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
                                if ( $entry['active'] && is_file($file) )
                                {
-                                       require_once PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                                       require_once $file;
                                }
                        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.boinvestment.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boinvestment.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boinvestment.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -285,10 +285,11 @@
 
                        $new_index=str_replace(",",".",$values['new_index']);
 
-                       while($entry=each($values['update']))
+                       $update = array();
+                       foreach($values['update'] as $entry)
                        {
-                               $local_error='';
-                               $n=$entry[0];
+                               $local_error = false;
+                               $n = $entry;
 
                                if ($values['value'][$n])
                                {
@@ -312,7 +313,7 @@
                                                );
                                }
                        }
-                       $this->so->update_investment($update);
+                       return $this->so->update_investment($update);
                }
 
 

Modified: people/sigurdne/modules/property/trunk/inc/class.boinvoice.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boinvoice.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boinvoice.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -56,56 +56,19 @@
                        $allrows                = phpgw::get_var('allrows', 
'bool');
                        $b_account_class        = 
phpgw::get_var('b_account_class', 'int');
                        $district_id            = phpgw::get_var('district_id', 
'int');
+                       $b_account                              = 
phpgw::get_var('b_account');
 
-
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
-
-                       if(isset($district_id))
-                       {
-                               $this->district_id = $district_id;
-                       }
-
-                       if(isset($b_account_class))
-                       {
-                               $this->b_account_class = $b_account_class;
-                       }
-
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-
-                       if(!empty($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if(isset($user_lid))
-                       {
-                               $this->user_lid = $user_lid;
-                       }
-                       if(isset($allrows))
-                       {
-                               $this->allrows = $allrows;
-                       }
+                       $this->start                    = $start ? $start : 0;
+                       $this->b_account                = isset($b_account) ? 
$b_account : $b_account;
+                       $this->district_id              = isset($district_id) ? 
$district_id : $district_id;
+                       $this->b_account_class  = isset($b_account_class) ? 
$b_account_class : $b_account_class;
+                       $this->query                    = isset($query) ? 
$query : $query;
+                       $this->filter                   = isset($filter) ? 
$filter : $filter;
+                       $this->sort                             = isset($sort) 
? $sort : $sort;
+                       $this->order                    = isset($order) ? 
$order : $order;
+                       $this->cat_id                   = isset($cat_id) ? 
$cat_id : $cat_id;
+                       $this->user_lid                 = isset($user_lid) ? 
$user_lid : $user_lid;
+                       $this->allrows                  = isset($allrows) ? 
$allrows : $allrows;
                }
 
 
@@ -138,6 +101,9 @@
 
                function 
read_invoice($paid='',$start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$voucher_id='')
                {
+                       $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
+                       $end_date       = 
$this->bocommon->date_to_timestamp($end_date);
+                       
                        $invoice = $this->so->read_invoice(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'user_lid' => $this->user_lid,'cat_id' => $this->cat_id, 'paid' => 
$paid,
                                                                                
        'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
@@ -170,11 +136,14 @@
 
                function 
read_consume($start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$b_account_class='',$district_id='')
                {
+                       $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
+                       $end_date       = 
$this->bocommon->date_to_timestamp($end_date);
+
                        $invoice = $this->so->read_consume(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'user_lid' => $this->user_lid,'cat_id' => $this->cat_id,
                                                                                
        'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
                                                                                
        'loc1'=>$loc1,'workorder_id'=>$workorder_id,'b_account_class' 
=>$b_account_class,
-                                                                               
        'district_id' => $district_id ));
+                                                                               
        'district_id' => $district_id, 'b_account' => $this->b_account ));
 
                        $this->total_records = $this->so->total_records;
 
@@ -307,7 +276,7 @@
                                        
$GLOBALS['phpgw']->xslttpl->add_file(array('user_lid_filter'));
                                        break;
                        }
-                       
$users=$this->bocommon->get_user_list_right(1,$selected,'.invoice',$extra,$default);
+                       $users=$this->bocommon->get_user_list_right(array(32, 
64, 128),$selected,'.invoice',$extra,$default);
                        return $users;
                }
 
@@ -357,15 +326,12 @@
                                $values['dima']=implode('',$values['location']);
                        }
 
-                       $values['spbudact_code']=$values['b_account_id'];
-                       $values['fakturanr']=$values['invoice_num'];
-                       $values['spvend_code']=$values['vendor_id'];
+                       $values['spbudact_code']        = 
$values['b_account_id'];
+                       $values['fakturanr']            = 
$values['invoice_num'];
+                       $values['spvend_code']          = $values['vendor_id'];
+                       $values['belop']                        = 
$values['amount'];
+                       $values['godkjentbelop']        = $values['amount'];
 
-                       $values['belop'] = 
str_replace('kr','',$values['amount']);
-                       $values['belop'] = str_replace(' ','',$values['belop']);
-                       $values['belop'] = 
str_replace(',','.',$values['belop']);
-                       $values['godkjentbelop']=$values['belop'];
-
                        $values['fakturadato'] = 
date($this->bocommon->dateformat,mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear']));
 
                        if($values['num_days'])

Modified: people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -43,6 +43,8 @@
                var $type_id;
                var $lookup;
                var $use_session;
+               var $location_code;
+               var $total_records;
 
                /**
                * @var object $custom reference to custom fields object
@@ -79,11 +81,10 @@
 
                function property_bolocation($session=false)
                {
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->so                                       = 
CreateObject('property.solocation');
+                       $this->soadmin_location         = 
CreateObject('property.soadmin_location');
                        $this->bocommon                         = 
CreateObject('property.bocommon');
-                       $this->soadmin_location         = 
CreateObject('property.soadmin_location');
-                       $this->custom                           = 
createObject('property.custom_fields');
+                       $this->so                                       = 
CreateObject('property.solocation', $this->bocommon);
+                       $this->custom                           = & 
$this->so->custom;
 
                        $this->lookup    = phpgw::get_var('lookup', 'bool');
 
@@ -105,6 +106,7 @@
                        $status                                 = 
phpgw::get_var('status');
                        $type_id                                = 
phpgw::get_var('type_id', 'int');
                        $allrows                                = 
phpgw::get_var('allrows', 'bool');
+                       $location_code                  = 
phpgw::get_var('location_code');
 
                        $this->start                    = $start ? $start : 0;
                        $this->query                    = isset($query) ? 
$query : $this->query;
@@ -118,12 +120,23 @@
                        $this->type_id                  = isset($type_id) && 
$type_id ? $type_id : 1;
                        $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
                        $this->acl_location             = '.location.' . 
$this->type_id;
+                       $this->location_code    = isset($location_code) && 
$location_code ? $location_code : '';
+                       
+                       if(isset($_REQUEST['query']) && !$query && 
!isset($_REQUEST['block_query']))
+                       {
+                               $this->location_code = '';
+                       }
                }
 
                function read_sessiondata()
                {
                        $referer = parse_url(phpgw::get_var('HTTP_REFERER', 
'string', 'SERVER') );
+                       //address@hidden validation evita NOTICE  for JSON
+                       $referer_out = array();
+                       if(isset($referer['query']) && 
is_array($referer['query'])) {
                        parse_str($referer['query'],$referer_out);
+                       }
+                       $self_out = array();
                        $self = parse_url(phpgw::get_var('QUERY_STRING', 
'string', 'SERVER') );
                        parse_str($self['path'],$self_out);
 
@@ -173,13 +186,14 @@
                        }
                }
 
-               function column_list($selected='',$type_id='',$allrows='')
+               function column_list($selected = 
array(),$type_id='',$allrows='')
                {
                        if(!$selected)
                        {
                                $selected = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_'
 . $this->type_id . !!$this->lookup]) ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']["location_columns_" . 
$this->type_id . !!$this->lookup]:'';
                        }
-                       $columns = $this->custom->find('property','.location.' 
. $type_id, 0, '','','',true);
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = $this->custom->find('property','.location.' 
. $type_id, 0, '','','',true, false, $filter);
                        
$column_list=$this->bocommon->select_multi_list($selected,$columns);
                        return $column_list;
                }
@@ -244,6 +258,13 @@
 
                function initiate_ui_location($data)
                {
+                       $config         = 
CreateObject('phpgwapi.config','property');
+                       $config->read();
+                       if (isset($config->config_data['suppress_tenant']) &&  
$config->config_data['suppress_tenant'])
+                       {
+                               $data['tenant'] = false;
+                       }
+                       unset($config);
 
                        if(isset($data['lookup_type']))
                        {
@@ -258,7 +279,9 @@
                                }
                        }
 
-                       $location_link          = "menuaction:'". 
'property'.".uilocation.index',lookup:1";
+                       $filter_location        = 
isset($data['filter_location']) ? $data['filter_location'] : '';
+                       $block_query            = !!$filter_location;
+                       $location_link          = 
"menuaction:'property.uilocation.index',lookup:1,location_code:'{$filter_location}',block_query:'{$block_query}'";
 
                        $config = $this->soadmin_location->read_config('');
 
@@ -271,13 +294,20 @@
                        {
                                $data['type_id'] = count($location_types);
                        }
-//_debug_array($data);
+//_debug_array($data);die();
 //_debug_array($location_types);
-//                     $filtermethod = " OR (type_id < $lookup_type AND 
lookup_form=1)";
-                       $filtermethod = " OR (lookup_form=1)";
-                       $fm_location_cols = $this->custom->find('property', 
'.location.' . $data['type_id'], 0, '', '', '', true,$filtermethod);
+                       $fm_location_cols = array();
+                       for ($i=1;$i<($data['type_id']+1);$i++)
+                       {
+                               $fm_location_cols_temp = 
$this->custom->find('property', '.location.' . $i, 0, '', '', '', true);
+                               foreach ($fm_location_cols_temp as & $entry)
+                               {
+                                       $entry['location_type']=$i;
+                               }
+                               $fm_location_cols = 
array_merge($fm_location_cols, $fm_location_cols_temp);
+                       }
+                       unset($fm_location_cols_temp);
 
-
 //_debug_array($fm_location_cols);
 
                        for ($i=0;$i<$data['type_id'];$i++)
@@ -311,17 +341,24 @@
                                }
 
                                
$location['location'][$i]['lookup_function_call']                       = 
'lookup_loc' . ($i+1) . '()';
-                               $location['location'][$i]['lookup_link']        
                        = true;
                                $location['location'][$i]['readonly']           
                        = true;
-                               $lookup_functions[$i]['name']                   
                        = 'lookup_loc' . ($i+1) . '()';
-                               $lookup_functions[$i]['link']                   
                        =  $location_link .',type_id:' . ($i+1) . 
',lookup_name:' . $i;
-                               $lookup_functions[$i]['action']                 
                        = 
'Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+                               
+                               if(!isset($data['block_parent']) || 
$data['block_parent'] < ($i+1))
+                               {
+                                       
$location['location'][$i]['lookup_link']                                = true;
+                                       $lookup_functions[] = array
+                                       (
+                                               'name'                          
                => 'lookup_loc' . ($i+1) . '()',
+                                               'link'                          
                =>  $location_link .',type_id:' . ($i+1) . ',lookup_name:' . $i,
+                                               'action'                        
                => 
'Window1=window.open(strURL,"Search","width=1000,height=700,toolbar=no,scrollbars=yes,resizable=yes");'
+                                       );
+                               }
 
                                if(isset($data['no_link']) && 
$data['no_link']>=($i+3))
                                {
                                        
$location['location'][$i]['lookup_link']                        = false;
                                        $lookup_functions[$i]['link']           
                        = $location_link .',type_id:' . ($data['no_link']-1) . 
',lookup_name:' . ($data['no_link']-2);
-                                       $lookup_functions[$i]['action']         
                        = 
'Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+                                       $lookup_functions[$i]['action']         
                        = 
'Window1=window.open(strURL,"Search","width=1000,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
                                        $location['location'][$i]['statustext'] 
                        = lang('click this link to select') . ' ' . 
$location_types[($data['no_link']-2)]['name'];
                                }
 
@@ -346,7 +383,6 @@
                        $location_cols_count =count($fm_location_cols);
                        for ($j=0;$j<$location_cols_count;$j++)
                        {
-                               //FIXME: location_type is currently empty - 
should'nt be...
                                
if((isset($fm_location_cols[$j]['location_type']) && 
$fm_location_cols[$j]['location_type'] <= $data['type_id']) && 
$fm_location_cols[$j]['lookup_form'])
                                {
                                        $location['location'][$i]['input_type'] 
                        = 'text';
@@ -399,9 +435,12 @@
                                        
elseif($config[$j]['column_name']=='tenant_id' && $data['tenant']):
                                        {
                                                $m++;
-                                               $lookup_functions[$m]['name']   
                                        = 'lookup_loc' . ($m+1) . '()';
-                                               $lookup_functions[$m]['link']   
                                        = $location_link 
.',lookup_tenant:1,type_id:' . $config[$j]['location_type'] . ',lookup_name:' . 
$i;
-                                               $lookup_functions[$m]['action'] 
                                        = 
'Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+                                               $lookup_functions[] = array
+                                               (
+                                                       'name'                  
                        => 'lookup_loc' . ($m+1) . '()',
+                                                       'link'                  
                        => $location_link .',lookup_tenant:1,type_id:' . 
$config[$j]['location_type'] . ',lookup_name:' . $i,
+                                                       'action'                
                        => 
'Window1=window.open(strURL,"Search","width=1600,height=700,toolbar=no,scrollbars=yes,resizable=yes");'
+                                               );
 
                                                
$location['location'][$i]['lookup_link']                        = true;
                                                
$location['location'][$i]['name']                                       = 
lang('Tenant');
@@ -409,7 +448,7 @@
                                                
$location['location'][$i]['input_name']                         = 'tenant_id';
                                                $input_name[]                   
                                                        = 
$location['location'][$i]['input_name'];
                                                
$location['location'][$i]['value']                                      = 
(isset($data['values'][$config[$j]['column_name']])?$data['values'][$config[$j]['column_name']]:'');
-                                               
$location['location'][$i]['lookup_function_call']       = 
$lookup_functions[$m]['name'];
+                                               
$location['location'][$i]['lookup_function_call']       = 'lookup_loc' . ($m+1) 
. '()';
                                                
$location['location'][$i]['statustext']                         = 
lang('tenant');
                                                
$insert_record['extra']['tenant_id']                            = 'tenant_id';
 
@@ -418,7 +457,7 @@
                                                
$location['location'][$i]['extra'][0]['readonly']       = true;
                                                $input_name[]                   
                                                        = 
$location['location'][$i]['extra'][0]['input_name'];
                                                
$location['location'][$i]['extra'][0]['size']           = 15;
-                                               
$location['location'][$i]['extra'][0]['lookup_function_call']   = 
$lookup_functions[$m]['name'];
+                                               
$location['location'][$i]['extra'][0]['lookup_function_call']   = 'lookup_loc' 
. ($m+1) . '()';
                                                
$location['location'][$i]['extra'][0]['value']          = 
(isset($data['values']['last_name'])?$data['values']['last_name']:'');
                                                
$location['location'][$i]['extra'][0]['statustext']     = lang('last name');
 
@@ -427,7 +466,7 @@
                                                
$location['location'][$i]['extra'][1]['readonly']       = true;
                                                $input_name[]                   
                                                        = 
$location['location'][$i]['extra'][1]['input_name'];
                                                
$location['location'][$i]['extra'][1]['size']           = 15;
-                                               
$location['location'][$i]['extra'][1]['lookup_function_call']   = 
$lookup_functions[$m]['name'];
+                                               
$location['location'][$i]['extra'][1]['lookup_function_call']   = 'lookup_loc' 
. ($m+1) . '()';
                                                
$location['location'][$i]['extra'][1]['value']          = 
(isset($data['values']['first_name'])?$data['values']['first_name']:'');
                                                
$location['location'][$i]['extra'][1]['statustext']     = lang('first name');
                                                $i++;
@@ -467,9 +506,12 @@
                                {
                                        $m++;
 
-                                       $lookup_functions[$m]['name'] = 
'lookup_entity_' . $entity['id'] .'()';
-                                       $lookup_functions[$m]['link'] = 
"menuaction:'". 'property'.".uilookup.entity',location_type:".$data['type_id'] 
. ',entity_id:'. $entity['id'];
-                                       $lookup_functions[$m]['action'] = 
'Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+                                       $lookup_functions[] = array
+                                       (
+                                               'name'          => 
'lookup_entity_' . $entity['id'] .'()',
+                                               'link'          => 
"menuaction:'property.uilookup.entity',location_type:{$data['type_id']},entity_id:{$entity['id']},location_code:'{$filter_location}',block_query:'{$block_query}'",
+                                               'action'        => 
'Window1=window.open(strURL,"Search","width=1200,height=700,toolbar=no,scrollbars=yes,resizable=yes");'
+                                       );
 
                                        $location['location'][$i]['input_type'] 
                                        = 'text';
                                        $location['location'][$i]['input_name'] 
                                        = 'entity_num_' . $entity['id'];
@@ -566,15 +608,27 @@
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'type_id' => 
$data['type_id'],
                                                                                
        'lookup_tenant'=>$data['lookup_tenant'],'lookup'=>$data['lookup'],
                                                                                
        'district_id'=>$this->district_id,'allrows'=>$data['allrows'],
-                                                                               
        'status'=>$this->status,'part_of_town_id'=>$this->part_of_town_id));
+                                                                               
        
'status'=>$this->status,'part_of_town_id'=>$this->part_of_town_id,'dry_run'=>$data['dry_run'],
+                                                                               
        'location_code' => $this->location_code));
+
                        $this->total_records = $this->so->total_records;
                        $this->uicols = $this->so->uicols;
 
                        return $location;
                }
 
-               function read_single($location_code='',$extra=array())
+               function read_single($data='',$extra=array())
                {
+                       if(is_array($data))
+                       {
+                               $location_code  = $data['location_code'];
+                               $extra                  = $data['extra'];
+                       }
+                       else
+                       {
+                               $location_code = $data;
+                       }
+
                        $location_array = split('-',$location_code);
                        $type_id= count($location_array);
 
@@ -583,9 +637,17 @@
                                return;
                        }
 
+                       if(!isset($extra['noattrib']) || !$extra['noattrib'])
+                       {
                        $values['attributes'] = 
$this->custom->find('property','.location.' . $type_id, 0, '', 'ASC', 
'attrib_sort', true, true);
                        $values = $this->so->read_single($location_code, 
$values);
-                       $values = $this->custom->prepare($values, 
'property','.location.' . $type_id, $extra['view']);
+                               $values = $this->custom->prepare($values, 
'property',".location.{$type_id}", $extra['view']);
+                       }
+                       else
+                       {
+                               $values = 
$this->so->read_single($location_code);
+                       }
+                       
 
                        if( isset($extra['tenant_id']) && 
$extra['tenant_id']!='lookup')
                        {
@@ -648,7 +710,20 @@
                        return 
$this->so->check_location($location_code,$type_id);
                }
 
+               /**
+               * Arrange attributes within groups
+               *
+               * @param string  $location    the name of the location of the 
attribute
+               * @param array   $attributes  the array of the attributes to be 
grouped
+               *
+               * @return array the grouped attributes
+               */
 
+               public function get_attribute_groups($location, $attributes = 
array())
+               {
+                       return $this->custom->get_attribute_groups('property', 
$location, $attributes);
+               }
+
                function 
save($location,$values_attribute,$action='',$type_id='',$location_code_parent='')
                {
                        if(is_array($values_attribute))
@@ -692,25 +767,37 @@
                                        continue;
                                }
 
-                               $file = PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                               $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
                                if ( $entry['active'] && is_file($file) )
                                {
-                                       require_once PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                                       require_once $file;
                                }
                        }
 
                        return $receipt;
                }
 
-               function delete($location_code)
+               /*function delete2($location_code)
                {
                        $this->so->delete($location_code);
+               }*/
+
+               function delete()
+               {
+                       $location_code = 
phpgw::get_var('location_code','string','GET');
+                       $this->so->delete($location_code);
                }
 
                function update_cat()
                {
                        return $this->so->update_cat();
                }
+
+               function update_location()
+               {
+                       return $this->so->update_location();
+               }
+
                function read_summary($data=array())
                {
                        $summary = $this->so->read_summary(array('filter' => 
$this->filter,'type_id' => isset($data['type_id'])?$data['type_id']:'',

Modified: people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -60,40 +60,16 @@
                        $filter                 = phpgw::get_var('filter', 
'int');
                        $cat_id                 = phpgw::get_var('cat_id', 
'int');
                        $district_id    = phpgw::get_var('district_id', 'int');
+                       $allrows        = phpgw::get_var('allrows', 'bool');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
-
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(!empty($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if(isset($district_id))
-                       {
-                               $this->district_id = $district_id;
-                       }
+                       $this->start                    = $start ? $start : 0;
+                       $this->query                    = isset($query) ? 
$query : $this->query;
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->filter                   = isset($filter) && 
$filter ? $filter : '';
+                       $this->district_id              = isset($district_id) 
&& $district_id ? $district_id : '';
+                       $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
+                       $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
                }
 
                function save_sessiondata($data)
@@ -198,14 +174,10 @@
                        return $persons;
                }
 
-
-
-
-
                function read_vendor()
                {
                        $vendor = $this->so->read_vendor(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id));
+                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id, 'allrows' => 
$this->allrows));
                        $this->total_records = $this->so->total_records;
 
                        return $vendor;
@@ -214,7 +186,7 @@
                function read_b_account()
                {
                        $b_account = $this->so->read_b_account(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id));
+                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id, 'allrows' => 
$this->allrows));
                        $this->total_records = $this->so->total_records;
 
                        return $b_account;
@@ -223,7 +195,7 @@
                function read_street()
                {
                        $street = $this->so->read_street(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id));
+                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id, 'allrows' => 
$this->allrows));
                        $this->total_records = $this->so->total_records;
 
                        return $street;
@@ -232,7 +204,7 @@
                function read_tenant()
                {
                        $tenant = $this->so->read_tenant(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id));
+                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id, 'allrows' => 
$this->allrows));
                        $this->total_records = $this->so->total_records;
 
                        return $tenant;
@@ -255,5 +227,27 @@
 
                        return $phpgw_user;
                }
+
+               function read_project_group()
+               {
+                       $project_group  = CreateObject('property.socategory');
+                       
$project_group->get_location_info('project_group',false);
+                       $values = $project_group->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'type' => 'project_group','allrows'=>$this->allrows));
+
+                       $this->total_records = $project_group->total_records;
+
+                       return $values;
        }
+               function read_ecodimb()
+               {
+                       $ecodimb        = CreateObject('property.socategory');
+                       $ecodimb->get_location_info('dimb',false);
+                       $values = $ecodimb->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'allrows'=>$this->allrows));
 
+                       $this->total_records = $ecodimb->total_records;
+
+                       return $values;
+               }
+       }

Modified: people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bomigrate.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -8,13 +8,13 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.uimigrate.inc.php 732 2008-02-10 16:21:14Z sigurd 
$
+       * @version $Id: class.bomigrate.inc.php 2588 2009-04-14 11:00:02Z 
sigurd $
        */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -78,8 +78,9 @@
                        return $domain_info;
                }
 
-               public function migrate($values,$download_script=true)
+               public function migrate($values,$download_script=false)
                {
+//_debug_array($GLOBALS['phpgw_domain']);die();
 //                     _debug_array($values);
                        $oProc                                                  
= 
createObject('phpgwapi.schema_proc',$GLOBALS['phpgw_info']['server']['db_type']);
                        $oProc->m_odb                                   = 
$GLOBALS['phpgw']->db;
@@ -88,15 +89,7 @@
 
                        $tables = $GLOBALS['phpgw']->db->table_names();
 
-                       /* Work out the order of how the tables can be created
-                       */
-                       foreach($tables as $tablename)
-                       {
-                               $ForeignKeys = 
$GLOBALS['phpgw']->db->MetaForeignKeys($tablename);
-                               foreach($ForeignKeys as $table => $keys)
-                               {
-                               }
-                       }
+//                     $tables = array('fm_entity_history');
 
                        $setup = createObject('phpgwapi.setup_process');
 
@@ -104,6 +97,8 @@
                        foreach($tables as $table)
                        {
                                $tableinfo = $setup->sql_to_array($table);
+//_debug_array($tableinfo);
+
                                $fd_temp = '$fd = array(' . 
str_replace("\t",'',$tableinfo[0]) .');';
                                @eval($fd_temp);
                                $table_def[$table]['fd'] = $fd;
@@ -111,16 +106,30 @@
                                $table_def[$table]['fk'] = $tableinfo[2];
                                $table_def[$table]['ix'] = $tableinfo[3];
                                $table_def[$table]['uc'] = $tableinfo[4];
+//_debug_array($table_def);
+//die();
+                               /* Work out the order of how the tables can be 
created
+                               */
+                               if($tableinfo[2])
+                               {
+                                       foreach ($tableinfo[2] as $ref_set => 
$ref_fields)
+                                       {
+                                               $fk_temp = '$fk = array(' . 
$ref_fields .');';
+                                               @eval($fk_temp);
+                                               $fk_table = array_keys($fk);
+                                               $ForeignKeys[$table][] = 
$fk_table[0];
+                                       }
+                               }
                        }
-//_debug_array($table_def);
-//_debug_array($tables);
 
+                       set_time_limit(0);
                        foreach ($values as $domain)
                        {
                                $this->oProc = 
createObject('phpgwapi.schema_proc',$GLOBALS['phpgw_domain'][$domain]['db_type']);
                                if(!$download_script)
                                {
-                                       $this->oProc->m_odb           = 
$GLOBALS['phpgw']->db;
+                                       $this->oProc->m_odb           = 
CreateObject('phpgwapi.db');//$GLOBALS['phpgw']->db;
+                                       $this->oProc->m_odb->Type     = 
$GLOBALS['phpgw_domain'][$domain]['db_type'];
                                        $this->oProc->m_odb->Host     = 
$GLOBALS['phpgw_domain'][$domain]['db_host'];
                                        $this->oProc->m_odb->Database = 
$GLOBALS['phpgw_domain'][$domain]['db_name'];
                                        $this->oProc->m_odb->User     = 
$GLOBALS['phpgw_domain'][$domain]['db_user'];
@@ -129,16 +138,87 @@
                                        $this->oProc->m_odb->connect();
                                }
 
-                               $filename = $domain . '_' . 
$GLOBALS['phpgw_domain'][$domain]['db_name'] . '_' . 
$GLOBALS['phpgw_domain'][$domain]['db_type'] . '.sql';
-
-                               $script = $this->GenerateScripts($table_def, 
false, true);
                                if($download_script)
                                {
+                                       $script = 
$this->GenerateScripts($table_def, false, true);
+                                       $filename = $domain . '_' . 
$GLOBALS['phpgw_domain'][$domain]['db_name'] . '_' . 
$GLOBALS['phpgw_domain'][$domain]['db_type'] . '.sql';
                                        $this->download_script($script, 
$filename);
                                }
+                               else
+                               {
+                                       
$this->oProc->ExecuteScripts($table_def, true);
+                                       $this->copy_data($table_def);
+                               }
                        }
                }
 
+               
+               function copy_data($table_def = array())
+               {
+                       $db = $GLOBALS['phpgw']->db;
+                       $db->fetchmode = 'ASSOC';
+                       foreach ($table_def as $table => $fd)
+                       {
+                               if($table=='fm_ecobilagoverf' || $table== 
'phpgw_lang')
+                               {
+                                       continue;
+                               }
+                               switch ($table)
+                               {
+                                       case 'fm_document_history':
+                                       case 'fm_entity_history':
+                                       case 'fm_request_history':
+                                       case 'fm_project_history':
+                                       case 'fm_tts_history':
+                                       case 'fm_s_agreement_history':
+                                       case 'fm_workorder_history':
+                                       case 'phpgw_history_log':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET history_new_value = 'NIL' 
WHERE history_new_value = ''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'fm_project':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET name = 'NIL' WHERE name = 
''", __LINE__ , __FILE__, true);
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET loc1 = '0000', location_code 
= '0000' WHERE loc1 = ''", __LINE__ , __FILE__, true);
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET status = 'closed' WHERE 
status = ''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'fm_workorder':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET title = 'NIL' WHERE title = 
''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'fm_ecodimd':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET descr = 'NIL' WHERE descr = 
''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'phpgw_categories':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET cat_description = 'NIL' WHERE 
cat_description = ''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'phpgw_contact_others':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET other_value = 'NIL' WHERE 
other_value = ''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'phpgw_contact_person':
+                                               
$GLOBALS['phpgw']->db->query("DELETE FROM {$table} WHERE first_name = ''", 
__LINE__ , __FILE__, true);
+                                               break;
+                                       case 'phpgw_log_msg':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET log_msg_parms = 'NIL' WHERE 
log_msg_parms = ''", __LINE__ , __FILE__, true);
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET log_msg_file = 'NIL' WHERE 
log_msg_file = ''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'phpgw_sms_tbluserphonebook':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET p_email = 'NIL' WHERE p_email 
= ''", __LINE__ , __FILE__, true);
+                                               break;
+                                       case 'phpgw_sms_tblsmsoutgoing':
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET p_footer = 'NIL' WHERE 
p_footer = ''", __LINE__ , __FILE__, true);
+                                               
$GLOBALS['phpgw']->db->query("UPDATE {$table} SET p_src = 'NIL' WHERE p_src = 
''", __LINE__ , __FILE__, true);
+                                               break;
+                                       default:
+                               }
+
+                               $db->query("SELECT * FROM {$table}");
+                               foreach($db->resultSet as $row)
+                               {
+                                       $insert_values = 
$db->validate_insert(array_values($row));
+                                       $insert_fields = implode(',', 
array_keys($row));
+                                       $this->oProc->m_odb->query("INSERT INTO 
{$table} ({$insert_fields}) VALUES ({$insert_values})");        
+                               }
+                       }
+               }
+
                private function download_script($script, $filename)
                {
                        $GLOBALS['phpgw_info']['flags']['noheader'] = true;

Modified: people/sigurdne/modules/property/trunk/inc/class.boproject.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boproject.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boproject.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -52,14 +52,13 @@
 
                function property_boproject($session=false)
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so                       = 
CreateObject('property.soproject');
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->solocation = CreateObject('property.solocation');
+                       $this->bocommon                         = & 
$this->so->bocommon;
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name           = 'property.project';
                        $this->cats->supress_info       = true;
-                       $this->interlink        = 
CreateObject('property.interlink');
+                       $this->interlink                        = & 
$this->so->interlink;
+                       $this->custom                           = & 
$this->so->custom;
 
                        if ($session)
                        {
@@ -74,45 +73,22 @@
                        $filter = phpgw::get_var('filter', 'int');
                        $cat_id = phpgw::get_var('cat_id', 'int');
                        $status_id      = phpgw::get_var('status_id');
+                       $user_id        = phpgw::get_var('user_id', 'int');
                        $wo_hour_cat_id = phpgw::get_var('wo_hour_cat_id', 
'int');
+                       $district_id    = phpgw::get_var('district_id', 'int');
+                       $criteria_id    = phpgw::get_var('criteria_id', 'int');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
-
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(isset($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if(isset($status_id))
-                       {
-                               $this->status_id = $status_id;
-                       }
-                       if(isset($wo_hour_cat_id))
-                       {
-                               $this->wo_hour_cat_id = $wo_hour_cat_id;
-                       }
+                       $this->start                    = $start ? $start : 0;
+                       $this->query                    = isset($query) ? 
$query : $this->query;
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->filter                   = isset($filter) && 
$filter ? $filter : '';
+                       $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
+                       $this->status_id                = isset($status_id) && 
$status_id ? $status_id : '';
+                       $this->user_id                  = isset($user_id) && 
$user_id ? $user_id : '';
+                       $this->wo_hour_cat_id   = isset($wo_hour_cat_id) && 
$wo_hour_cat_id ? $wo_hour_cat_id : '';
+                       $this->district_id              = isset($district_id) 
&& $district_id ? $district_id : '';
+                       $this->criteria_id              = isset($criteria_id) 
&& $criteria_id ? $criteria_id : '';
                }
 
                function save_sessiondata($data)
@@ -134,7 +110,10 @@
                        $this->order                    = 
isset($data['order'])?$data['order']:'';
                        $this->cat_id                   = 
isset($data['cat_id'])?$data['cat_id']:'';
                        $this->status_id                = 
isset($data['status_id'])?$data['status_id']:'';
+                       $this->user_id                  = 
isset($data['user_id'])?$data['user_id']:'';
                        $this->wo_hour_cat_id   = 
isset($data['wo_hour_cat_id'])?$data['wo_hour_cat_id']:'';
+                       $this->district_id              = 
isset($data['district_id'])?$data['district_id']:'';
+                       $this->criteria_id              = 
isset($data['criteria_id'])?$data['criteria_id']:'';
                }
 
                function select_status_list($format='',$selected='')
@@ -194,7 +173,94 @@
                        return $branch_list;
                }
 
+               function get_criteria_list($selected='')
+               {
+                       $criteria = array
+                       (
+                               array
+                               (
+                                       'id'    => '1',
+                                       'name'  => lang('project group')
+                               ),
+                               array
+                               (
+                                       'id'    => '2',
+                                       'name'  => lang('project id')
+                               ),
+                               array
+                               (
+                                       'id'    => '3',
+                                       'name'  => lang('address')
+                               ),
+                               array
+                               (
+                                       'id'    => '4',
+                                       'name'  => lang('location code')
+                               ),
+                               array
+                               (
+                                       'id'    => '5',
+                                       'name'  => lang('title')
+                               ),
+                       );
+                       return 
$this->bocommon->select_list($selected,$criteria);
+               }
 
+
+               function get_criteria($id='')
+               {
+                       $criteria = array();
+                       $criteria[1] = array
+                       (
+                               'field'         => 'project_group',
+                               'type'          => 'int',
+                               'matchtype' => 'exact',
+                               'front' => '',
+                               'back' => ''
+                       );
+                       $criteria[2] = array
+                       (
+                               'field'         => 'fm_project.id',
+                               'type'          => 'int',
+                               'matchtype' => 'exact',
+                               'front' => '',
+                               'back' => ''
+                       );
+                       $criteria[3] = array
+                       (
+                               'field' => 'fm_project.address',
+                               'type'  => 'varchar',
+                               'matchtype' => 'like',
+                               'front' => "'%",
+                               'back' => "%'",
+                       );
+                       $criteria[4] = array
+                       (
+                               'field' => 'fm_project.location_code',
+                               'type'  => 'varchar',
+                               'matchtype' => 'like',
+                               'front' => "'",
+                               'back' => "%'"
+                       );
+                       $criteria[5] = array
+                       (
+                               'field' => 'fm_project.name',
+                               'type'  => 'varchar',
+                               'matchtype' => 'like',
+                               'front' => "'%",
+                               'back' => "%'"
+                       );
+
+                       if($id)
+                       {
+                               return array($criteria[$id]);
+                       }
+                       else
+                       {
+                               return $criteria;
+                       }                       
+               }
+
                function select_key_location_list($selected='')
                {
 
@@ -203,51 +269,83 @@
                        return 
$this->bocommon->select_list($selected,$key_location_entries);
                }
 
-               function read($start_date='',$end_date='',$allrows='')
+               function read($data = array())
                {
-                       $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
-                       $end_date       = 
$this->bocommon->date_to_timestamp($end_date);
+                       $start_date     = 
$this->bocommon->date_to_timestamp($data['start_date']);
+                       $end_date       = 
$this->bocommon->date_to_timestamp($data['end_date']);
 
                        $project = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' => 
$this->status_id,'wo_hour_cat_id' => $this->wo_hour_cat_id,
-                                                                               
        'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows));
+                                                                               
        
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>isset($data['allrows'])
 ? $data['allrows'] : '','dry_run' => $data['dry_run'],
+                                                                               
        'district_id' => $this->district_id, 'criteria' => 
$this->get_criteria($this->criteria_id)));
                        $this->total_records = $this->so->total_records;
 
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 
                        $this->uicols   = $this->so->uicols;
-                       $this->uicols['input_type'][]   = 'link';
-                       $this->uicols['name'][]                 = 'ticket_id';
+                       if(!isset($data['skip_origin']) || 
!$data['skip_origin'])
+                       {
+                               $this->uicols['input_type'][]   = 'text';
+                               $this->uicols['name'][]                 = 
'ticket';
                        $this->uicols['descr'][]                = 
lang('ticket');
                        $this->uicols['statustext'][]   = false;
+                               $this->uicols['exchange'][]             = false;
+                               $this->uicols['align'][]                = '';
+                               $this->uicols['datatype'][]             = 
'link';
+                       }
 
 //                     $cols_extra             = $this->so->cols_extra;
 
                        foreach ($project as & $entry)
                        {
                                $entry['start_date'] = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$dateformat);
+                               if(!isset($data['skip_origin']) || 
!$data['skip_origin'])
+                               {
                                $origin = 
$this->interlink->get_relation('property', '.project', $entry['project_id'], 
'origin');
-                               if($origin[0]['location'] == '.ticket')
+                                       if(isset($origin[0]['location']) && 
$origin[0]['location'] == '.ticket')
                                {
-                                       $entry['ticket_id'] = 
$origin[0]['data'][0]['id'];
+                                               $entry['ticket'] = array
+                                                                               
(
+                                                                               
        'url'                   => $GLOBALS['phpgw']->link('/index.php', array
+                                                                               
                                                (
+                                                                               
                                                        'menuaction'    => 
'property.uitts.view',
+                                                                               
                                                        'id'                    
=> $origin[0]['data'][0]['id']
+                                                                               
                                                )
+                                                                               
                                        ),
+                                                                               
        'text'                  => $origin[0]['data'][0]['id'],
+                                                                               
        'statustext'    => $origin[0]['data'][0]['statustext'],                 
                                                                
+                                                                               
);
+                                       }
                                }
                        }
                        return $project;
                }
 
-               function read_single($project_id)
+               function read_single($project_id = 0, $values = array(), $view 
= false)
                {
                        $contacts               = 
CreateObject('property.soactor');
                        $contacts->role='vendor';
 
-                       $config                         = 
CreateObject('phpgwapi.config');
-                       $config->read_repository();
+                       $config                         = 
CreateObject('phpgwapi.config','property');
+                       $config->read();
                        $tax = 
1+(isset($config->config_data['fm_tax'])?$config->config_data['fm_tax']:0)/100;
 
-                       $project                                = 
$this->so->read_single($project_id);
+                       $values['attributes'] = $this->custom->find('property', 
'.project', 0, '', 'ASC', 'attrib_sort', true, true);
+                       if($project_id)
+                       {
+                               $values = $this->so->read_single($project_id, 
$values);
+                       }
+
+                       $values = $this->custom->prepare($values, 'property', 
'.project', $view);
+
+                       if(!$project_id)
+                       {
+                               return $values;
+                       }
+
                        $dateformat                             = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $project['start_date']                  = 
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
-                       $project['end_date']                    = 
isset($project['end_date']) && $project['end_date'] ? 
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat) : '';
+                       $values['start_date']                   = 
$GLOBALS['phpgw']->common->show_date($values['start_date'],$dateformat);
+                       $values['end_date']                     = 
isset($values['end_date']) && $values['end_date'] ? 
$GLOBALS['phpgw']->common->show_date($values['end_date'],$dateformat) : '';
                        $workorder_data                         = 
$this->so->project_workorder_data($project_id);
 
                        $sum_workorder_budget = 0;
@@ -255,7 +353,6 @@
                        $sum_workorder_calculation = 0;
                        $sum_workorder_actual_cost = 0;
 
-                       $custom                 = 
createObject('property.custom_fields');
                        for ($i=0;$i<count($workorder_data);$i++)
                        {
                                $sum_workorder_budget= 
$sum_workorder_budget+$workorder_data[$i]['budget'];
@@ -263,22 +360,23 @@
                                $sum_workorder_calculation= 
$sum_workorder_calculation+$workorder_data[$i]['calculation'];
                                $sum_workorder_actual_cost= 
$sum_workorder_actual_cost+$workorder_data[$i]['act_mtrl_cost']+$workorder_data[$i]['act_vendor_cost'];
 
-                               
$project['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
-                               
$project['workorder_budget'][$i]['budget']=number_format($workorder_data[$i]['budget'],
 2, ',', '');
-                               
$project['workorder_budget'][$i]['calculation']=number_format($workorder_data[$i]['calculation']*$tax,
 2, ',', '');
-                               
$project['workorder_budget'][$i]['charge_tenant'] = 
$workorder_data[$i]['charge_tenant'];
-                               $project['workorder_budget'][$i]['status'] = 
$workorder_data[$i]['status'];
+                               
$values['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
+                               
$values['workorder_budget'][$i]['budget']=number_format($workorder_data[$i]['budget'],
 2, ',', '');
+                               
$values['workorder_budget'][$i]['calculation']=number_format($workorder_data[$i]['calculation']*$tax,
 2, ',', '');
+                               
$values['workorder_budget'][$i]['charge_tenant'] = 
$workorder_data[$i]['charge_tenant'];
+                               $values['workorder_budget'][$i]['status'] = 
$workorder_data[$i]['status'];
+                               $values['workorder_budget'][$i]['actual_cost'] 
= $workorder_data[$i]['act_mtrl_cost']+$workorder_data[$i]['act_vendor_cost'];
 
                                if(isset($workorder_data[$i]['vendor_id']) && 
$workorder_data[$i]['vendor_id'])
                                {
-                                       $vendor['attributes'] = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
+                                       $vendor['attributes'] = 
$this->custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, 
true);
 
                                        $vendor = 
$contacts->read_single($workorder_data[$i]['vendor_id'], $vendor);
                                        foreach($vendor['attributes'] as 
$attribute)
                                        {
                                                
if($attribute['name']=='org_name')
                                                {
-                                                       
$project['workorder_budget'][$i]['vendor_name']=$attribute['value'];
+                                                       
$values['workorder_budget'][$i]['vendor_name']=$attribute['value'];
                                                        break;
                                                }
                                        }
@@ -286,49 +384,49 @@
                        }
                        if($workorder_data)
                        {
-                               $project['sum_workorder_budget']= 
number_format($sum_workorder_budget, 2, ',', '');
-                               $project['deviation']= $sum_deviation;
-                               $project['sum_workorder_calculation']= 
number_format($sum_workorder_calculation*$tax, 2, ',', '');
-                               $project['sum_workorder_actual_cost']= 
number_format($sum_workorder_actual_cost, 2, ',', '');
+                               $values['sum_workorder_budget']= 
number_format($sum_workorder_budget, 2, ',', '');
+                               $values['deviation']= $sum_deviation;
+                               $values['sum_workorder_calculation']= 
number_format($sum_workorder_calculation*$tax, 2, ',', '');
+                               $values['sum_workorder_actual_cost']= 
number_format($sum_workorder_actual_cost, 2, ',', '');
                        }
 
-                       if($project['location_code'])
+                       if($values['location_code'])
                        {
-                               $project['location_data'] 
=$this->solocation->read_single($project['location_code']);
+                               $values['location_data'] = 
execMethod('property.solocation.read_single', $values['location_code']);
                        }
 
-                       if($project['tenant_id']>0)
+                       if($values['tenant_id']>0)
                        {
-                               
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
-                               $project['location_data']['tenant_id']= 
$project['tenant_id'];
-                               $project['location_data']['contact_phone']= 
$tenant_data['contact_phone'];
-                               $project['location_data']['last_name']  = 
$tenant_data['last_name'];
-                               $project['location_data']['first_name'] = 
$tenant_data['first_name'];
+                               
$tenant_data=$this->bocommon->read_single_tenant($values['tenant_id']);
+                               $values['location_data']['tenant_id']= 
$values['tenant_id'];
+                               $values['location_data']['contact_phone']= 
$tenant_data['contact_phone'];
+                               $values['location_data']['last_name']   = 
$tenant_data['last_name'];
+                               $values['location_data']['first_name']  = 
$tenant_data['first_name'];
                        }
                        else
                        {
-                               unset($project['location_data']['tenant_id']);
-                               
unset($project['location_data']['contact_phone']);
-                               unset($project['location_data']['last_name']);
-                               unset($project['location_data']['first_name']);
+                               unset($values['location_data']['tenant_id']);
+                               
unset($values['location_data']['contact_phone']);
+                               unset($values['location_data']['last_name']);
+                               unset($values['location_data']['first_name']);
                        }
 
-                       if($project['p_num'])
+                       if($values['p_num'])
                        {
                                $soadmin_entity = 
CreateObject('property.soadmin_entity');
-                               $category = 
$soadmin_entity->read_single_category($project['p_entity_id'],$project['p_cat_id']);
+                               $category = 
$soadmin_entity->read_single_category($values['p_entity_id'],$values['p_cat_id']);
 
-                               
$project['p'][$project['p_entity_id']]['p_num']=$project['p_num'];
-                               
$project['p'][$project['p_entity_id']]['p_entity_id']=$project['p_entity_id'];
-                               
$project['p'][$project['p_entity_id']]['p_cat_id']=$project['p_cat_id'];
-                               
$project['p'][$project['p_entity_id']]['p_cat_name'] = $category['name'];
+                               
$values['p'][$values['p_entity_id']]['p_num']=$values['p_num'];
+                               
$values['p'][$values['p_entity_id']]['p_entity_id']=$values['p_entity_id'];
+                               
$values['p'][$values['p_entity_id']]['p_cat_id']=$values['p_cat_id'];
+                               
$values['p'][$values['p_entity_id']]['p_cat_name'] = $category['name'];
                        }
 
-                       $project['origin'] = 
$this->interlink->get_relation('property', '.project', $project_id, 'origin');
-                       $project['target'] = 
$this->interlink->get_relation('property', '.project', $project_id, 'target');
+                       $values['origin'] = 
$this->interlink->get_relation('property', '.project', $project_id, 'origin');
+                       $values['target'] = 
$this->interlink->get_relation('property', '.project', $project_id, 'target');
 
-//_debug_array($project);
-                       return $project;
+//_debug_array($values);
+                       return $values;
                }
 
                function read_single_mini($project_id)
@@ -340,7 +438,7 @@
 
                        if($project['location_code'])
                        {
-                               $project['location_data'] 
=$this->solocation->read_single($project['location_code']);
+                               $project['location_data'] = 
execMethod('property.solocation.read_single', $project['location_code']);
                        }
 
                        if($project['tenant_id']>0)
@@ -369,7 +467,7 @@
                        $historylog     = 
CreateObject('property.historylog','project');
                        $history_array = 
$historylog->return_array(array('O'),array(),'','',$id);
                        $i=0;
-                       while (is_array($history_array) && list(,$value) = 
each($history_array))
+                       foreach ($history_array as $value) 
                        {
 
                                $record_history[$i]['value_date']       = 
$GLOBALS['phpgw']->common->show_date($value['datetime']);
@@ -377,6 +475,8 @@
 
                                switch ($value['status'])
                                {
+                                       case 'B': $type = lang('Budget'); break;
+                                       case 'BR': $type = lang('reserve'); 
break;
                                        case 'R': $type = lang('Re-opened'); 
break;
                                        case 'RM': $type = lang('remark'); 
break;
                                        case 'X': $type = lang('Closed');    
break;
@@ -410,19 +510,46 @@
                                        {
                                                
$record_history[$i]['value_new_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
                                        }
+                                       if (! $value['old_value'])
+                                       {
+                                               
$record_history[$i]['value_old_value']  = '';
+                                       }
+                                       else
+                                       {
+                                               
$record_history[$i]['value_old_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['old_value']);
+                                       }
                                }
                                else if ($value['status'] == 'C' || 
$value['status'] == 'CO')
                                {
                                        $record_history[$i]['value_new_value']  
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+                                       if (! $value['old_value'])
+                                       {
+                                               
$record_history[$i]['value_old_value']  = '';
+                                       }
+                                       else
+                                       {
+                                               
$record_history[$i]['value_old_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['old_value']);
+                                       }
                                }
                                else if ($value['status'] == 'T' || 
$value['status'] == 'TO')
                                {
                                        $category                               
                                = 
$this->cats->return_single($value['new_value']);
                                        $record_history[$i]['value_new_value']  
= $category[0]['name'];
+                                       if($value['old_value'])
+                                       {
+                                               $category                       
                                        = 
$this->cats->return_single($value['old_value']);
+                                               
$record_history[$i]['value_old_value']  = $category[0]['name'];
+                                       }
                                }
+                               else if ($value['status'] == 'B' || 
$value['status'] == 'BR')
+                               {
+                                       $record_history[$i]['value_new_value']  
=number_format($value['new_value'], 0, ',', ' ');
+                                       $record_history[$i]['value_old_value']  
=number_format($value['old_value'], 0, ',', ' ');
+                               }
                                else if ($value['status'] != 'O' && 
$value['new_value'])
                                {
                                        $record_history[$i]['value_new_value']  
= $value['new_value'];
+                                       $record_history[$i]['value_old_value']  
= $value['old_value'];
                                }
                                else
                                {
@@ -441,7 +568,7 @@
                        return $this->so->next_project_id();
                }
 
-               function save($project,$action='')
+               function save($project,$action='',$values_attribute = array())
                {
 
 //_debug_array($project);
@@ -461,14 +588,18 @@
                        $project['start_date']  = mktime 
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
                        $project['end_date']    = $end_date ? mktime 
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']) : '';
 
+                       if(is_array($values_attribute))
+                       {
+                               $values_attribute = 
$this->custom->convert_attribute_save($values_attribute);
+                       }
 
                        if ($action=='edit')
                        {
-                                       $receipt = $this->so->edit($project);
+                                       $receipt = $this->so->edit($project, 
$values_attribute);
                        }
                        else
                        {
-                               $receipt = $this->so->add($project);
+                               $receipt = $this->so->add($project, 
$values_attribute);
                        }
                        return $receipt;
                }

Modified: people/sigurdne/modules/property/trunk/inc/class.bor_agreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bor_agreement.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bor_agreement.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -266,7 +266,7 @@
                function read_event($data)
                {
                        $boalarm                = 
CreateObject('property.boalarm');
-                       $event  = $this->so->read_single($data);
+                       $event  = 
$this->so->read_single($data['r_agreement_id']);
                        $event['alarm_date']=$event['termination_date'];
                        $event['alarm'] = 
$boalarm->read_alarms($type='r_agreement',$data['r_agreement_id']);
                        return $event;
@@ -338,6 +338,20 @@
                        return $values;
                }
 
+               /**
+               * Arrange attributes within groups
+               *
+               * @param string  $location    the name of the location of the 
attribute
+               * @param array   $attributes  the array of the attributes to be 
grouped
+               *
+               * @return array the grouped attributes
+               */
+
+               public function get_attribute_groups($location, $attributes = 
array())
+               {
+                       return $this->custom->get_attribute_groups('property', 
$location, $attributes);
+               }
+
                function save($values,$values_attribute='',$action='')
                {
 
@@ -463,7 +477,8 @@
                        {
                                
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property']['r_agreement_columns'];
                        }
-                       $columns = 
$this->custom->find('property','.r_agreement', 0, '','','',true);
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = 
$this->custom->find('property','.r_agreement', 0, '','','',true, false, 
$filter);
                        
$column_list=$this->bocommon->select_multi_list($selected,$columns);
                        return $column_list;
                }

Modified: people/sigurdne/modules/property/trunk/inc/class.borequest.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.borequest.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.borequest.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -267,7 +267,8 @@
                {
                        $request = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' => 
$this->status_id,
-                                                                               
        'project_id' => 
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' => 
$data['list_descr']));
+                                                                               
        'project_id' => 
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' => 
$data['list_descr'],
+                                                                               
        'dry_run'=>$data['dry_run']));
                        $this->total_records = $this->so->total_records;
 
                        $this->uicols   = $this->so->uicols;
@@ -279,13 +280,15 @@
                        {
                                $request[$i]['coordinator'] = 
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
                                $request[$i]['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($request[$i]['entry_date'],$dateformat);
+                               if($cols_extra)
+                               {
                                
$location_data=$this->solocation->read_single($request[$i]['location_code']);
-
                                for ($j=0;$j<count($cols_extra);$j++)
                                {
                                        $request[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
                                }
                        }
+                       }
 
                        return $request;
                }

Modified: people/sigurdne/modules/property/trunk/inc/class.boresponsible.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boresponsible.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boresponsible.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -9,13 +9,13 @@
        * @package phpgroupware
        * @subpackage property
        * @category core
-       * @version $Id: class.uiresponsible.inc.php 732 2008-02-10 16:21:14Z 
sigurd $
+       * @version $Id: class.boresponsible.inc.php 3779 2009-09-30 19:30:32Z 
sigurd $
        */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -92,9 +92,17 @@
                                $this->cat_id = phpgw::get_var('cat_id');
                        }
 
+                       switch ($this->location)
+                       {
+                               case '.project.workorder':
+                                       $cats_app_name = 'property.project';
+                                       break;
+                                       default:
+                                       $cats_app_name = 
"property{$this->location}";
+                       }
 
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
-                       $this->cats->app_name           = 
"property{$this->location}";
+                       $this->cats->app_name           = $cats_app_name;
                        $this->dateformat                       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                }
 
@@ -167,6 +175,8 @@
                                                                                
                'filter' => $filter));
                        $this->total_records = $this->so->total_records;
                        
+                       if($value['cat_id'])
+                       {
                        foreach($values as & $value)
                        {
                                $category = 
$this->cats->return_single($value['cat_id']);
@@ -174,7 +184,7 @@
                                $value['app_name']              = 
$category[0]['app_name'];
                                $value['created_by']    = 
$GLOBALS['phpgw']->accounts->id2name($value['created_by']);
                                $value['created_on']    = 
$GLOBALS['phpgw']->common->show_date($value['created_on'], $this->dateformat);
-                       
+                               }
                        }
 
                        return $values;

Modified: people/sigurdne/modules/property/trunk/inc/class.bos_agreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bos_agreement.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bos_agreement.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -42,6 +42,7 @@
                var $cat_id;
                var $role;
                var $member_id;
+               var $uicols = array();
 
                /**
                * @var object $custom reference to custom fields object
@@ -62,6 +63,9 @@
                        $this->so = CreateObject('property.sos_agreement');
                        $this->bocommon = CreateObject('property.bocommon');
                        $this->custom           = 
createObject('property.custom_fields');
+                       $this->cats                                     = 
CreateObject('phpgwapi.categories');
+                       $this->cats->app_name           = 'fm_vendor';
+                       $this->cats->supress_info       = true;
 
                        if ($session)
                        {
@@ -84,51 +88,15 @@
                        $this->role     = $role;
                        $this->so->role = $role;
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
-
-                       if(isset($query))
-                       {
-                               $this->query = $query;
-                       }
-                       if(!empty($filter))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if(isset($cat_id) && !empty($cat_id))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       else
-                       {
-                               $this->cat_id = '';
-                       }
-                       if(isset($allrows))
-                       {
-                               $this->allrows = $allrows;
-                       }
-                       if(isset($member_id))
-                       {
-                               $this->member_id = $member_id;
-                       }
-                       if(isset($vendor_id))
-                       {
-                               $this->vendor_id = $vendor_id;
-                       }
+                       $this->start                    = $start ? $start : 0;
+                       $this->query                    = isset($query) ? 
$query : $this->query;
+                       $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
+                       $this->order                    = isset($order) && 
$order ? $order : '';
+                       $this->filter                   = isset($filter) && 
$filter ? $filter : '';
+                       $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
+                       $this->member_id                = isset($member_id) && 
$member_id ? $member_id : '';
+                       $this->vendor_id                = isset($vendor_id) && 
$vendor_id ? $vendor_id : '';
+                       $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';
                }
 
                function save_sessiondata($data)
@@ -237,8 +205,8 @@
                function read_event($data)
                {
                        $boalarm                = 
CreateObject('property.boalarm');
-                       $event  = $this->so->read_single($data);
-                       $event['alarm_date']=$event['termination_date'];
+                       $event                          = 
$this->so->read_single($data['s_agreement_id']);
+                       $event['alarm_date']= $event['termination_date'];
                        $event['alarm'] = 
$boalarm->read_alarms($type='s_agreement',$data['s_agreement_id']);
                        return $event;
                }
@@ -311,6 +279,20 @@
                        return $values;
                }
 
+               /**
+               * Arrange attributes within groups
+               *
+               * @param string  $location    the name of the location of the 
attribute
+               * @param array   $attributes  the array of the attributes to be 
grouped
+               *
+               * @return array the grouped attributes
+               */
+
+               public function get_attribute_groups($location, $attributes = 
array())
+               {
+                       return $this->custom->get_attribute_groups('property', 
$location, $attributes);
+               }
+
                function save($values,$values_attribute='',$action='')
                {
 
@@ -428,7 +410,8 @@
                                
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property']['s_agreement_columns'];
                        }
 
-                       $columns = 
$this->custom->find('property','.s_agreement', 0, '','','',true);
+                       $filter = array('list' => ''); // translates to "list 
IS NULL"
+                       $columns = 
$this->custom->find('property','.s_agreement', 0, '','','',true, false, 
$filter);
 
                        
$column_list=$this->bocommon->select_multi_list($selected,$columns);
 
@@ -455,5 +438,59 @@
                        $historylog = 
CreateObject('property.historylog','s_agreement');
                        $historylog->delete_single_record($data['history_id']);
                }
+
+               function get_year_list($agreement_id = '')
+               {
+                       if($agreement_id)
+                       {
+                               $list = 
$this->so->get_year_filter_list($agreement_id);
+                       }
+                       else
+                       {
+                               $list = array();
+                       }
+                       $year = date('Y');
+                       $limit = $year + 4;
+                       
+                       while ($year < $limit)
+                       {
+                               $list[] =  $year;
+                               $year++;
+                       }
+
+                       $list = array_unique($list);
+                       sort($list);
+                       
+                       $values;
+                       foreach($list as $entry)
+                       {
+                               $values[] = array
+                               (
+                                       'id'    => $entry,
+                                       'name'  => $entry
+                               );
+                       }
+                       return $values;
+               }
+
+               function get_budget($agreement_id)
+               {
+                       $values = $this->so->get_budget($agreement_id);
+
+                       $this->cats->app_name           = 'property.project';
+                       foreach($values as & $entry)
+                       {
+                               $category = 
$this->cats->return_single($entry['cat_id']);
+                               $entry['category']              = 
$category[0]['name'];
+                       }
+                       $this->cats->app_name           = 'fm_vendor';  
+                       return $values;         
+               }
+
+               function delete_year_from_budget($data,$agreement_id)
+               {
+                       return 
$this->so->delete_year_from_budget($data,$agreement_id);
+               }
+
        }
 

Modified: 
people/sigurdne/modules/property/trunk/inc/class.botenant_claim.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.botenant_claim.inc.php     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.botenant_claim.inc.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -63,6 +63,8 @@
                        $status = phpgw::get_var('status');
                        $cat_id = phpgw::get_var('cat_id', 'int');
                        $allrows= phpgw::get_var('allrows', 'bool');
+                       $project_id     = phpgw::get_var('project_id', 'int');
+                       $this->project_id = $project_id;
 
                        if ($start)
                        {
@@ -147,17 +149,19 @@
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('status_' . 
$format));
 
-                       $status[0][id]='closed';
-                       $status[0][name]=lang('Closed');
+                       $status[0][id]='ready';
+                       $status[0][name]=lang('ready for processing claim');
+                       $status[1][id]='closed';
+                       $status[1][name]=lang('Closed');
                        if($format == "filter")
                        {
-                               $status[1][id]='all';
-                               $status[1][name]=lang('All');
+                               $status[2][id]='all';
+                               $status[2][name]=lang('All');
                        }
                        else
                        {
-                               $status[1][id]='open';
-                               $status[1][name]=lang('Open');
+                               $status[2][id]='open';
+                               $status[2][name]=lang('Open');
                        }
 
                        return $this->bocommon->select_list($selected,$status);
@@ -168,16 +172,19 @@
                        return $this->so->read_category_name($cat_id);
                }
 
-               function read($data=0)
+               function read($data = array())
                {
+                       $project_id     = isset($data['project_id']) && 
$data['project_id'] ? $data['project_id'] : phpgw::get_var('project_id');
+
                        $claim = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'status' => $this->status,'cat_id' => 
$this->cat_id,
-                                                                               
        'allrows'=>$this->allrows,'project_id' => $data['project_id']));
+                                                                               
        'allrows'=>$this->allrows,'project_id' => $project_id));
                        $this->total_records = $this->so->total_records;
 
-                       for ($i=0; $i<count($claim); $i++)
+                       foreach ($claim as &$entry)
                        {
-                               $claim[$i]['entry_date']  = 
$GLOBALS['phpgw']->common->show_date($claim[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $entry['entry_date']  = 
$GLOBALS['phpgw']->common->show_date($entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $entry['status'] = lang($entry['status']);
                        }
                        return $claim;
                }
@@ -221,7 +228,7 @@
 
 
                        $this->config = 
CreateObject('phpgwapi.config','property');
-                       $this->config->read_repository();
+                       $this->config->read();
                        $claim_notify_mails = 
$this->config->config_data['tenant_claim_notify_mails'];
                        if ($claim_notify_mails)
                        {

Modified: people/sigurdne/modules/property/trunk/inc/class.botts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.botts.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.botts.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -41,6 +41,10 @@
                var $order;
                var $cat_id;
                var $acl_location;
+               var $uicols_related = array();
+               var $start_date;
+               var $end_date;
+               var $fields_updated = false;
 
                var $public_functions = array
                (
@@ -73,15 +77,17 @@
                function property_botts($session=false)
                {
                        $this->so                       = 
CreateObject('property.sotts');
-                       $this->bocommon         = & $this->so->bocommon;
+                       $this->bocommon                         = 
CreateObject('property.bocommon');
                        $this->historylog       = & $this->so->historylog;
-                       $this->config           = 
CreateObject('phpgwapi.config');
-                       $this->config->read_repository();
+                       $this->config                           = 
CreateObject('phpgwapi.config','property');
                        $this->dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name           = 'property.ticket';
                        $this->cats->supress_info       = true;
+                       $this->acl_location                     = 
$this->so->acl_location;
 
+                       $this->config->read();
+
                        if ($session)
                        {
                                $this->read_sessiondata();
@@ -92,63 +98,27 @@
                        $query  = phpgw::get_var('query');
                        $sort   = phpgw::get_var('sort');
                        $order  = phpgw::get_var('order');
-                       $filter = phpgw::get_var('filter');
-                       $user_filter    = phpgw::get_var('user_filter');
+                       $status_id                              = 
phpgw::get_var('status_id', 'string');
+                       $user_id                                = 
phpgw::get_var('user_id', 'int');
                        $cat_id = phpgw::get_var('cat_id', 'int');
+                       $part_of_town_id                = 
phpgw::get_var('part_of_town_id', 'int');
                        $district_id    = phpgw::get_var('district_id', 'int');
                        $allrows        = phpgw::get_var('allrows', 'bool');
-                       $start_date     = phpgw::get_var('start_date');
-                       $end_date       = phpgw::get_var('end_date');
+                       $start_date                             = 
phpgw::get_var('start_date', 'string');
+                       $end_date                               = 
phpgw::get_var('end_date', 'string');
 
-                       if ($start)
-                       {
-                               $this->start=$start;
-                       }
-                       else
-                       {
-                               $this->start=0;
-                       }
-
-                       if(array_key_exists('query',$_POST) || 
array_key_exists('query',$_GET))
-                       {
-                               $this->query = $query;
-                       }
-                       if(array_key_exists('filter',$_POST))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if(array_key_exists('user_filter',$_POST))
-                       {
-                               $this->user_filter = $user_filter;
-                       }
-                       if(array_key_exists('sort',$_POST) || 
array_key_exists('sort',$_GET))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if(array_key_exists('order',$_POST) || 
array_key_exists('order',$_GET))
-                       {
-                               $this->order = $order;
-                       }
-                       if(array_key_exists('cat_id',$_POST))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if(array_key_exists('district_id',$_POST))
-                       {
-                               $this->district_id = $district_id;
-                       }
-                       if(array_key_exists('allrows',$_POST) || 
array_key_exists('allrows',$_GET))
-                       {
-                               $this->allrows = $allrows;
-                       }
-                       if(array_key_exists('start_date',$_POST))
-                       {
-                               $this->start_date = $start_date;
-                       }
-                       if(array_key_exists('end_date',$_POST))
-                       {
-                               $this->end_date = $end_date;
-                       }
+                       $this->start                    = $start                
                                        ? $start                        : 0;
+                       $this->query                    = 
isset($_REQUEST['query'])             ? $query                        : 
$this->query;
+                       $this->sort                             = 
isset($_REQUEST['sort'])                      ? $sort                         : 
$this->sort;
+                       $this->order                    = 
isset($_REQUEST['order'])             ? $order                        : 
$this->order;
+                       $this->cat_id                   = 
isset($_REQUEST['cat_id'])            ? $cat_id                       :  
$this->cat_id;
+                       $this->status_id                = 
isset($_REQUEST['status_id'])         ? $status_id            : 
$this->status_id;
+                       $this->user_id                  = 
isset($_REQUEST['user_id'])           ? $user_id                      : 
$this->user_id;;
+                       $this->part_of_town_id  = 
isset($_REQUEST['part_of_town_id'])? $part_of_town_id : $this->part_of_town_id;
+                       $this->district_id              = 
isset($_REQUEST['district_id'])       ? $district_id          : 
$this->district_id;
+                       $this->allrows                  = isset($allrows) && 
$allrows           ? $allrows                      : '';
+                       $this->start_date               = 
isset($_REQUEST['start_date'])        ? $start_date           : 
$this->start_date;
+                       $this->end_date                 = 
isset($_REQUEST['end_date'])          ? $end_date                     : 
$this->end_date;
                }
 
 
@@ -166,10 +136,10 @@
 
                        $this->start            = 
isset($data['start'])?$data['start']:'';
                        $this->query            = 
isset($data['query'])?$data['query']:'';
-                       $this->filter           = 
isset($data['filter'])?$data['filter']:'';
-                       $this->user_filter      = 
isset($data['user_filter'])?$data['user_filter']:'';
+                       $this->user_id          = 
isset($data['user_id'])?$data['user_id']:'';
                        $this->sort                     = 
isset($data['sort'])?$data['sort']:'';
                        $this->order            = 
isset($data['order'])?$data['order']:'';
+                       $this->status_id        = 
isset($data['status_id'])?$data['status_id']:'';
                        $this->cat_id           = 
isset($data['cat_id'])?$data['cat_id']:'';
                        $this->district_id      = 
isset($data['district_id'])?$data['district_id']:'';
                        $this->allrows          = 
isset($data['allrows'])?$data['allrows']:'';
@@ -239,21 +209,22 @@
                        return $status;
                }
 
-               function _get_status_text()
+               function get_status_text()
                {
                        $status_text = array(
-                               'R' => 'Re-opened',
-                               'X' => 'Closed',
-                               'O' => 'Opened',
-                               'A' => 'Re-assigned',
-                               'G' => 'Re-assigned group',
-                               'P' => 'Priority changed',
-                               'T' => 'Category changed',
-                               'S' => 'Subject changed',
-                               'B' => 'Billing rate',
-                               'H' => 'Billing hours',
-                               'F' => 'finnish date',
-                               'SC' => 'Status changed'
+                               'R' => lang('Re-opened'),
+                               'X' => lang('Closed'),
+                               'O' => lang('Opened'),
+                               'A' => lang('Re-assigned'),
+                               'G' => lang('Re-assigned group'),
+                               'P' => lang('Priority changed'),
+                               'T' => lang('Category changed'),
+                               'S' => lang('Subject changed'),
+                               'B' => lang('Billing rate'),
+                               'H' => lang('Billing hours'),
+                               'F' => lang('finnish date'),
+                               'SC' => lang('Status changed'),
+                               'M' => lang('Sendt by email to')
                        );
 
                        $custom_status  = $this->so->get_custom_status();
@@ -268,17 +239,20 @@
 
                function get_priority_list($selected='')
                {
-                       if(!$selected && 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['prioritydefault']))
+
+                       $prioritylevels = 
isset($this->config->config_data['prioritylevels']) && 
$this->config->config_data['prioritylevels'] ? 
$this->config->config_data['prioritylevels'] : 3;
+
+                       if(!$selected)
                        {
-                               $selected = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['prioritydefault'];
+                               $selected = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['prioritydefault'])
 ? $GLOBALS['phpgw_info']['user']['preferences']['property']['prioritydefault'] 
: $prioritylevels;
                        }
 
-                       $priority_comment[1]=' - '.lang('Lowest');
-                       $priority_comment[5]=' - '.lang('Medium');
-                       $priority_comment[10]=' - '.lang('Highest');
+                       $priority_comment[$prioritylevels]=' - '.lang('Lowest');
+//                     $priority_comment[2]=' - '.lang('Medium');
+                       $priority_comment[1]=' - '.lang('Highest');
 
                        $priorities = array();
-                       for ($i=1; $i<=10; $i++)
+                       for ($i=1; $i<= $prioritylevels; $i++)
                        {
                                $priorities[$i]['id'] =$i;
                                $priorities[$i]['name'] =$i . 
(isset($priority_comment[$i])?$priority_comment[$i]:'');
@@ -294,51 +268,93 @@
                }
 
 
-               function read($start_date='',$end_date='', $external='')
+               function get_origin_entity_type()
                {
+                       $related = $this->so->get_origin_entity_type();
+                       $this->uicols_related = $this->so->uicols_related;
+                       return $related;
+               }
+
+               function read($start_date='',$end_date='', 
$external='',$dry_run = '', $download = '')
+               {
+                       $category_name = array();
+                       $account = array();
+                       
                        $interlink      = CreateObject('property.interlink');
                        $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
                        $end_date       = 
$this->bocommon->date_to_timestamp($end_date);
 
                        $tickets = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' => 
$this->district_id,
+                                                                               
        'status_id' => $this->status_id,'cat_id' => $this->cat_id,'district_id' 
=> $this->district_id,
                                                                                
        'start_date'=>$start_date,'end_date'=>$end_date,
-                                                                               
        'allrows'=>$this->allrows,'user_filter' => 
$this->user_filter,'external'=>$external));
+                                                                               
        'allrows'=>$this->allrows,'user_id' => 
$this->user_id,'external'=>$external, 'dry_run' => $dry_run));
                        $this->total_records = $this->so->total_records;
                        if(!$external)
                        {
-                               $entity = $this->so->get_origin_entity_type();
-                               $this->uicols=$this->so->uicols;
+                               $entity = $this->get_origin_entity_type();
+//                             $this->uicols_related = 
$this->so->uicols_related;
                        }
                        else
                        {
                                $entity[0]['type']='.project';
-                               $this->uicols[] = lang('project');
+                               $this->uicols_related   = array('project');
                        }
 
                        foreach ($tickets as & $ticket)
                        {
                                if(!$ticket['subject'])
                                {
+                                       
if(!isset($category_name[$ticket['cat_id']]))
+                                       {
                                        $ticket['subject']= 
$this->get_category_name($ticket['cat_id']);
+                                               
$category_name[$ticket['cat_id']] = $ticket['subject'];
+                                       }
+                                       else
+                                       {
+                                               $ticket['subject'] = 
$category_name[$ticket['cat_id']];
+                                       }
                                }
 
+                               if(!isset($account[$ticket['user_id']]))
+                               {
                                $ticket['user'] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
+                                       $account[$ticket['user_id']] = 
$ticket['user'];
+                               }
+                               else
+                               {
+                                       $ticket['user'] = 
$account[$ticket['user_id']];
+                               }
 
                                if($ticket['assignedto'])
                                {
+                                       
if(!isset($account[$ticket['assignedto']]))
+                                       {
                                        $ticket['assignedto'] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
+                                               $account[$ticket['assignedto']] 
= $ticket['assignedto'];
                                }
                                else
                                {
+                                               $ticket['assignedto'] = 
$account[$ticket['assignedto']];
+                                       }
+                               }
+                               else
+                               {
+                                       
if(!isset($account[$ticket['group_id']]))
+                                       {
                                        $ticket['assignedto'] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
+                                               $account[$ticket['group_id']] = 
$ticket['assignedto'];
+                                       }
+                                       else
+                                       {
+                                                $ticket['assignedto'] = 
$account[$ticket['group_id']];
+                                       }
                                }
 
-                               $ticket['timestampopened'] = 
$GLOBALS['phpgw']->common->show_date($ticket['entry_date'],$this->dateformat);
+                               $ticket['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($ticket['entry_date'],$this->dateformat);
 
                                if($ticket['finnish_date2'])
                                {
-                                       
$ticket['delay']=($ticket['finnish_date2']-$ticket['finnish_date'])/(24*3600);
+                                       $ticket['delay'] = 
round(($ticket['finnish_date2']-$ticket['finnish_date'])/(24*3600));
                                        
$ticket['finnish_date']=$ticket['finnish_date2'];
                                }
                                $ticket['finnish_date'] = 
(isset($ticket['finnish_date']) && $ticket['finnish_date'] ? 
$GLOBALS['phpgw']->common->show_date($ticket['finnish_date'],$this->dateformat):'');
@@ -348,9 +364,9 @@
                                        $history_values = 
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$ticket['id']);
                                        $ticket['timestampclosed'] = 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
                                }
-                               if (isset($ticket['new_ticket']))
+                               if ($ticket['new_ticket'])
                                {
-                                       $ticket['new_ticket'] = lang('New');
+                                       $ticket['new_ticket'] = '*';
                                }
 
                                if(isset($entity) && is_array($entity))
@@ -358,10 +374,14 @@
                                        for ($j=0;$j<count($entity);$j++)
                                        {
                                                $ticket['child_date'][$j] = 
$interlink->get_child_date('property', '.ticket', $entity[$j]['type'], 
$ticket['id'], 
isset($entity[$j]['entity_id'])?$entity[$j]['entity_id']:'',isset($entity[$j]['cat_id'])?$entity[$j]['cat_id']:'');
+                                               
if($ticket['child_date'][$j]['date_info'] && !$download)
+                                               {
+                                                       
$ticket['child_date'][$j]['statustext'] = 
$interlink->get_relation_info(array('location' => $entity[$j]['type']), 
$ticket['child_date'][$j]['date_info'][0]['target_id']);
                                        }
                                }
                        }
-//_debug_array($tickets);
+                       }
+
                        return $tickets;
                }
 
@@ -424,7 +444,8 @@
 
 
                        $history_values = 
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
-                       $ticket['timestampopened'] = 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
+                       $ticket['timestamp'] = $history_values[0]['datetime'];
+                       $ticket['entry_date'] = 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
                        // Figure out when it was opened and last closed
 
                        $history_values = 
$this->historylog->return_array(array(),array('O'),'history_timestamp','ASC',$id);
@@ -437,9 +458,9 @@
                                $ticket['timestampclosed']= 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
                        }
 
-                       $status_text = $this->_get_status_text();
+                       $status_text = $this->get_status_text();
 
-                       $ticket['status_name'] = 
lang($status_text[$ticket['status']]);
+                       $ticket['status_name'] = 
$status_text[$ticket['status']];
                        
$ticket['user_lid']=$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
                        
$ticket['category_name']=ucfirst($this->get_category_name($ticket['cat_id']));
 
@@ -467,8 +488,9 @@
 
                function read_additional_notes($id)
                {
+                       $additional_notes = array();
                        $history_array = 
$this->historylog->return_array(array(),array('C'),'','',$id);
-                       $i=1;
+                       $i=2;
                        while (is_array($history_array) && list(,$value) = 
each($history_array))
                        {
                                $additional_notes[] = array
@@ -480,20 +502,18 @@
                                        );
                                $i++;
                        }
-
-                       if(isset ($additional_notes))
-                       {
                                return $additional_notes;
                        }
-               }
 
 
                function read_record_history($id)
                {
                        $history_array = 
$this->historylog->return_array(array('C','O'),array(),'','',$id);
-                       $status_text = $this->_get_status_text();
+
+                       $status_text = $this->get_status_text();
                        $record_history = array();
                        $i=0;
+
                        if (is_array($history_array))
                        {
                                foreach ($history_array as $value)
@@ -512,25 +532,35 @@
                                                case 'T': $type = 
lang('Category changed'); break;
                                                case 'S': $type = lang('Subject 
changed'); break;
                                                case 'H': $type = 
lang('Billable hours changed'); break;
-                                               case 'B': $type = 
lang('Billable rate changed'); break;
+                                               case 'B': $type = lang('Budget 
changed'); break;
+       //                                      case 'B': $type = 
lang('Billable rate changed'); break;
                                                case 'F': $type = lang('finnish 
date changed'); break;
                                                case 'IF': $type = 
lang('Initial finnish date'); break;
+                                               case 'L': $type = 
lang('Location changed'); break;
+                                               case 'M':
+                                                       $type = lang('Sendt by 
email to');
+                                                       
$this->order_sent_adress = $value['new_value']; // in case we want to resend 
the order as an reminder
+                                                       break;
                                                default: break;
                                        }
 
-                                       switch ($value['new_value'])
+                                       if ( $value['status'] == 'X' || 
$value['status'] == 'R' || (strlen($value['status']) == 2 && 
substr($value['new_value'], 0, 1) == 'C') ) // if custom status
                                        {
-                                               case 'O': 
$value['new_value']=lang('Opened'); break;
-                                               case 'X': 
$value['new_value']=lang('Closed'); break;
-                                               case 'I': 
$value['new_value']=lang('In Progress'); break; //initiated
-                                               case 'C': 
$value['new_value']=lang('custom'); break; // FIXME: make configurable
-                                               default: break;
+                                               switch ($value['status'])
+                                               {
+                                                       case 'R': 
+                                                               $type = 
lang('Re-opened');
+                                                               break;
+                                                       case 'X':
+                                                               $type = 
lang('Closed');
+                                                               break;
+                                                       default:
+                                                               $type = 
lang('Status changed')
+                                                               ;break;
                                        }
 
-                                       if(strlen($value['new_value']) == 2 && 
substr($value['new_value'], 0, 1) == 'C') // if custom status
-                                       {
-                                               $type = lang('Status changed');
                                                $value['new_value'] = 
$status_text[$value['new_value']];
+                                               $value['old_value'] = 
$status_text[$value['old_value']];
                                        }
 
                                        $record_history[$i]['value_action']     
= $type?$type:'';
@@ -540,15 +570,18 @@
                                                if ((int)$value['new_value']>0)
                                                {
                                                        
$record_history[$i]['value_new_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+                                                       
$record_history[$i]['value_old_value'] = $value['old_value'] ? 
$GLOBALS['phpgw']->accounts->id2name($value['old_value']) : '';
                                                }
                                                else
                                                {
                                                        
$record_history[$i]['value_new_value']  = lang('None');
+                                                       
$record_history[$i]['value_old_value']  = lang('None');
                                                }
                                        }
                                        else if ($value['status'] == 'T')
                                        {
                                                
$record_history[$i]['value_new_value']  = 
$this->get_category_name($value['new_value']);
+                                               
$record_history[$i]['value_old_value']  = 
$this->get_category_name($value['old_value']);
                                        }
                                        else if (($value['status'] == 'F') || 
($value['status'] =='IF'))
                                        {
@@ -557,15 +590,18 @@
                                        else if ($value['status'] != 'O' && 
$value['new_value'])
                                        {
                                                
$record_history[$i]['value_new_value']  = $value['new_value'];
+                                               
$record_history[$i]['value_old_value']  = $value['old_value'];
                                        }
                                        else
                                        {
                                                
$record_history[$i]['value_new_value']  = '';
+
                                        }
 
                                        $i++;
                                }
                        }
+
                        return $record_history;
                }
 
@@ -588,11 +624,11 @@
 
                        $receipt = $this->so->add($ticket);
 
-                       $this->config->read_repository();
+                       $this->config->read();
 
                        if 
(isset($this->config->config_data['mailnotification']) && 
$this->config->config_data['mailnotification'] && isset($ticket['send_mail']) 
&& $ticket['send_mail'])
                        {
-                               $receipt = 
$this->mail_ticket($receipt['id'],$fields_updated,$receipt,$ticket['location_code']);
+                               $receipt_mail = 
$this->mail_ticket($receipt['id'],$fields_updated,$receipt,$ticket['location_code']);
                        }
 
                        $criteria = array
@@ -612,50 +648,72 @@
                                        continue;
                                }
 
-                               $file = PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                               $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
                                if ( $entry['active'] && is_file($file) )
                                {
-                                       require_once PHPGW_APP_INC . 
"/custom/{$entry['file_name']}";
+                                       require_once $file;
                                }
                        }
 
+                       if(isset($receipt_mail) && is_array($receipt_mail))
+                       {
+                               $receipt = array_merge($receipt, $receipt_mail);
+                       }
                        return $receipt;
                }
 
 
-               function 
mail_ticket($id,$fields_updated,$receipt=0,$location_code='')
+               function get_address_element($location_code = '')
                {
-                       $this->send                     = 
CreateObject('phpgwapi.send');
-
-                       $members = array();
-
-                       $ticket = $this->so->read_single($id);
-
-                       if($ticket['location_code'])
+                       $address_element = array();
+                       if($location_code)
                        {
                                $solocation             = 
CreateObject('property.solocation');
                                $custom = 
createObject('property.custom_fields');
-                               $location_data          = 
$solocation->read_single($ticket['location_code']);
+                               $location_data          = 
$solocation->read_single($location_code);
 
-                               
$type_id=count(explode('-',$ticket['location_code']));
+                               $location_types = 
execMethod('property.soadmin_location.select_location_type');
+                               $type_id=count(explode('-',$location_code));
+
+                               for ($i=1; $i<$type_id+1; $i++)
+                               {
+                                       $address_element[] = array
+                                       (
+                                               'text' => 
$location_types[($i-1)]['name'],
+                                               'value'=> 
$location_data["loc{$i}"] . '  ' . $location_data["loc{$i}_name"]
+                                       );
+                               }
+
                                $fm_location_cols = 
$custom->find('property','.location.' . $type_id, 0, '', 'ASC', 'attrib_sort', 
true, true);
                                $i=0;
-                               if (isset($fm_location_cols) AND 
is_array($fm_location_cols))
-                               {
                                        foreach($fm_location_cols as 
$location_entry)
                                        {
                                                
if($location_entry['lookup_form'])
                                                {
-                                                       
$address_element[$i]['text']=$location_entry['input_text'];
-                                                       
$address_element[$i]['value']=$location_data[$location_entry['column_name']];
+                                               $address_element[] = array
+                                               (
+                                                       'text' => 
$location_entry['input_text'],
+                                                       'value'=> 
$location_data[$location_entry['column_name']]
+                                               );
                                                }
                                                $i++;
                                        }
                                }
+                       return $address_element;
                        }
 
+               function mail_ticket($id, $fields_updated, $receipt = 
array(),$location_code='')
+               {
+                       $this->send                     = 
CreateObject('phpgwapi.send');
+
+                       $members = array();
+
+                       $ticket = $this->so->read_single($id);
+
+                       $address_element = 
$this->get_address_element($ticket['location_code']);
+
                        $history_values = 
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
-                       $timestampopened = 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
+                       $entry_date = 
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
 
                        if($ticket['status']=='X')
                        {
@@ -667,7 +725,7 @@
                        $m=count($history_2)-1;
                        $ticket['status']=$history_2[$m]['status'];
 
-               //      $status = $this->_get_status_text();
+               //      $status = $this->get_status_text();
 
                        $group_name= 
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
 
@@ -704,8 +762,8 @@
                // build body
                        $body  = '';
        //              $body .= lang('Ticket').' #'.$id."\n";
-                       $body .= '<a href ="http://' . 
$GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php','menuaction='.'property.uitts.view&id=' . 
$id).'">' . lang('Ticket').' #' .$id .'</a>'."\n";
-                       $body .= lang('Date Opened').': '.$timestampopened."\n";
+                       $body .= '<a href ="http://' . 
$GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uitts.view', 'id' => $id)).'">' . lang('Ticket').' #' .$id 
.'</a>'."\n";
+                       $body .= lang('Date Opened').': '.$entry_date."\n";
                        $body .= lang('Category').': '. 
$this->get_category_name($ticket['cat_id']) ."\n";
 //                     $body .= lang('Subject').': '. $ticket['subject'] ."\n";
                        $body .= lang('Location').': '. 
$ticket['location_code'] ."\n";
@@ -837,7 +895,7 @@
                                $receipt['error'][] = array('msg'=> 'group: 
'.$group_name);
                                $receipt['error'][] = array('msg'=> 'err_code: 
'.$this->send->err['code']);
                                $receipt['error'][] = array('msg'=> 'err_msg: 
'. htmlspecialchars($this->send->err['msg']));
-                               $receipt['error'][] = array('msg'=> 'err_desc: 
'. $GLOBALS['phpgw']->err['desc']);
+                               $receipt['error'][] = array('msg'=> 'err_desc: 
'. $this->send->err['desc']);
                        }
 
 //_debug_array($receipt);
@@ -860,4 +918,17 @@
                        return $this->so->get_custom_status();
                }
 
+               public function update_status($data, $id = 0)
+               {
+                       $receipt        = $this->so->update_status($data, $id);
+                       $this->fields_updated = $this->so->fields_updated;
+                       return $receipt;
+               }
+
+               public function update_ticket($data, $id)
+               {
+                       $receipt        = $this->so->update_ticket($data, $id);
+                       $this->fields_updated = $this->so->fields_updated;      
        
+                       return $receipt;
+               }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.bowo_hour.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bowo_hour.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.bowo_hour.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -325,8 +325,11 @@
 
 //_debug_array($values);
 
+                       if ($values['select']) 
+                       {
                        foreach($values['select'] as $n)
                        {
+                                                                               
                        
                                if(!$values['quantity'][$n])
                                {
                                        $values['quantity'][$n]=1;
@@ -361,6 +364,7 @@
                                );
 
                        }
+                       }
 //_debug_array($hour);
 
                        if($hour)

Modified: people/sigurdne/modules/property/trunk/inc/class.boworkorder.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boworkorder.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.boworkorder.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -40,6 +40,7 @@
                var $sort;
                var $order;
                var $cat_id;
+               var $order_sent_adress; // in case we want to resend the order 
as an reminder
 
                var $public_functions = array
                (
@@ -58,7 +59,7 @@
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name           = 'property.project';
                        $this->cats->supress_info       = true;
-
+                       $this->interlink        = & $this->so->interlink;
                        if ($session)
                        {
                                $this->read_sessiondata();
@@ -72,20 +73,25 @@
                        $filter = phpgw::get_var('filter', 'int');
                        $cat_id = phpgw::get_var('cat_id', 'int');
                        $status_id      = phpgw::get_var('status_id');
-                       $search_vendor  = phpgw::get_var('search_vendor');
                        $wo_hour_cat_id = phpgw::get_var('wo_hour_cat_id', 
'int');
                        $start_date     = phpgw::get_var('start_date');
                        $end_date       = phpgw::get_var('end_date');
                        $b_group        = phpgw::get_var('b_group');
                        $paid   = phpgw::get_var('paid', 'bool');
+                       $b_account              = phpgw::get_var('b_account');
+                       $district_id    = phpgw::get_var('district_id', 'int');
+                       $criteria_id    = phpgw::get_var('criteria_id', 'int');
 
-                       if ($start)
+                       $this->start                    = $start ? $start : 0;
+                       $this->criteria_id              = isset($criteria_id) 
&& $criteria_id ? $criteria_id : '';
+
+                       if(array_key_exists('b_account',$_POST) || 
array_key_exists('b_account',$_GET) )
                        {
-                               $this->start=$start;
+                               $this->b_account = $b_account;
                        }
-                       else
+                       if(array_key_exists('district_id',$_POST) || 
array_key_exists('district_id',$_GET) )
                        {
-                               $this->start=0;
+                               $this->district_id = $district_id;
                        }
 
                        if(isset($paid))
@@ -112,27 +118,23 @@
                        {
                                $this->order = $order;
                        }
-                       if(array_key_exists('cat_id',$_POST))
+                       if(array_key_exists('cat_id',$_POST) || 
array_key_exists('cat_id',$_GET))
                        {
                                $this->cat_id = $cat_id;
                        }
-                       if(array_key_exists('status_id',$_POST))
+                       if(array_key_exists('status_id',$_POST)  || 
array_key_exists('status_id',$_GET))
                        {
                                $this->status_id = $status_id;
                        }
-                       if(array_key_exists('search_vendor',$_POST))
+                       if(array_key_exists('wo_hour_cat_id',$_POST)  || 
array_key_exists('wo_hour_cat_id',$_GET))
                        {
-                               $this->search_vendor = $search_vendor;
-                       }
-                       if(array_key_exists('wo_hour_cat_id',$_POST))
-                       {
                                $this->wo_hour_cat_id = $wo_hour_cat_id;
                        }
-                       if(array_key_exists('start_date',$_POST))
+                       if(array_key_exists('start_date',$_POST) || 
array_key_exists('start_date',$_GET))
                        {
                                $this->start_date = $start_date;
                        }
-                       if(array_key_exists('end_date',$_POST))
+                       if(array_key_exists('end_date',$_POST) || 
array_key_exists('end_date',$_GET))
                        {
                                $this->end_date = $end_date;
                        }
@@ -148,13 +150,15 @@
                        $this->sort                             = 
isset($data['sort']) ? $data['sort']: '';
                        $this->order                    = isset($data['order']) 
? $data['order']: '';
                        $this->cat_id                   = 
isset($data['cat_id']) ? $data['cat_id']: '';
-                       $this->search_vendor    = isset($data['search_vendor']) 
? $data['search_vendor']: '';
                        $this->status_id                = 
isset($data['status_id']) ? $data['status_id']: '';
                        $this->wo_hour_cat_id   = 
isset($data['wo_hour_cat_id']) ? $data['wo_hour_cat_id']: '';
                        $this->start_date               = 
isset($data['start_date']) ? $data['start_date']: '';
                        $this->end_date                 = 
isset($data['end_date']) ? $data['end_date']: '';
                        $this->b_group                  = 
isset($data['b_group']) ? $data['b_group']: '';
                        $this->paid                             = 
isset($data['paid']) ? $data['paid']: '';
+                       $this->b_account                = 
isset($data['b_account']) ? $data['b_account']: '';
+                       $this->district_id              = 
isset($data['district_id']) ? $data['district_id']: '';
+                       $this->criteria_id              = 
isset($data['criteria_id'])?$data['criteria_id']:'';
                }
 
                function save_sessiondata($data)
@@ -223,16 +227,148 @@
                        return 
$this->bocommon->select_list($selected,$key_location_entries);
                }
 
-               function read($start_date='',$end_date='',$allrows='')
+               function get_criteria_list($selected='')
                {
-                       $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
-                       $end_date       = 
$this->bocommon->date_to_timestamp($end_date);
+                       $criteria = array
+                       (
+                               array
+                               (
+                                       'id'    => '1',
+                                       'name'  => lang('project group')
+                               ),
+                               array
+                               (
+                                       'id'    => '2',
+                                       'name'  => lang('project id')
+                               ),
+                               array
+                               (
+                                       'id'    => '3',
+                                       'name'  => lang('workorder id')
+                               ),
+                               array
+                               (
+                                       'id'    => '4',
+                                       'name'  => lang('address')
+                               ),
 
+                               array
+                               (
+                                       'id'    => '5',
+                                       'name'  => lang('location code')
+                               ),
+                               array
+                               (
+                                       'id'    => '6',
+                                       'name'  => lang('title')
+                               ),
+                               array
+                               (
+                                       'id'    => '7',
+                                       'name'  => lang('vendor')
+                               ),
+                               array
+                               (
+                                       'id'    => '8',
+                                       'name'  => lang('vendor id')
+                               ),
+                       );
+                       return 
$this->bocommon->select_list($selected,$criteria);
+               }
+
+
+               function get_criteria($id='')
+               {
+                       $criteria = array();
+                       $criteria[1] = array
+                       (
+                               'field'         => 'project_group',
+                               'type'          => 'int',
+                               'matchtype' => 'exact',
+                               'front' => '',
+                               'back' => ''
+                       );
+                       $criteria[2] = array
+                       (
+                               'field'         => 'fm_project.id',
+                               'type'          => 'int',
+                               'matchtype' => 'exact',
+                               'front' => '',
+                               'back' => ''
+                       );
+                       $criteria[3] = array
+                       (
+                               'field'         => 'fm_workorder.id',
+                               'type'          => 'int',
+                               'matchtype' => 'exact',
+                               'front' => '',
+                               'back' => ''
+                       );
+                       $criteria[4] = array
+                       (
+                               'field' => 'fm_project.address',
+                               'type'  => 'varchar',
+                               'matchtype' => 'like',
+                               'front' => "'%",
+                               'back' => "%'",
+                       );
+                       $criteria[5] = array
+                       (
+                               'field' => 'fm_project.location_code',
+                               'type'  => 'varchar',
+                               'matchtype' => 'like',
+                               'front' => "'",
+                               'back' => "%'"
+                       );
+                       $criteria[6] = array
+                       (
+                               'field' => 'fm_workorder.title',
+                               'type'  => 'varchar',
+                               'matchtype' => 'like',
+                               'front' => "'%",
+                               'back' => "%'"
+                       );
+                       $criteria[7] = array
+                       (
+                               'field' => 'fm_vendor.org_name',
+                               'type'  => 'varchar',
+                               'matchtype' => 'like',
+                               'front' => "'%",
+                               'back' => "%'"
+                       );
+                       $criteria[8] = array
+                       (
+                               'field' => 'fm_vendor.id',
+                               'type'  => 'int',
+                               'matchtype' => 'exact',
+                               'front' => '',
+                               'back' => ''
+                       );
+
+                       if($id)
+                       {
+                               return array($criteria[$id]);
+                       }
+                       else
+                       {
+                               return $criteria;
+                       }                       
+               }
+
+
+               function read($data = array())
+               {
+                       $start_date     = 
$this->bocommon->date_to_timestamp($data['start_date']);
+                       $end_date       = 
$this->bocommon->date_to_timestamp($data['end_date']);
+
+
                        $workorder = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' => 
$this->status_id,
-                                                                               
        'search_vendor' => $this->search_vendor,'wo_hour_cat_id' => 
$this->wo_hour_cat_id,
-                                                                               
        'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows,
-                                                                               
        'b_group'=>$this->b_group,'paid'=>$this->paid));
+                                                                               
        'wo_hour_cat_id' => $this->wo_hour_cat_id,
+                                                                               
        
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$data['allrows'],
+                                                                               
        'b_group'=>$this->b_group,'paid'=>$this->paid,'b_account' => 
$this->b_account,
+                                                                               
        'district_id' => $this->district_id,'dry_run'=>$data['dry_run'], 
'criteria' => $this->get_criteria($this->criteria_id)));
+                       
                        $this->total_records = $this->so->total_records;
 
                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -276,11 +412,11 @@
 
                        $workorder['b_account_name']    = 
$this->so->get_b_account_name($workorder['b_account_id']);
 
-                       $config                         = 
CreateObject('phpgwapi.config');
-                       $config->read_repository();
+                       $config                         = 
CreateObject('phpgwapi.config','property');
+                       $config->read();
                        $tax = 1+($config->config_data['fm_tax'])/100;
-                       $workorder['calculation']       
=number_format($workorder['calculation']*$tax, 2, ',', '');
-                       $workorder['actual_cost']       
=number_format(($workorder['act_mtrl_cost']+$workorder['act_vendor_cost']), 2, 
',', '');
+                       $workorder['calculation']       = 
$workorder['calculation'] * $tax;
+                       $workorder['actual_cost']       = 
$workorder['act_mtrl_cost'] + $workorder['act_vendor_cost'];
 
                        $vfs = CreateObject('phpgwapi.vfs');
                        $vfs->override_acl = 1;
@@ -303,6 +439,52 @@
                                unset($workorder['files']);
                        }
 
+                       $workorder['origin'] = 
$this->interlink->get_relation('property', '.project.workorder', $workorder_id, 
'origin');
+                       $workorder['target'] = 
$this->interlink->get_relation('property', '.project.workorder', $workorder_id, 
'target');
+
+                       if($workorder['location_code'])
+                       {
+                               $solocation     = 
CreateObject('property.solocation', $this->bocommon);
+                               $workorder['location_data'] = 
$solocation->read_single($workorder['location_code']);
+                       }
+
+                       if($workorder['tenant_id']>0)
+                       {
+                               
$tenant_data=$this->bocommon->read_single_tenant($workorder['tenant_id']);
+                               $workorder['location_data']['tenant_id']= 
$workorder['tenant_id'];
+                               $workorder['location_data']['contact_phone']= 
$tenant_data['contact_phone'];
+                               $workorder['location_data']['last_name']        
= $tenant_data['last_name'];
+                               $workorder['location_data']['first_name']       
= $tenant_data['first_name'];
+                       }
+                       else
+                       {
+                               unset($workorder['location_data']['tenant_id']);
+                               
unset($workorder['location_data']['contact_phone']);
+                               unset($workorder['location_data']['last_name']);
+                               
unset($workorder['location_data']['first_name']);
+                       }
+
+                       if($workorder['p_num'])
+                       {
+                               $soadmin_entity = 
CreateObject('property.soadmin_entity');
+                               $category = 
$soadmin_entity->read_single_category($workorder['p_entity_id'],$workorder['p_cat_id']);
+
+                               
$workorder['p'][$workorder['p_entity_id']]['p_num']=$workorder['p_num'];
+                               
$workorder['p'][$workorder['p_entity_id']]['p_entity_id']=$workorder['p_entity_id'];
+                               
$workorder['p'][$workorder['p_entity_id']]['p_cat_id']=$workorder['p_cat_id'];
+                               
$workorder['p'][$workorder['p_entity_id']]['p_cat_name'] = $category['name'];
+                       }
+
+                       $event_criteria = array
+                       (
+                               'appname'               => 'property',
+                               'location'              => '.project.workorder',
+                               'location_item_id'      => $workorder_id
+                       );
+
+                       $events = execMethod('property.soevent.read', 
$event_criteria);
+                       $workorder['event_id'] = $events ? $events[0]['id'] : 
'';
+
                        return $workorder;
                }
 
@@ -310,8 +492,9 @@
                {
                        $historylog     = 
CreateObject('property.historylog','workorder');
                        $history_array = 
$historylog->return_array(array('O'),array(),'','',$id);
+
                        $i=0;
-                       while (is_array($history_array) && list(,$value) = 
each($history_array))
+                       foreach ($history_array as $value) 
                        {
 
                                $record_history[$i]['value_date']       = 
$GLOBALS['phpgw']->common->show_date($value['datetime']);
@@ -325,7 +508,10 @@
                                        case 'O': $type = lang('Opened');    
break;
                                        case 'A': $type = lang('Re-assigned'); 
break;
                                        case 'P': $type = lang('Priority 
changed'); break;
-                                       case 'M': $type = lang('Sendt by email 
to'); break;
+                                       case 'M':
+                                               $type = lang('Sendt by email 
to');
+                                               $this->order_sent_adress = 
$value['new_value']; // in case we want to resend the order as an reminder
+                                               break;
                                        case 'B': $type = lang('Budget 
changed'); break;
                                        case 'CO': $type = lang('Initial 
Coordinator'); break;
                                        case 'C': $type = lang('Coordinator 
changed'); break;
@@ -354,23 +540,46 @@
                                        {
                                                
$record_history[$i]['value_new_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
                                        }
+                                       if (! $value['old_value'])
+                                       {
+                                               
$record_history[$i]['value_old_value']  = '';
+                                       }
+                                       else
+                                       {
+                                               
$record_history[$i]['value_old_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['old_value']);
+                                       }
                                }
                                else if ($value['status'] == 'C' || 
$value['status'] == 'CO')
                                {
                                        $record_history[$i]['value_new_value']  
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+                                       if (! $value['old_value'])
+                                       {
+                                               
$record_history[$i]['value_old_value']  = '';
+                                       }
+                                       else
+                                       {
+                                               
$record_history[$i]['value_old_value']  = 
$GLOBALS['phpgw']->accounts->id2name($value['old_value']);
+                                       }
                                }
                                else if ($value['status'] == 'T' || 
$value['status'] == 'TO')
                                {
                                        $category                               
                                = 
$this->cats->return_single($value['new_value']);
                                        $record_history[$i]['value_new_value']  
= $category[0]['name'];
+                                       if($value['old_value'])
+                                       {
+                                               $category                       
                                        = 
$this->cats->return_single($value['old_value']);
+                                               
$record_history[$i]['value_old_value']  = $category[0]['name'];
+                                       }
                                }
                                else if ($value['status'] != 'O' && 
$value['new_value'])
                                {
                                        $record_history[$i]['value_new_value']  
= $value['new_value'];
+                                       $record_history[$i]['value_old_value']  
= $value['old_value'];
                                }
                                else if ($value['status'] != 'B' && 
$value['new_value'])
                                {
-                                       $record_history[$i]['value_new_value']  
= $value['new_value'];
+                                       $record_history[$i]['value_new_value']  
=number_format($value['new_value'], 0, ',', ' ');
+                                       $record_history[$i]['value_old_value']  
=number_format($value['old_value'], 0, ',', ' ');
                                }
                                else
                                {
@@ -387,6 +596,7 @@
                {
                        $workorder['start_date']        = 
$this->bocommon->date_to_timestamp($workorder['start_date']);
                        $workorder['end_date']  = 
$this->bocommon->date_to_timestamp($workorder['end_date']);
+                       $workorder['location_code'] = 
isset($workorder['location']) && $workorder['location'] ? 
implode('-',$workorder['location']) : '';
 
                        if ($action=='edit')
                        {
@@ -403,5 +613,5 @@
                {
                        $this->so->delete($workorder_id);
                }
+
        }
-

Modified: people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.custom_fields.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -5,17 +5,17 @@
         * @author Sigurd Nes <address@hidden>
         * @author Dave Hall dave.hall at skwashd.com
         * @copyright Copyright (C) 2003-2006 Free Software Foundation 
http://www.fsf.org/
-        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v3 or later
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
         * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
         * @package phpgroupware
         * @subpackage phpgwapi
-        * @version $Id: class.custom_fields.inc.php 1114 2008-06-02 18:15:22Z 
sigurd $
+        * @version $Id: class.custom_fields.inc.php 2642 2009-04-28 14:29:39Z 
sigurd $
         */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -40,6 +40,7 @@
         */
        class property_custom_fields extends phpgwapi_custom_fields
        {
+
                /**
                 * Constructor
                 *
@@ -61,10 +62,6 @@
                 * @param ????  $view_only ????
                 *
                 * @return array values and definitions of custom attributes 
prepared for ui
-                *
-                * @internal this is a UI related method - WTF was it doing in 
an API logic class?
-                * this is property specific code and so has been moved there!
-                * this code needs some serious attention
                 */
                public function prepare($values, $appname, $location, 
$view_only='')
                {
@@ -112,8 +109,10 @@
                                {
                                        if($attributes['value'])
                                        {
-                                               $contact_data                   
        = 
$contacts->read_single_entry($attributes['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-                                               $attributes['contact_name']     
= $contact_data[0]['n_family'] . ', ' . $contact_data[0]['n_given'];
+                                               $contact_data                   
                = 
$contacts->read_single_entry($attributes['value'],array('fn','tel_work','email'));
+                                               $attributes['contact_name']     
        = $contact_data[0]['fn'];
+                                               $attributes['contact_email']    
= $contact_data[0]['email'];
+                                               $attributes['contact_tel']      
        = $contact_data[0]['tel_work'];
                                        }
 
                                        $insert_record_values[]                 
= $attributes['name'];
@@ -198,6 +197,50 @@
                                                }
                                        }
                                }
+                               else if($attributes['datatype'] == 'event')
+                               {
+                                       // If the record is not saved - issue a 
warning
+                                       if(isset($values['id']) || 
$values['id'])
+                                       {
+                                               $attributes['item_id'] = 
$values['id'];
+                                       }
+                                       else if(isset($values['location_code']) 
|| $values['location_code'])
+                                       {
+                                               $attributes['item_id'] = 
execMethod('property.solocation.get_item_id', $values['location_code']);
+                                       }
+                                       else
+                                       {
+                                               $attributes['warning']          
        = lang('Warning: the record has to be saved in order to plan an event');
+                                       }
+
+                                       if(isset($attributes['value']) && 
$attributes['value'])
+                                       {
+                                               $event = 
execMethod('property.soevent.read_single', $attributes['value']);
+                                               $attributes['descr']            
        = $event['descr'];
+                                               $attributes['enabled']          
        = $event['enabled'] ? lang('yes') : lang('no');
+                                               $attributes['lang_enabled']     
        = lang('enabled');
+
+                                               $id = 
"property{$location}::{$values['id']}::{$attributes['id']}";
+                                               $job = 
execMethod('phpgwapi.asyncservice.read', $id);
+
+                                               $attributes['next']             
                = 
$GLOBALS['phpgw']->common->show_date($job[$id]['next'],$dateformat);
+                                               $attributes['lang_next_run']    
= lang('next run');
+                                               unset($event);
+                                               unset($id);
+                                               unset($job);
+                                       }
+                                       $insert_record_values[]                 
= $attributes['name'];
+                                       $lookup_link                            
        = $GLOBALS['phpgw']->link('/index.php',array(
+                                               'menuaction'    => 
$this->_appname.'.uievent.edit',
+                                               'location'              => 
$location,
+                                               'attrib_id'             => 
$attributes['id'],
+                                               'item_id'               => 
isset($attributes['item_id']) ? $attributes['item_id'] : '',
+                                               'id'                    => 
isset($attributes['value']) && $attributes['value'] ? $attributes['value'] : 
''));
+
+                                       $lookup_functions[$m]['name']   = 
'lookup_'. $attributes['name'] .'()';
+                                       $lookup_functions[$m]['action'] = 
'Window1=window.open('."'" . $lookup_link ."'" 
.',"Search","width=800,height=500,toolbar=no,scrollbars=yes,resizable=yes");';
+                                       $m++;
+                               }
                                else if (isset($entity['attributes'][$i]) && 
$entity['attributes'][$i]['datatype']!='I' && 
$entity['attributes'][$i]['value'])
                                {
                                        $entity['attributes'][$i]['value'] = 
stripslashes($entity['attributes'][$i]['value']);
@@ -226,4 +269,164 @@
 
                        return $values;
                }
+
+               function prepare_for_db($table, $values_attribute, $id = 0)
+               {       
+                       $id = (int)$id;
+                       $data = array();
+                       if (isset($values_attribute) AND 
is_array($values_attribute))
+                       {
+                               foreach($values_attribute as $entry)
+                               {
+                                       if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR' && $entry['datatype']!='event')
+                                       {
+                                               if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] == 
'link')
+                                               {
+                                                       $entry['value'] = 
$this->_db->db_addslashes($entry['value']);
+                                               }
+
+                                               if($entry['datatype'] == 'pwd' 
&& $entry['value'] && $entry['value2'])
+                                               {
+                                                       if($entry['value'] || 
$entry['value2'])
+                                                       {
+                                                               
if($entry['value'] == $entry['value2'])
+                                                               {
+                                                                       
$data['value_set'][$entry['name']]      = md5($entry['value']);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$data['receipt']['error'][]=array('msg'=>lang('Passwords do not match!'));
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       
$data['value_set'][$entry['name']]      = 
isset($entry['value'])?$entry['value']:'';
+                                               }
+                                       }
+
+                                       if($entry['history'] == 1)
+                                       {
+                                               if($id)
+                                               {
+                                                       
$this->_db->query("SELECT {$entry['name']} FROM $table WHERE id = 
{$id}",__LINE__,__FILE__);
+                                                       
$this->_db->next_record();
+                                                       $old_value = 
$this->_db->f($entry['name']);
+                                                       if($entry['value'] != 
$old_value)
+                                                       {
+                                                               
$data['history_set'][$entry['attrib_id']] = array
+                                                               ('
+                                                                       value'  
=> $entry['value'],
+                                                                       'date'  
=> phpgwapi_datetime::date_to_timestamp($entry['date'])
+                                                               );
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                               
$data['history_set'][$entry['attrib_id']] = $entry['value'];
+                                               }
+                                       }
+                               }
+                       }
+                       return $data;
+               }
+
+               function translate_value($values, $location_id, $location_count 
= 0)
+               {
+                       $choice_table = 'phpgw_cust_choice';
+                       $attribute_table = 'phpgw_cust_attribute';
+                       $attribute_filter = " location_id = {$location_id}";
+                       $contacts = CreateObject('phpgwapi.contacts');
+//_debug_array($values);
+                       $location = array();
+                       $ret = array();
+                       $j=0;
+                       foreach ($values as $row)
+                       {
+                               foreach ($row as $field => $data)
+                               {
+                                       if($field == 'location_code')
+                                       {
+                                               $location = 
split('-',$data['value']);
+                                       }
+
+                                       if(($data['datatype']=='R' || 
$data['datatype']=='LB') && $data['value'])
+                                       {
+                                               $sql="SELECT value FROM 
$choice_table WHERE $attribute_filter AND attrib_id=" .$data['attrib_id']. "  
AND id=" . $data['value'];
+                                               $this->_db->query($sql);
+                                               $this->_db->next_record();
+                                               $ret[$j][$field] =  
$this->_db->f('value');
+                                       }
+                                       else if($data['datatype']=='AB' && 
$data['value'])
+                                       {
+                                               $contact_data   = 
$contacts->read_single_entry($data['value'],array('fn'));
+                                               $ret[$j][$field] =  
$contact_data[0]['fn'];
+                                       }
+                                       else if($data['datatype']=='VENDOR' && 
$data['value'])
+                                       {
+                                               $sql="SELECT org_name FROM 
fm_vendor where id={$data['value']}";
+                                               $this->_db->query($sql);
+                                               $this->_db->next_record();
+                                               $ret[$j][$field] =  
$this->_db->f('org_name',true);
+                                       }
+                                       else if($data['datatype']=='CH' && 
$data['value'])
+                                       {
+                                               $ch= 
unserialize($data['value']);
+                                               if (isset($ch) AND 
is_array($ch))
+                                               {
+                                                       for 
($k=0;$k<count($ch);$k++)
+                                                       {
+                                                               $sql="SELECT 
value FROM $choice_table WHERE $attribute_filter AND attrib_id= 
{$data['attrib_id']} AND id=" . $ch[$k];
+                                                               
$this->_db->query($sql);
+                                                               while 
($this->_db->next_record())
+                                                               {
+                                                                       
$ch_value[]=$this->_db->f('value');
+                                                               }
+                                                       }
+                                                       $ret[$j][$field] =  
@implode(",", $ch_value);
+                                                       unset($ch_value);
+                                               }
+                                       }
+                                       else if($data['datatype']=='D' && 
$data['value'])
+                                       {
+                                               $ret[$j][$field] =  
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($data['value']));
+                                       }
+                                       else if($data['datatype']=='timestamp' 
&& $data['value'])
+                                       {
+                                               $ret[$j][$field] =  
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$data['value']);
+                                       }
+                                       else if($data['datatype']=='link' && 
$data['value'])
+                                       {
+                                               $ret[$j][$field] =  
phpgw::safe_redirect($data['value']);
+                                       }
+                                       else if($data['datatype']=='user' && 
$data['value'])
+                                       {
+                                               $ret[$j][$field] =   
$GLOBALS['phpgw']->accounts->get($data['value'])->__toString();
+                                       }
+                                       else if($data['datatype']=='pwd' && 
$data['value'])
+                                       {
+                                               $ret[$j][$field] =   
lang('yes');
+                                       }
+                                       else
+                                       {
+                                               $ret[$j][$field] =  
stripslashes($data['value']);
+                                       }
+
+                                       if($location)
+                                       {
+                                               if(!$location_count)
+                                               {
+                                                       $location_count = 
count($location);
+                                               }
+                                               for ($m=0;$m < $location_count 
; $m++)
+                                               {
+                                                       $ret[$j]['loc' . 
($m+1)] = $location[$m];
+                                                       
$ret[$j]['query_location']['loc' . ($m+1)]=implode('-', array_slice($location, 
0, ($m + 1)));
+                                               }
+                                       }
+                               }
+                               $j++;
+                       }
+                       return $ret;
+               }
        }

Modified: 
people/sigurdne/modules/property/trunk/inc/class.custom_functions.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.custom_functions.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.custom_functions.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -40,7 +40,7 @@
                        'index' => true
                );
 
-               function property_custom_functions()
+               function __construct()
                {
                        $GLOBALS['phpgw_info']['flags']['noheader'] = true;
                        $GLOBALS['phpgw_info']['flags']['nonavbar'] = true;
@@ -65,7 +65,8 @@
                        }
                        else
                        {
-                               $data = unserialize(urldecode($_GET['data']));
+                               $data = 
unserialize(urldecode(phpgw::get_var('data')));
+
                                $data = phpgw::clean_value($data);
                                if(!isset($data['function']))
                                {
@@ -82,7 +83,7 @@
                                return;
                        }
 
-                       $file = PHPGW_SERVER_ROOT . 
"/property/inc/cron/{$function}.php";
+                       $file = PHPGW_SERVER_ROOT . 
"/property/inc/cron/{$GLOBALS['phpgw_info']['user']['domain']}/{$function}.php";
 
                        if (is_file($file))
                        {
@@ -90,5 +91,9 @@
                                $custom = new $function;
                                $custom->pre_run($data);
                        }
+                       else
+                       {
+                               echo "no such file: 
path_to_phpgw_server_root/property/inc/cron/{$GLOBALS['phpgw_info']['user']['domain']}/{$function}.php";
+                       }
                }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.excel.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.excel.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.excel.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,6 @@
        * @version $Id$
        */
 
-       require_once(PHPGW_APP_INC . '/excel/Worksheet.php');
-       require_once(PHPGW_APP_INC . '/excel/Workbook.php');
+       require_once PHPGW_SERVER_ROOT . '/property/inc/excel/Worksheet.php';
+       require_once PHPGW_SERVER_ROOT . '/property/inc/excel/Workbook.php';
 

Modified: people/sigurdne/modules/property/trunk/inc/class.historylog.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.historylog.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.historylog.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -135,10 +135,11 @@
                        }
 
                        $this->db->query("insert into $this->table 
(history_record_id,"
-                               . 
"history_appname,history_owner,history_status,history_new_value,history_timestamp
 $attrib_id_field $detail_id_field) "
+                               . 
"history_appname,history_owner,history_status,history_new_value, 
history_old_value, history_timestamp $attrib_id_field $detail_id_field) "
                                . "values ('$record_id','" . $this->appname . 
"','"
                                . $this->account . "','$status','"
-                               . $this->db->db_addslashes($new_value) . "','" 
. $timestamp
+                               . $this->db->db_addslashes($new_value) . "','"
+                               . $this->db->db_addslashes($old_value) . "','" 
. $timestamp
                                . "' $attrib_id_value 
$detail_id_value)",__LINE__,__FILE__);
                }
 
@@ -191,22 +192,21 @@
                                . $this->appname . "' and 
history_record_id='$record_id' $filter $only_show_filter "
                                . "$orderby",__LINE__,__FILE__);
 
+                       $return_values = array();
                        while ($this->db->next_record())
                        {
-                               $return_values[] = array(
+                               $return_values[] = array
+                               (
                                        'id'         => 
$this->db->f('history_id'),
                                        'record_id'  => 
$this->db->f('history_record_id'),
                                        'owner'      => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('history_owner')),
 //                                     'status'     => 
lang($this->types[$this->db->f('history_status')]),
                                        'status'     => preg_replace('/ 
/','',$this->db->f('history_status')),
-                                       'new_value'  => 
$this->db->f('history_new_value'),
+                                       'new_value'  => 
htmlspecialchars_decode($this->db->f('history_new_value',true)),
+                                       'old_value'  => 
htmlspecialchars_decode($this->db->f('history_old_value',true)),
                                        'datetime'   => 
strtotime($this->db->f('history_timestamp'))
                                );
                        }
-
-                       if(isset ($return_values))
-                       {
                                return $return_values;
                        }
                }
-       }

Added: people/sigurdne/modules/property/trunk/inc/class.html2pdf.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.html2pdf.inc.php           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.html2pdf.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,41 @@
+<?php
+       /**
+        * phpGroupWare
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2007,2008 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
+        * @package phpgroupware
+        * @subpackage property
+        * @category utilities
+        * @version $Id$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       /**
+       * Document me!
+       *
+       * @package property
+       * @subpackage utilities
+       */
+
+       /**
+       * Include the html2pdf class
+       * @see html2pdf
+       */
+       require_once PHPGW_SERVER_ROOT . 
'/property/inc/html2pdf/html2pdf.class.php';
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.html2pdf.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/inc/class.import.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.import.inc.php     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.import.inc.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage agreement
-       * @version $Id: class.import.inc.php 1043 2008-05-26 17:19:31Z sigurd $
+       * @version $Id: class.import.inc.php 2129 2009-01-18 20:19:40Z sigurd $
        */
 
        /**
@@ -38,7 +38,7 @@
                (
                );
 
-               function property_import()
+               function __construct()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $this->bocommon         = 
CreateObject('property.bocommon');

Modified: people/sigurdne/modules/property/trunk/inc/class.interlink.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.interlink.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.interlink.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -9,13 +9,13 @@
        * @package phpgroupware
        * @subpackage property
        * @category core
-       * @version $Id: class.interlink.inc.php 732 2008-02-10 16:21:14Z sigurd 
$
+       * @version $Id: class.interlink.inc.php 3537 2009-09-09 09:33:24Z 
sigurd $
        */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -52,10 +52,14 @@
 //                     $this->_account                 =& 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->_db                              =& 
$GLOBALS['phpgw']->db;
                        $this->boadmin_entity   = 
CreateObject('property.boadmin_entity');
+                       $this->soadmin_entity                           = & 
$this->boadmin_entity->so;
+                       $this->soadmin_entity->type                     = & 
$this->boadmin_entity->type;
+                       $this->soadmin_entity->type_app         = & 
$this->boadmin_entity->type_app;
 
-//                     $this->_like                    =& $this->db->like;
-//                     $this->_join                    =& $this->db->join;
-//                     $this->_left_join               =& $this->db->left_join;
+
+//                     $this->_like                    =& $this->_db->like;
+                       $this->_join                    =& $this->_db->join;
+//                     $this->_left_join               =& 
$this->_db->left_join;
                }
 
                /**
@@ -110,6 +114,7 @@
                                foreach ($entry['data'] as &$data)
                                {
                                        $data['link'] = 
$this->get_relation_link($linkend_location, $data['id']);
+                                       $data['statustext'] = 
$this->get_relation_info($linkend_location, $data['id']);
                                }
                        }
                        return $relation;
@@ -163,19 +168,22 @@
 
                public function get_location_name($location)
                {
-                       if(substr($location,1,6)=='entity')
-                       {
-                               $type           = explode(".",$location);
-                               $entity_id      = $type[2];
-                               $cat_id         = $type[3];
 
-                               $entity_category = 
$this->boadmin_entity->read_single_category($entity_id,$cat_id);
-                               return $entity_category['name'];
-                       }
-                       else
+                       $location = ltrim($location, '.');
+                       $parts = explode('.', $location);
+//                     list($type, $entity_id, $cat_id) = split('[.]', 
$location);
+                       $this->boadmin_entity->type = $parts[0];
+                       switch( $parts[0] )
                        {
-                               return lang($location);
+                               case 'entity':
+                               case 'catch':
+                                       $entity_category = 
$this->boadmin_entity->read_single_category($parts[1],$parts[2]);
+                                       $location_name =  
$entity_category['name'];                                     
+                                       break;
+                               default:
+                                       $location_name = lang($location);
                        }
+                       return $location_name;
                }
                /**
                * Get relation of the interlink
@@ -186,25 +194,34 @@
                * @return string the linkt to the the related item
                */
 
-               public function get_relation_link($linkend_location, $id)
+               public function get_relation_link($linkend_location, $id, 
$function = 'edit')
                {
                        $link = array();
+
+                       if(is_array($linkend_location))
+                       {
                        $type = $linkend_location['location'];
+                       }
+                       else
+                       {
+                               $type = $linkend_location;
+                       }
+
                        if($type == '.ticket')
                        {
                                $link = array('menuaction' => 
'property.uitts.view', 'id' => $id);
                        }
                        else if($type == '.project.workorder')
                        {
-                               $link = array('menuaction' => 
'property.uiworkorder.view', 'id' => $id);
+                               $link = array('menuaction' => 
"property.uiworkorder.{$function}", 'id' => $id);
                        }
                        else if($type == '.project.request')
                        {
-                               $link = array('menuaction' => 
'property.uirequest.view', 'id' => $id);
+                               $link = array('menuaction' => 
"property.uirequest.{$function}", 'id' => $id);
                        }
                        else if($type == '.project')
                        {
-                               $link = array('menuaction' => 
'property.uiproject.view', 'id' => $id);
+                               $link = array('menuaction' => 
"property.uiproject.{$function}", 'id' => $id);
                        }
                        else if( substr($type, 1, 6) == 'entity' )
                        {
@@ -213,16 +230,106 @@
                                $cat_id         = $type[3];
                                $link = array
                                (
-                                       'menuaction'    => 
'property.uientity.view',
+                                       'menuaction'    => 
"property.uientity.{$function}",
                                        'entity_id'             => $entity_id,
                                        'cat_id'                => $cat_id,
                                        'id'                    => $id
                                );
                        }
+                       else if( substr($type, 1, 5) == 'catch' )
+                       {
+                               $type           = explode('.',$type);
+                               $entity_id      = $type[2];
+                               $cat_id         = $type[3];
+                               $link = array
+                               (
+                                       'menuaction'    => 
"property.uientity.{$function}",
+                                       'type'                  => 'catch',
+                                       'entity_id'             => $entity_id,
+                                       'cat_id'                => $cat_id,
+                                       'id'                    => $id
+                               );
+                       }
                        return $GLOBALS['phpgw']->link('/index.php',$link);     
                }
 
                /**
+               * Get additional info of the linked item
+               *
+               * @param array   $linkend_location the location
+               * @param integer $id                       the id of the 
referenced item
+               *
+               * @return string info of the linked item
+               */
+
+               public function get_relation_info($linkend_location, $id)
+               {
+                       $id = (int)$id;
+                       $type = $linkend_location['location'];
+                       if($type == '.ticket')
+                       {
+                               $this->_db->query("SELECT status FROM 
fm_tts_tickets WHERE id = {$id}",__LINE__,__FILE__);
+                               $this->_db->next_record();
+                               $status_code = $this->_db->f('status');
+
+                               static $status_text;
+                               if(!$status_text)
+                               {
+                                       $status_text = 
execMethod('property.botts.get_status_text');
+                               }
+                               return $status_text[$status_code];
+                       }
+                       else if($type == '.project.workorder')
+                       {
+                               $this->_db->query("SELECT 
fm_workorder_status.descr as status FROM fm_workorder {$this->_join} 
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id WHERE 
fm_workorder.id = {$id}",__LINE__,__FILE__);
+                               $this->_db->next_record();
+                               return $this->_db->f('status');
+                       }
+                       else if($type == '.project.request')
+                       {
+                               $this->_db->query("SELECT 
fm_request_status.descr as status FROM fm_request {$this->_join} 
fm_request_status ON fm_request.status = fm_request_status.id WHERE 
fm_request.id = {$id}",__LINE__,__FILE__);                               
+                               $this->_db->next_record();
+                               return $this->_db->f('status');
+                       }
+                       else if($type == '.project')
+                       {               
+                               $this->_db->query("SELECT 
fm_project_status.descr as status FROM fm_project {$this->_join} 
fm_project_status ON fm_project.status = fm_project_status.id WHERE 
fm_project.id = {$id}",__LINE__,__FILE__);
+                               $this->_db->next_record();
+                               return $this->_db->f('status');
+                       }
+                       else if( substr($type, 1, 6) == 'entity' )
+                       {
+                               $type           = explode('.',$type);
+                               $entity_id      = $type[2];
+                               $cat_id         = $type[3];
+                               $metadata = 
$this->_db->metadata("fm_entity_{$entity_id}_{$cat_id}");
+                               if(isset($metadata['status']))
+                               {
+                                       $sql = "SELECT status FROM 
fm_entity_{$entity_id}_{$cat_id} WHERE id = {$id}";
+                                       
$this->_db->query($sql,__LINE__,__FILE__);
+                                       $this->_db->next_record();
+                                       $status_id = 
(int)$this->_db->f('status');
+                                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
+
+                                       $sql = "SELECT phpgw_cust_choice.value 
as status FROM phpgw_cust_attribute"
+                                       . " {$this->_join} phpgw_cust_choice ON 
phpgw_cust_attribute.location_id = phpgw_cust_choice.location_id "
+                                       . " AND phpgw_cust_attribute.id = 
phpgw_cust_choice.attrib_id WHERE phpgw_cust_attribute.column_name = 'status'"
+                                       . " AND phpgw_cust_choice.id = 
{$status_id} AND phpgw_cust_attribute.location_id = {$location_id}";
+                                       
$this->_db->query($sql,__LINE__,__FILE__);
+                                       $this->_db->next_record();
+                                       return $this->_db->f('status');
+                               }
+                       }
+                       else if( substr($type, 1, 5) == 'catch' )
+                       {
+                               $type           = explode('.',$type);
+                               $entity_id      = $type[2];
+                               $cat_id         = $type[3];
+// Not set
+                       }
+               }
+
+               /**
                * Get entry date of the related item
                *
                * @param string  $appname                 the application name 
for the location
@@ -238,10 +345,6 @@
                public function get_child_date($appname, $origin_location, 
$target_location, $id, $entity_id = '', $cat_id = '')
                {
                        $dateformat     = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       if($cat_id)
-                       {
-                               $soadmin_entity = 
CreateObject('property.soadmin_entity');
-                       }
 
                        $location1_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $origin_location);
                        $location2_id   = 
$GLOBALS['phpgw']->locations->get_id($appname, $target_location);
@@ -265,7 +368,7 @@
                                
$entry['link']=$this->get_relation_link(array('location'=>$target_location), 
$entry['target_id']);
                                if($cat_id)
                                {
-                                       
$entry['descr']=$soadmin_entity->read_category_name($entity_id,$cat_id);
+                                       
$entry['descr']=$this->soadmin_entity->read_category_name($entity_id,$cat_id);
                                }
                                else
                                {

Modified: people/sigurdne/modules/property/trunk/inc/class.menu.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.menu.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.menu.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -13,7 +13,7 @@
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -38,7 +38,7 @@
                 *
                 * @return array available menus for the current user
                 */
-               public function get_menu()
+               public function get_menu($type='')
                {
                        $incoming_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'property';
@@ -103,7 +103,7 @@
                                        'tenant_cats'   => array
                                        (
                                                'text'  => lang('Tenant 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tenant', 'menu_selection' => 
'admin::property::tenant::tenant_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tenant') )
                                        ),
                                        'tenant_global_cats'    => array
                                        (
@@ -118,7 +118,7 @@
                                        'claims_cats'   => array
                                        (
                                                'text'  => lang('Tenant Claim 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tenant_claim', 'menu_selection' => 
'admin::property::tenant::claims_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tenant_claim') )
                                        )
                                );
 
@@ -127,7 +127,7 @@
                                        'vendor_cats'   => array
                                        (
                                                'text'  => lang('Vendor 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'vendor', 'menu_selection' => 
'admin::property::vendor::vendor_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'vendor') )
                                        ),
                                        'vendor_global_cats'    => array
                                        (
@@ -145,7 +145,7 @@
                                        'owner_cats'    => array
                                        (
                                                'text'  => lang('Owner 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'owner', 'menu_selection' => 
'admin::property::owner::owner_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'owner') )
                                        ),
                                        'owner_attribs' => array
                                        (
@@ -159,32 +159,37 @@
                                        'accounting_cats'       => array
                                        (
                                                'text'  => lang('Accounting 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'b_account', 'menu_selection' => 
'admin::property::accounting::accounting_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'b_account') )
                                        ),
-                                       'accounting_dim_b'      => array
+                                       'accounting_dimb'       => array
                                        (
                                                'text'  => lang('Accounting dim 
b'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'dim_b', 'menu_selection' => 
'admin::property::accounting::accounting_dim_b') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'dimb') )
                                        ),
-                                       'accounting_dim_d'      => array
+                                       'dimb_roles'    => array
                                        (
+                                               'text'  => lang('dimb roles'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property.invoice.dimb', 'global_cats' 
=> 'true', 'menu_selection' => 'admin::property::accounting::dimb_roles') )
+                                       ),
+                                       'accounting_dimd'       => array
+                                       (
                                                'text'  => lang('Accounting dim 
d'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'dim_d', 'menu_selection' => 
'admin::property::accounting::accounting_dim_d') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'dimd') )
                                        ),
                                        'accounting_tax'        => array
                                        (
                                                'text'  => lang('Accounting 
tax'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tax', 'menu_selection' => 
'admin::property::accounting::accounting_tax') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tax') )
                                        ),
                                        'voucher_cats'  => array
                                        (
                                                'text'  => lang('Accounting 
voucher category'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'voucher_cat', 'menu_selection' => 
'admin::property::accounting::voucher_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'voucher_cat') )
                                        ),
                                        'voucher_type'  => array
                                        (
                                                'text'  => lang('Accounting 
voucher type'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'voucher_type', 'menu_selection' => 
'admin::property::accounting::voucher_type') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'voucher_type') )
                                        )
                                );
 
@@ -193,7 +198,7 @@
                                        'agreement_status'      => array
                                        (
                                                'text'  => lang('Agreement 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_2.index', 'type' => 'agreement_status', 'menu_selection' 
=> 'admin::property::agreement::agreement_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'agreement_status') )
                                        ),
                                        'agreement_attribs'     => array
                                        (
@@ -203,7 +208,7 @@
                                        'service_agree_cats'    => array
                                        (
                                                'text'  => lang('service 
agreement categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 's_agreement', 'menu_selection' => 
'admin::property::agreement::service_agree_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 's_agreement') )
                                        ),
                                        'service_agree_attribs' => array
                                        (
@@ -218,7 +223,7 @@
                                        'rental_agree_cats'     => array
                                        (
                                                'text'  => lang('rental 
agreement categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'r_agreement', 'menu_selection' => 
'admin::property::agreement::rental_agree_cats') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'r_agreement') )
                                        ),
                                        'rental_agree_attribs'  => array
                                        (
@@ -242,7 +247,7 @@
                                        );
                                        
$admin_children_location_children["category_{$location['id']}"] = array
                                        (
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type' => 'location', 'type_id' => 
$location['id'], 'menu_selection' => 
"admin::property::location::location::category_{$location['id']}") ),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type' => 'location', 'type_id' => 
$location['id']) ),
                                                'text'  => $location['name'] . 
' ' . lang('categories'),
                                        );
                                }
@@ -252,12 +257,12 @@
                                        'street'        => array
                                        (
                                                'text'  => lang('Street'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'street', 'menu_selection' => 
'admin::property::location::street') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'street') )
                                        ),
                                        'district'      => array
                                        (
                                                'text'  => lang('District'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'district', 'menu_selection' => 
'admin::property::location::district') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'district') )
                                        ),
                                        'town'  => array
                                        (
@@ -274,6 +279,11 @@
                                        (
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.config') ),
                                                'text'  => lang('Config')
+                                       ),
+                                       'update_location' => array
+                                       (
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.update_location') ),
+                                               'text'  => lang('update 
location')
                                        )
                                );
 
@@ -311,13 +321,18 @@
                                        'workorder_detail'      => array
                                        (
                                                'text'  => lang('Workorder 
Detail Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'wo_hours', 'menu_selection' => 
'admin::property::workorder_detail') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'wo_hours') )
                                        ),
                                        'ticket_cats'   => array
                                        (
                                                'text'  => lang('Ticket 
Categories'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property.ticket', 'global_cats' => 
'true', 'menu_selection' => 'admin::property::ticket_cats') )
                                        ),
+                                       'ticket_status' => array
+                                       (
+                                               'text'  => lang('Ticket 
status'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'ticket_status') )
+                                       ),
                                        'tenant'        => array
                                        (
                                                'text'  => lang('Tenant'),
@@ -339,18 +354,18 @@
                                        ),
                                        'doc_cats'      => array
                                        (
-                                               'text'  => lang('Document 
Categories'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'document', 'menu_selection' => 
'admin::property::doc_cats') )
+                                               'text'  => lang('document 
categories'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property.document', 'global_cats' => 
'true') )
                                        ),
                                        'building_part' => array
                                        (
                                                'text'  => lang('Building 
Part'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_2.index', 'type' => 'building_part') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'building_part') )
                                        ),
                                        'tender'        => array
                                        (
                                                'text'  => lang('Tender 
chapter'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tender_chapter', 'menu_selection' => 
'admin::property::tender') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'tender_chapter') )
                                        ),
                                        'id_control'    => array
                                        (
@@ -370,44 +385,54 @@
                                        'request_status'        => array
                                        (
                                                'text'  => lang('Request 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_2.index', 'type' => 'request_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'request_status') )
                                        ),
                                        'request_condition'     => array
                                        (
                                                'text'  => lang('Request 
condition_type'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'r_condition_type', 'menu_selection' => 
'admin::property::request_condition') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'r_condition_type') )
                                        ),
                                        'workorder_status'      => array
                                        (
                                                'text'  => lang('Workorders 
status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_2.index', 'type' => 'workorder_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'workorder_status') )
                                        ),
+                                       'project_status'        => array
+                                       (
+                                               'text'  => lang('project 
status'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'project_status') )
+                                       ),
+                                       'project_group' => array
+                                       (
+                                               'text'  => lang('project 
group'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'project_group') )
+                                       ),
                                        'agreement'     => array
                                        (
                                                'text'  => lang('Agreement'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_2.index', 'type' => 'agreement_status') ),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'agreement_status') ),
                                                'image'         => array( 
'property', 'agreement' ),
                                                'children'      => 
$admin_children_agreement
                                        ),
                                        'document_status'       => array
                                        (
                                                'text'  => lang('Document 
Status'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_2.index', 'type' => 'document_status', 'menu_selection' => 
'admin::property::document_status') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'document_status') )
                                        ),
                                        'unit'  => array
                                        (
                                                'text'  => lang('Unit'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_2.index', 'type' => 'unit', 'menu_selection' => 
'admin::property::unit') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'unit') )
                                        ),
                                        'key_location'  => array
                                        (
                                                'text'  => lang('Key location'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_3.index', 'type' => 'key_location') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'key_location') )
                                        ),
                                        'branch'        => array
                                        (
                                                'text'  => lang('Branch'),
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uistandard_3.index', 'type' => 'branch') )
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'branch') )
                                        ),
                                        'accounting'    => array
                                        (
@@ -425,6 +450,11 @@
                                                'text'  => lang('Async 
services'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiasync.index') )
                                        ),
+                                       'event_action'  => array
+                                       (
+                                               'text'  => lang('event action'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'event_action') )
+                                       ),
                                        'list_functions'        => array
                                        (
                                                'text'  => lang('Admin custom 
functions'),
@@ -439,6 +469,11 @@
                                        (
                                                'text'          => 
lang('responsible matrix'),
                                                'url'           => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiresponsible.index') ),
+                                       ),
+                                       'pending_action_type'   => array
+                                       (
+                                               'text'          => 
lang('pending action type'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uicategory.index', 'type' => 'pending_action_type') )
                                        )
                                );
                        }
@@ -468,6 +503,8 @@
                        }
 
                        $menus['navigation'] = array();
+
+//                     
$acl->set_account_id($GLOBALS['phpgw_info']['user']['account_id'], true);
                        if ( $acl->check('.location', PHPGW_ACL_READ, 
'property') )
                        {
                                $children = array();
@@ -587,12 +624,6 @@
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.index')),
                                                        'text'  => 
lang('template'),
                                                        'image'         => 
array('property', 'project_template')
-                                               ),
-                                               'claim'         => array
-                                               (
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.index')),
-                                                       'text'  => lang('Tenant 
claim'),
-                                                       'image'         => 
array('property', 'project_tenant_claim')
                                                )
                                        )
                                );
@@ -663,6 +694,12 @@
                                                (
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiactor.index', 'role'=> 'tenant')),
                                                        'text'  => 
lang('Tenant')
+                                               ),
+                                               'claim'         => array
+                                               (
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.index')),
+                                                       'text'  => lang('Tenant 
claim'),
+                                                       'image'         => 
array('property', 'project_tenant_claim')
                                                )
                                        ), $children)
                                );
@@ -677,11 +714,6 @@
                                        'image'         => array('property', 
'budget'),
                                        'children'      => array
                                        (
-                                               'basis'         => array
-                                               (
-                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.basis')),
-                                                       'text'  => lang('basis')
-                                               ),
                                                'budget'        => array
                                                (
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.index')),
@@ -694,6 +726,15 @@
                                                )
                                        )
                                );
+
+                               if ( $acl->check('.budget.basis', 
PHPGW_ACL_READ, 'property') )
+                               {
+                                       
$menus['navigation']['budget']['children']['basis'] = array
+                                       (
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.basis')),
+                                               'text'  => lang('basis')
+                                       );
+                               }
                        }
 
                        if ( $acl->check('.agreement', PHPGW_ACL_READ, 
'property') )
@@ -816,8 +857,9 @@
                                                );
                                        }
 
+                                       if ($type != 'horisontal')
+                                       {
                                        $cat_list = 
$entity->read_category(array('allrows'=>true,'entity_id'=>$entry['id']));
-
                                        foreach($cat_list as $category)
                                        {
                                                if ( 
$acl->check(".entity.{$entry['id']}.{$category['id']}", PHPGW_ACL_READ, 
'property') )
@@ -831,6 +873,7 @@
                                        }
                                }
                        }
+                       }
                        unset($entity_list);
                        unset($entity);
                        $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$incoming_app;

Modified: people/sigurdne/modules/property/trunk/inc/class.ods.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.ods.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.ods.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -8,13 +8,13 @@
         * @package phpgroupware
         * @subpackage property
         * @category utilities
-        * @version $Id: $
+        * @version $Id: class.ods.inc.php 2588 2009-04-14 11:00:02Z sigurd $
         */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,

Modified: people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soXport.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -39,19 +39,15 @@
                var $total_records = 0;
                var $bilagsnr;
 
-               function property_soXport($useacl=true)
+               function __construct()
                {
-
                        $GLOBALS['phpgw_info']['flags']['currentapp']   =       
'property';
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->soinvoice        = 
CreateObject('property.soinvoice',true);
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->join             = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
-                       $this->like             = $this->bocommon->like;
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+                       $this->like             = & $this->db->like;
+                       $this->join             = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->datetimeformat   = $this->db->datetime_format();
                        $this->account_id       = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
@@ -62,7 +58,7 @@
                        {
                                return;
                        }
-                       $sql = "select mva as tax_code from fm_location1 where 
loc1=" . substr($dima,0,4);
+                       $sql = "select mva as tax_code from fm_location1 where 
loc1='" . substr($dima,0,4) . "'";
                        $this->db->query($sql);
                        $this->db->next_record();
 
@@ -117,7 +113,7 @@
                        {
                                return;
                        }
-                       $sql = "select kostra_id from fm_location1 where loc1=" 
. substr($dima,0,4);
+                       $sql = "select kostra_id from fm_location1 where 
loc1='" . substr($dima,0,4) . "'";
                        $this->db->query($sql);
                        $this->db->next_record();
 
@@ -190,9 +186,12 @@
 
                function get_project($id)
                {
-                       $this->db->query("select project_id from fm_workorder 
where id='$id'");
+                       $id = (int) $id;
+                       $sql = "SELECT project_group FROM fm_workorder"
+                       . " $this->join fm_project ON fm_workorder.project_id = 
fm_project.id WHERE fm_workorder.id={$id}";
+                       $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->next_record();
-                       return $this->db->f('project_id');
+                       return $this->db->f('project_group');
                }
 
                function check_spbudact_code($id)
@@ -249,18 +248,19 @@
                                                false,
                                                false,
                                                $fields['item_type'],
-                                               $fields['item_id']
+                                               $fields['item_id'],
+                                               $fields['external_ref']
                                                );
 
                                        $bilagsnr       = $fields['bilagsnr'];
 
-                                       $values = 
$this->bocommon->validate_db_insert($values);
+                                       $values = 
$this->db->validate_insert($values);
 
                                        $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,fakturadato,"
                                        . " 
forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
                                        . " 
fakturanr,spbudact_code,loc1,dima,dimd,mvakode,periode,merknad,oppsynsigndato,saksigndato,"
-                                       . " 
budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
-                                       . " VALUES ($values," . 
$this->bocommon->moneyformat($fields['belop']) . "," . 
$this->bocommon->moneyformat($fields['godkjentbelop']) . ")";
+                                       . " 
budsjettsigndato,utbetalingsigndato,item_type,item_id,external_ref, 
belop,godkjentbelop)"
+                                       . " VALUES ($values," . 
$this->db->money_format($fields['belop']) . "," . 
$this->db->money_format($fields['godkjentbelop']) . ")";
 
                                        
$this->db->query($sql,__LINE__,__FILE__);
 
@@ -310,22 +310,23 @@
                                $data['utbetalingid'],
                                $data['utbetalingsigndato'],
                                $data['filnavn'],
-                               date("Y-m-d G:i:s"),
+                               date($this->db->datetime_format()),
                                $data['item_type'],
                                $data['item_id'],
+                               $data['external_ref']
                                );
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
                        $sql="INSERT INTO fm_ecobilagoverf 
(id,bilagsnr,kidnr,typeid,kildeid,project_id,kostra_id,pmwrkord_code,fakturadato,"
                                . " 
periode,forfallsdato,fakturanr,spbudact_code,regtid,artid,spvend_code,dima,loc1,"
                                . " 
dimb,mvakode,dimd,oppsynsmannid,saksbehandlerid,budsjettansvarligid,oppsynsigndato,saksigndato,"
-                               . " 
budsjettsigndato,merknad,splitt,utbetalingid,utbetalingsigndato,filnavn,overftid,item_type,item_id,"
+                               . " 
budsjettsigndato,merknad,splitt,utbetalingid,utbetalingsigndato,filnavn,overftid,item_type,item_id,external_ref,"
                                . " belop,godkjentbelop,ordrebelop)"
                                . "values ($values, "
-                               . $this->bocommon->moneyformat($data['belop']) 
. ","
-                               . 
$this->bocommon->moneyformat($data['godkjentbelop']) . ","
-                               . 
$this->bocommon->moneyformat($data['ordrebelop']) . ")";
+                               . $this->db->money_format($data['belop']) . ","
+                               . 
$this->db->money_format($data['godkjentbelop']) . ","
+                               . $this->db->money_format($data['ordrebelop']) 
. ")";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 //echo 'sql ' . $sql.'<br>';

Modified: people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soactor.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id$
+       * @version $Id$
        */
 
        /**
@@ -38,29 +38,29 @@
 
                function property_soactor()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db                       = 
$this->bocommon->new_db();
-                       $this->db2                      = 
$this->bocommon->new_db($this->db);
+                       $this->custom           = 
createObject('property.custom_fields');
+                       $this->db           = & $GLOBALS['phpgw']->db;
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read($data)
                {
                        if(is_array($data))
                        {
-                               $start  = 
(isset($data['start'])?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:'');
-                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $member_id      = 
(isset($data['member_id'])?$data['member_id']:0);
+                               $start          = 
isset($data['start'])?$data['start']:0;
+                               $filter         = isset($data['filter']) && 
$data['filter'] ?$data['filter']:'none';
+                               $query          = 
isset($data['query'])?$data['query']:'';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
+                               $order          = 
isset($data['order'])?$data['order']:'';
+                               $cat_id         = 
isset($data['cat_id'])?$data['cat_id']:'';
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
+                               $member_id      = isset($data['member_id']) && 
$data['member_id'] ? $data['member_id']:0;
+                               $dry_run        = isset($data['dry_run']) ? 
$data['dry_run'] : '';
                        }
 
                        $sql = $this->bocommon->fm_cache('sql_actor_' . 
$this->role);
@@ -74,6 +74,8 @@
 
                        if(!$sql)
                        {
+                               $cols_return = array();
+                               $uicols = array();
                                $cols = $entity_table . 
".*,$category_table.descr as category";
 
                                $cols_return[]                          = 'id';
@@ -81,24 +83,32 @@
                                $uicols['name'][]                       = 'id';
                                $uicols['descr'][]                      = 
lang('ID');
                                $uicols['statustext'][]         = lang('ID');
+                               $uicols['datatype'][]           = false;
+                               $uicols['attib_id'][]           = false;
 
                                $cols_return[]                          = 'id';
                                $uicols['input_type'][]         = 'hidden';
                                $uicols['name'][]                       = 'id';
                                $uicols['descr'][]                      = false;
                                $uicols['statustext'][]         = false;
+                               $uicols['datatype'][]           = false;
+                               $uicols['attib_id'][]           = false;
 
                                $cols_return[]                          = 
'category';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'category';
                                $uicols['descr'][]                      = 
lang('category');
                                $uicols['statustext'][]         = 
lang('category');
+                               $uicols['datatype'][]           = false;
+                               $uicols['attib_id'][]           = false;
 
                                $cols_return[]                          = 
'entry_date';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'entry_date';
                                $uicols['descr'][]                      = 
lang('entry date');
                                $uicols['statustext'][]         = lang('entry 
date');
+                               $uicols['datatype'][]           = false;
+                               $uicols['attib_id'][]           = false;
 
                                $paranthesis .='(';
 
@@ -119,8 +129,6 @@
                                $cols_return                                    
= $this->bocommon->fm_cache('cols_return_actor_' . $this->role);
                        }
 
-                       $i      = count($uicols['name']);
-
                        
$user_columns=isset($GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
 . 
$this->role])?$GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
 . $this->role]:'';
                        $user_column_filter = '';
                        if (isset($user_columns) AND is_array($user_columns) 
AND $user_columns[0])
@@ -130,26 +138,18 @@
 
                        $this->db->query("SELECT * FROM $attribute_table WHERE 
list=1 AND $attribute_filter $user_column_filter ORDER BY attrib_sort ASC");
 
-
                        while ($this->db->next_record())
                        {
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
$this->db->f('column_name');
                                $uicols['descr'][]                      = 
$this->db->f('input_text');
                                $uicols['statustext'][]         = 
$this->db->f('statustext');
-                               $uicols['datatype'][$i]         = 
$this->db->f('datatype');
-                               $cols_return_extra[]= array(
-                                       'name'  => $this->db->f('column_name'),
-                                       'datatype'      => 
$this->db->f('datatype'),
-                                       'attrib_id'     => $this->db->f('id')
-                               );
-
-                               $i++;
+                               $uicols['datatype'][]           = 
$this->db->f('datatype');
+                               $uicols['attib_id'][]           = 
$this->db->f('id');
                        }
 
                        $this->uicols   = $uicols;
 
-//_debug_array($cols_return_extra);
                        if ($order)
                        {
                                $ordermethod = " order by $entity_table.$order 
$sort";
@@ -205,10 +205,13 @@
                        $_querymethod = array();
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
+                               $query = $this->db->db_addslashes($query);
 
-                       //      $filtermethod .= " $where $entity_table.id ='" 
. (int)$query . "'";
+                               if(ctype_digit($query))
+                               {
+                                       $_querymethod[]= "$entity_table.id =" . 
(int)$query;
+                               }
+
                                $where= 'AND';
 
                                $this->db->query("SELECT * FROM 
$attribute_table WHERE $attribute_filter AND search='1'");
@@ -223,7 +226,7 @@
                                        {
                                                if(ctype_digit($query))
                                                {
-                                                       $_querymethod[]= 
"$entity_table." . $this->db->f('column_name') . " = " . intval($query);
+                                                       $_querymethod[]= 
"$entity_table." . $this->db->f('column_name') . '=' . (int)$query;
                                                }
                                        }
                                        else:
@@ -241,9 +244,13 @@
 
                        $sql .= " $filtermethod $querymethod";
 //echo $sql;
+                       $values = array();
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       if(!$dry_run)
+                       {
+                               $this->db->query('SELECT count(*)' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $this->total_records = $this->db->f(0);
                        if(!$allrows)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -253,88 +260,29 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
+                               $cols_return = $uicols['name'];
                        $j=0;
-                       $n=count($cols_return);
-//_debug_array($cols_return);
-                       $contacts                       = 
CreateObject('phpgwapi.contacts');
 
+                               $dataset = array();
                        while ($this->db->next_record())
                        {
-                               for ($i=0;$i<$n;$i++)
+                                       foreach($cols_return as $key => $field)
                                {
-                                       $actor_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
-                                       $actor_list[$j]['grants'] = 
(int)$grants[$this->db->f('owner_id')];
+                                               $dataset[$j][$field] = array
+                                               (
+                                                       'value'         => 
$this->db->f($field),
+                                                       'datatype'      => 
$uicols['datatype'][$key],
+                                                       'attrib_id'     => 
$uicols['attib_id'][$key]
+                                               );
                                }
-
-                               for ($i=0;$i<count($cols_return_extra);$i++)
-                               {
-                                       $value='';
-                                       
$value=$this->db->f($cols_return_extra[$i]['name']);
-
-                                       
if(($cols_return_extra[$i]['datatype']=='R' || 
$cols_return_extra[$i]['datatype']=='LB') && $value)
-                                       {
-                                               $sql="SELECT value FROM 
$choice_table WHERE $attribute_filter AND attrib_id=" 
.$cols_return_extra[$i]['attrib_id']. "  AND id=" . $value;
-                                               $this->db2->query($sql);
-                                               $this->db2->next_record();
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('value');
+                                       $j++;                           
                                        }
-                                       else 
if($cols_return_extra[$i]['datatype']=='AB' && $value)
-                                       {
-                                               $contact_data   = 
$contacts->read_single_entry($value,array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']] = $contact_data[0]['n_family'] 
. ', ' . $contact_data[0]['n_given'];
 
-/*                                             $sql="SELECT org_name FROM 
phpgw_addressbook where id=$value";
-                                               $this->db2->query($sql);
-                                               $this->db2->next_record();
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('org_name');
-*/
-                                       }
-                                       else 
if($cols_return_extra[$i]['datatype']=='VENDOR' && $value)
-                                       {
-                                               $sql="SELECT org_name FROM 
fm_vendor where id=$value";
-                                               $this->db2->query($sql);
-                                               $this->db2->next_record();
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('org_name');
-                                       }
-                                       else 
if($cols_return_extra[$i]['datatype']=='CH' && $value)
-                                       {
-                                               $ch= unserialize($value);
+                               $values = 
$this->custom->translate_value($dataset, $location_id);
 
-                                               if (isset($ch) AND 
is_array($ch))
-                                               {
-                                                       for 
($k=0;$k<count($ch);$k++)
-                                                       {
-                                                               $sql="SELECT 
value FROM $choice_table WHERE $attribute_filter AND attrib_id=" 
.$cols_return_extra[$i]['attrib_id']. "  AND id=" . $ch[$k];
-                                                               
$this->db2->query($sql);
-                                                               while 
($this->db2->next_record())
-                                                               {
-                                                                       
$ch_value[]=$this->db2->f('value');
-                                                               }
-                                                       }
-                                                       
$actor_list[$j][$cols_return_extra[$i]['name']] = @implode(",", $ch_value);
-                                                       unset($ch_value);
-                                               }
-                                       }
-                                       else 
if($cols_return_extra[$i]['datatype']=='D' && $value)
-                                       {
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($value));
-                                       }
-                                       else 
if($cols_return_extra[$i]['datatype']=='timestamp' && $value)
-                                       {
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$value);
-                                       }
-                                       else 
if($cols_return_extra[$i]['datatype']=='link' && $value)
-                                       {
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']]= phpgw::safe_redirect($value);
-                                       }
-                                       else
-                                       {
-                                               
$actor_list[$j][$cols_return_extra[$i]['name']]=$value;
-                                       }
-                               }
-                               $j++;
+                               return $values;
                        }
-                       return $actor_list;
+                       return $values;
                }
 
                function read_single($actor_id, $values = array())

Modified: people/sigurdne/modules/property/trunk/inc/class.soadmin.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soadmin.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soadmin.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,15 +34,12 @@
 
        class property_soadmin
        {
-               function property_soadmin()
+               function __construct()
                {
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-
-                       $this->join             = $this->bocommon->join;
-                       $this->like             = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function get_initials($id)

Modified: 
people/sigurdne/modules/property/trunk/inc/class.soadmin_entity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soadmin_entity.inc.php     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soadmin_entity.inc.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,17 +35,27 @@
        class property_soadmin_entity
        {
                var $grants;
+               var $type = 'entity';
+               var $type_app;
+               var $bocommon;
 
-               function property_soadmin_entity($entity_id='',$cat_id='')
+               function __construct($entity_id='', $cat_id='', $bocommon = '')
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+
+                       if(!$bocommon || !is_object($bocommon))
+                       {
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       }
+                       else
+                       {
+                               $this->bocommon = $bocommon;
+                       }
 
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
+
                        if($entity_id && $cat_id)
                        {
                                $this->category_name    = 
$this->read_category_name($entity_id,$cat_id);
@@ -56,18 +66,12 @@
                {
                        if(is_array($data))
                        {
-                               if (isset($data['start']))
-                               {
-                                       $start=$data['start'];
-                               }
-                               else
-                               {
-                                       $start=0;
-                               }
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                               $query          = isset($data['query']) ? 
$data['query'] : '';
+                               $sort           = isset($data['sort']) ? 
$data['sort'] : 'DESC';
+                               $order          = isset($data['order']) ? 
$data['order'] : '';
+                               $type           = isset($data['type']) && 
$data['type'] ? $data['type'] : $this->type;
+                               $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
                        }
 
                        if ($order)
@@ -80,21 +84,19 @@
                                $ordermethod = ' order by id asc';
                        }
 
-                       $table = 'fm_entity';
+                       $table = "fm_{$type}";
 
                        $querymethod = '';
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
+                               $query = $this->db->db_addslashes($query);
                                $querymethod = " where name $this->like 
'%$query%' or descr $this->like '%$query%'";
                        }
 
                        $sql = "SELECT * FROM $table $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -105,6 +107,8 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
+                       $entity = array();
+
                        while ($this->db->next_record())
                        {
                                $entity[] = array
@@ -128,6 +132,7 @@
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
                                $entity_id = 
(isset($data['entity_id'])?$data['entity_id']:'');
+                               $type           = isset($data['type']) && 
$data['type'] ? $data['type'] : $this->type;
                        }
 
                        if ($order)
@@ -140,7 +145,7 @@
                                $ordermethod = ' order by id asc';
                        }
 
-                       $table = 'fm_entity_category';
+                       $table = "fm_{$type}_category";
 
                        $querymethod = '';
                        if($query)
@@ -151,8 +156,8 @@
 
                        $sql = "SELECT * FROM $table WHERE entity_id=$entity_id 
$querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -180,21 +185,23 @@
                function read_single($id)
                {
 
-                       $sql = "SELECT * FROM fm_entity  where id='$id'";
+                       $id = (int)$id;
+                       $sql = "SELECT * FROM fm_{$this->type} WHERE id={$id}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $entity = array();
                        if ($this->db->next_record())
                        {
                                $entity['id']                           = 
$this->db->f('id');
-                               $entity['name']                         = 
$this->db->f('name');
-                               $entity['descr']                        = 
$this->db->f('descr');
+                               $entity['name']                         = 
$this->db->f('name',true);
+                               $entity['descr']                        = 
$this->db->f('descr',true);
                                $entity['location_form']        = 
$this->db->f('location_form');
                                $entity['lookup_entity']        = 
unserialize($this->db->f('lookup_entity'));
                                $entity['documentation']        = 
$this->db->f('documentation');
                        }
 
-                       $sql = "SELECT location FROM fm_entity_lookup where 
entity_id=$id AND type='lookup'";
+                       $sql = "SELECT location FROM fm_{$this->type}_lookup 
WHERE entity_id={$id} AND type='lookup'";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
@@ -203,7 +210,7 @@
                                $entity['include_entity_for'][] = 
$this->db->f('location');
                        }
 
-                       $sql = "SELECT location FROM fm_entity_lookup where 
entity_id=$id AND type='start'";
+                       $sql = "SELECT location FROM fm_{$this->type}_lookup 
WHERE entity_id={$id} AND type='start'";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
@@ -215,12 +222,13 @@
                        return $entity;
                }
 
-               function read_single_category($entity_id,$cat_id)
+               function read_single_category($entity_id, $cat_id)
                {
-                       $sql = 'SELECT * FROM fm_entity_category where 
entity_id =' . (int)$entity_id . ' AND id = ' . (int)$cat_id;
+                       $sql = "SELECT * FROM fm_{$this->type}_category WHERE 
entity_id =" . (int)$entity_id . ' AND id = ' . (int)$cat_id;
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $category = array();
                        if ($this->db->next_record())
                        {
                                $category['id']                 = 
$this->db->f('id');
@@ -234,24 +242,26 @@
                                $category['loc_link']   = 
$this->db->f('loc_link');
                                $category['start_project']      = 
$this->db->f('start_project');
                                $category['start_ticket']       = 
$this->db->f('start_ticket');
-                               return $category;
+                               $category['jasperupload']       = 
$this->db->f('jasperupload');
                        }
+                       return $category;
                }
 
                function read_category_name($entity_id,$cat_id)
                {
-                       $sql = 'SELECT * FROM fm_entity_category where 
entity_id =' . (int)$entity_id . ' AND id = ' . (int)$cat_id;
+                       $sql = "SELECT * FROM fm_{$this->type}_category WHERE 
entity_id =" . (int)$entity_id . ' AND id = ' . (int)$cat_id;
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
-                       return $this->db->f('name');
+                       return $this->db->f('name', true);
                }
 
                function add_entity($entity)
                {
+                       
                        $entity['name'] = 
$this->db->db_addslashes($entity['name']);
                        $entity['descr'] = 
$this->db->db_addslashes($entity['descr']);
 
-                       $entity['id'] = $this->bocommon->next_id('fm_entity');
+                       $entity['id'] = 
$this->bocommon->next_id("fm_{$this->type}");
 
                        $values= array(
                                $entity['id'],
@@ -261,12 +271,12 @@
                                $entity['documentation']
                                );
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
-                       $this->db->query("INSERT INTO fm_entity (id,name, 
descr,location_form,documentation) "
+                       $this->db->query("INSERT INTO fm_{$this->type} 
(id,name, descr,location_form,documentation) "
                                . "VALUES ($values)",__LINE__,__FILE__);
 
-                       $GLOBALS['phpgw']->locations->add('.entity.' . 
$entity['id'], $entity['name'], 'property', true);
+                       $GLOBALS['phpgw']->locations->add(".{$this->type}." . 
$entity['id'], $entity['name'], $this->type_app[$this->type], true);
 
                        $receipt['id']= $entity['id'];
 
@@ -276,10 +286,10 @@
 
                function get_default_column_def()
                {
-
-                       $fd=array();
+                       $fd = array();
                        $fd['id'] = array('type' => 'int', 'precision' => 4, 
'nullable' => false);
                        $fd['num'] = array('type' => 'varchar', 'precision' => 
16, 'nullable' => false);
+
                        $fd['p_num'] = array('type' => 'varchar', 'precision' 
=> 16, 'nullable' => true);
                        $fd['p_entity_id'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => true);
                        $fd['p_cat_id'] = array('type' => 'int', 'precision' => 
4, 'nullable' => true);
@@ -295,7 +305,8 @@
                        $fd['address'] = array('type' => 'varchar', 'precision' 
=> 150, 'nullable' => true);
                        $fd['tenant_id'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => true);
                        $fd['contact_phone'] = array('type' => 'varchar', 
'precision' => 30, 'nullable' => true);
-                       $fd['status'] = array('type' => 'int', 'precision' => 
4, 'nullable' => true);
+       //              $fd['status'] = array('type' => 'int', 'precision' => 
4, 'nullable' => true);
+
                        $fd['entry_date'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => true);
                        $fd['user_id'] = array('type' => 'int', 'precision' => 
4, 'nullable' => true);
 
@@ -309,7 +320,7 @@
                        $values['name'] = 
$this->db->db_addslashes($values['name']);
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
 
-                       $values['id'] = 
$this->bocommon->next_id('fm_entity_category',array('entity_id'=>$values['entity_id']));
+                       $values['id'] = 
$this->bocommon->next_id("fm_{$this->type}_category", 
array('entity_id'=>$values['entity_id']));
 
                        $values_insert= array(
                                $values['entity_id'],
@@ -323,15 +334,16 @@
                                $values['fileupload'],
                                $values['loc_link'],
                                $values['start_project'],
-                               $values['start_ticket']
+                               $values['start_ticket'],
+                               $values['jasperupload']
                                );
 
-                       $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                       $values_insert  = 
$this->db->validate_insert($values_insert);
 
-                       $this->db->query("INSERT INTO fm_entity_category 
(entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,fileupload,loc_link,start_project,start_ticket)
 "
+                       $this->db->query("INSERT INTO fm_{$this->type}_category 
(entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,fileupload,loc_link,start_project,start_ticket,jasperupload)
 "
                                . "VALUES ($values_insert)",__LINE__,__FILE__);
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->add(".entity.{$values['entity_id']}.{$values['id']}",
 $values['name'], 'property', true, 
"fm_entity_{$values['entity_id']}_{$values['id']}");
+                       $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
 $values['name'],  $this->type_app[$this->type], true, 
"fm_{$this->type}_{$values['entity_id']}_{$values['id']}");
 
                        $receipt['id']= $values['id'];
 
@@ -340,12 +352,20 @@
                        $fd = $this->get_default_column_def();
 
                        $pk[]= 'id';
-                       $table                  = 
"fm_entity_{$values['entity_id']}_{$values['id']}";
 
-                       if(($this->oProc->CreateTable($table,array('fd' => 
$fd,'pk' => $pk,'fk' => $fk,'ix' => array('location_code'),'uc' => array()))))
+                       $ix = array();
+                       
+                       if( $this->type == 'entity' )
                        {
+                               $ix =  array('location_code');
+                       }
 
-                               $values_insert= array(
+                       $table                  = 
"fm_{$this->type}_{$values['entity_id']}_{$values['id']}";
+
+                       if(($this->oProc->CreateTable($table,array('fd' => 
$fd,'pk' => $pk,'fk' => $fk,'ix' => $ix,'uc' => array()))))
+                       {
+
+       /*                      $values_insert= array(
                                        $location_id,
                                        1,
                                        'status',
@@ -356,12 +376,12 @@
                                        'true'
                                        );
 
-                               $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                               $values_insert  = 
$this->db->validate_insert($values_insert);
 
                                $this->db->query("INSERT INTO 
phpgw_cust_attribute 
(location_id,id,column_name,input_text,statustext,datatype,attrib_sort,nullable)
 "
                                        . "VALUES 
($values_insert)",__LINE__,__FILE__);
+       */
 
-
                                $receipt['message'][] = array('msg'     => 
lang('table %1 has been saved',$table));
                                $this->db->transaction_commit();
                        }
@@ -374,7 +394,7 @@
                                }
                                else
                                {
-                                       $this->db->query("DELETE FROM 
fm_entity_category WHERE id=" . $values['id'] . " AND entity_id=" . 
$values['entity_id'],__LINE__,__FILE__);
+                                       $this->db->query("DELETE FROM 
fm_{$this->type}_category WHERE id=" . $values['id'] . " AND entity_id=" . 
$values['entity_id'],__LINE__,__FILE__);
                                        unset($receipt['id']);
                                }
                        }
@@ -391,7 +411,7 @@
 
                        if (!$receipt['error'])
                        {
-                               $table = 'fm_entity';
+                               $table = "fm_{$this->type}";
 
                                $entity['name'] = 
$this->db->db_addslashes($entity['name']);
                                $entity['descr'] = 
$this->db->db_addslashes($entity['descr']);
@@ -409,31 +429,31 @@
                                'documentation' => $entity['documentation']
                                );
 
-                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = 
$this->db->validate_update($value_set);
 
                                $this->db->transaction_begin();
 
                                $this->db->query("UPDATE $table set $value_set 
WHERE id=" . $entity['id'],__LINE__,__FILE__);
 
-                               
$GLOBALS['phpgw']->locations->update_description(".entity.{$entity['id']}", 
$entity['name'], 'property');
+                               
$GLOBALS['phpgw']->locations->update_description(".{$this->type}.{$entity['id']}",
 $entity['name'],  $this->type_app[$this->type]);
 
-                               $this->db->query("DELETE FROM fm_entity_lookup 
WHERE type='lookup' AND entity_id=" . $entity['id'],__LINE__,__FILE__);
+                               $this->db->query("DELETE FROM 
fm_{$this->type}_lookup WHERE type='lookup' AND entity_id=" . 
$entity['id'],__LINE__,__FILE__);
                                if (isset($entity['include_entity_for']) AND 
is_array($entity['include_entity_for']))
                                {
                                        foreach($entity['include_entity_for'] 
as $location)
                                        {
-                                               $this->db->query("INSERT INTO 
fm_entity_lookup (entity_id,location,type)"
+                                               $this->db->query("INSERT INTO 
fm_{$this->type}_lookup (entity_id,location,type)"
                                                . "VALUES (" .$entity['id'] . 
",'$location','lookup' )",__LINE__,__FILE__);
                                        }
                                }
 
-                               $this->db->query("DELETE FROM fm_entity_lookup 
WHERE type='start' AND entity_id=" . $entity['id'],__LINE__,__FILE__);
+                               $this->db->query("DELETE FROM 
fm_{$this->type}_lookup WHERE type='start' AND entity_id=" . 
(int)$entity['id'],__LINE__,__FILE__);
 
                                if (isset($entity['start_entity_from']) AND 
is_array($entity['start_entity_from']))
                                {
                                        foreach($entity['start_entity_from'] as 
$location)
                                        {
-                                               $this->db->query("INSERT INTO 
fm_entity_lookup (entity_id,location,type)"
+                                               $this->db->query("INSERT INTO 
fm_{$this->type}_lookup (entity_id,location,type)"
                                                . "VALUES (" .$entity['id'] . 
",'$location','start' )",__LINE__,__FILE__);
                                        }
                                }
@@ -460,7 +480,7 @@
 
                        if (!isset($receipt['error']))
                        {
-                               $table = 'fm_entity_category';
+                               $table = "fm_{$this->type}_category";
 
                                $entity['name'] = 
$this->db->db_addslashes($entity['name']);
                                $entity['descr'] = 
$this->db->db_addslashes($entity['descr']);
@@ -475,14 +495,15 @@
                                        'fileupload'    => 
$entity['fileupload'],
                                        'loc_link'              => 
$entity['loc_link'],
                                        'start_project' => 
$entity['start_project'],
-                                       'start_ticket'  => 
$entity['start_ticket']
+                                       'start_ticket'  => 
$entity['start_ticket'],
+                                       'jasperupload'  => 
$entity['jasperupload']
                                        );
 
-                               $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = 
$this->db->validate_update($value_set);
 
                                $this->db->query("UPDATE $table set $value_set 
WHERE entity_id=" . $entity['entity_id']. " AND id=" . 
$entity['id'],__LINE__,__FILE__);
 
-                               
$GLOBALS['phpgw']->locations->update_description(".entity.{$entity['entity_id']}.{$entity['id']}",
 $entity['name'], 'property');
+                               
$GLOBALS['phpgw']->locations->update_description(".{$this->type}.{$entity['entity_id']}.{$entity['id']}",
 $entity['name'],  $this->type_app[$this->type]);
 
                                $receipt['message'][] = array('msg'=> 
lang('entity has been edited'));
                        }
@@ -496,17 +517,18 @@
 
                function delete_entity($id)
                {
+                       $id = (int) $id;
                        
$category_list=$this->read_category(array('entity_id'=>$id));
                        $locations = array();
-                       $locations[] = 
$GLOBALS['phpgw']->locations->get_id('property', ".entity.{$id}");
-                       $subs = 
$GLOBALS['phpgw']->locations->get_subs('property', ".entity.{$id}");
+                       $locations[] = $GLOBALS['phpgw']->locations->get_id( 
$this->type_app[$this->type], ".{$this->type}.{$id}");
+                       $subs = $GLOBALS['phpgw']->locations->get_subs( 
$this->type_app[$this->type], ".{$this->type}.{$id}");
                        if (is_array($subs) && count($subs))
                        {
                                $locations = array_merge($locations, 
array_keys($subs));
                        }
 
-                       $this->db->query("DELETE FROM fm_entity WHERE 
id={$id}",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_entity_category WHERE 
entity_id={$id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_{$this->type} WHERE 
id={$id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_{$this->type}_category 
WHERE entity_id={$id}",__LINE__,__FILE__);
                        $this->db->query('DELETE FROM phpgw_cust_attribute 
WHERE location_id IN (' . implode(',', $locations) . ')',__LINE__,__FILE__);
                        $this->db->query('DELETE FROM phpgw_locations WHERE 
location_id IN (' . implode(',', $locations) . ')',__LINE__,__FILE__);
                        $this->db->query('DELETE FROM phpgw_acl WHERE 
location_id IN (' . implode(',', $locations) . ')',__LINE__,__FILE__);
@@ -516,7 +538,7 @@
 
                                foreach($category_list as $entry)
                                {
-                                       $this->oProc->DropTable('fm_entity_' . 
$id . '_' . $entry['id']);
+                                       
$this->oProc->DropTable("fm_{$this->type}_{$id}_{$entry['id']}");
                                }
                        }
 
@@ -528,23 +550,23 @@
 
                        $this->db->transaction_begin(); 
 
-                       $this->oProc->DropTable('fm_entity_' . $entity_id . '_' 
. $id);
+                       
$this->oProc->DropTable("fm_{$this->type}_{$entity_id}_{$id}");
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".entity.{$entity_id}.{$id}");
+                       $location_id = $GLOBALS['phpgw']->locations->get_id( 
$this->type_app[$this->type], ".{$this->type}.{$entity_id}.{$id}");
 
-                       $this->db->query("DELETE FROM fm_entity_category WHERE 
entity_id= $entity_id AND id= $id",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_{$this->type}_category 
WHERE entity_id= {$entity_id} AND id= {$id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM phpgw_cust_attribute 
WHERE location_id = {$location_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM phpgw_locations WHERE 
location_id  = {$location_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM phpgw_acl WHERE  
location_id  = {$location_id}",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_entity_history WHERE 
history_appname = 'entity_{$entity_id}_{$id}'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_{$this->type}_history 
WHERE history_appname = '{$this->type}_{$entity_id}_{$id}'",__LINE__,__FILE__);
 
                        $this->db->transaction_commit();
                }
 
                function get_table_def($entity_id,$cat_id)
                {
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
-                       $table = 'fm_entity_' . $entity_id . '_' . $cat_id;
+                       $location_id = $GLOBALS['phpgw']->locations->get_id( 
$this->type_app[$this->type], ".{$this->type}.{$entity_id}.{$cat_id}");
+                       $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";
                        $metadata = $this->db->metadata($table);
 
                        if(isset($this->db->adodb))
@@ -600,7 +622,7 @@
 
                function delete_history($entity_id, $cat_id, $attrib_id)
                {
-                       $this->db->query("DELETE FROM fm_entity_history WHERE 
history_appname = 'entity_" . $entity_id  . '_' . $cat_id . "' AND 
history_attrib_id = $attrib_id",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_{$this->type}_history 
WHERE history_appname = '{$this->type}_{$entity_id}_{$cat_id}' AND 
history_attrib_id = {$attrib_id}",__LINE__,__FILE__);
                }
 
                function init_process()

Modified: 
people/sigurdne/modules/property/trunk/inc/class.soadmin_location.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soadmin_location.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soadmin_location.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,14 +34,12 @@
 
        class property_soadmin_location
        {
-               function property_soadmin_location()
+               function __construct()
                {
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-
-                       $this->join             = $this->bocommon->join;
-                       $this->like             = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function reset_fm_cache()
@@ -59,7 +57,6 @@
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
-
                        }
                        else
                        {
@@ -169,22 +166,26 @@
                function read_single($id)
                {
 
+                       $id = (int) $id;
                        $table = 'fm_location_type';
 
-                       $sql = "SELECT * FROM $table  where id='$id'";
+                       $sql = "SELECT * FROM $table  where id={$id}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $standard = array();
                        if ($this->db->next_record())
                        {
-                               $standard['id']                 = 
$this->db->f('id');
-                               $standard['name']               = 
$this->db->f('name');
-                               $standard['descr']              = 
$this->db->f('descr');
-                               $standard['list_info']  = 
unserialize($this->db->f('list_info'));
-                               $standard['list_address']       = 
$this->db->f('list_address');
-
-                               return $standard;
+                               $standard = array
+                               (
+                                       'id'                    => 
$this->db->f('id'),
+                                       'name'                  => 
$this->db->f('name'),
+                                       'descr'                 => 
$this->db->f('descr'),
+                                       'list_info'             => 
$this->db->f('list_info',true),
+                                       'list_address'  => 
$this->db->f('list_address')
+                               );
                        }
+                       return $standard;
                }
 
                function add($standard)
@@ -193,7 +194,7 @@
                        $standard['name'] = 
$this->db->db_addslashes($standard['name']);
                        $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);
 
-                       $standard['id'] = 
$this->bocommon->next_id('fm_location_type');
+                       $standard['id'] = 
$this->db->next_id('fm_location_type');
 
                        $receipt['id']= $standard['id'];
 
@@ -271,7 +272,7 @@
                        $default_attrib['column_name'][]= 'remark';
                        $default_attrib['type'][]='T';
                        $default_attrib['precision'][] = false;
-                       $default_attrib['nullable'][] ='false';
+                       $default_attrib['nullable'][] ='True';
                        $default_attrib['input_text'][] ='Remark';
                        $default_attrib['statustext'][] ='Remark';
                        $default_attrib['attrib_sort'][] =2;
@@ -288,6 +289,40 @@
                        $default_attrib['attrib_sort'][] ='';
                        $default_attrib['custom'][] ='';
 
+                       $j++;
+                       $default_attrib['id'][]= $j;
+                       $default_attrib['column_name'][]= 'area_gross';
+                       $default_attrib['type'][]='N';
+                       $default_attrib['precision'][] = false;
+                       $default_attrib['nullable'][] ='True';
+                       $default_attrib['input_text'][] ='gross area';
+                       $default_attrib['statustext'][] ='Sum of the areas 
included within the outside face of the exterior walls of a building.';
+                       $default_attrib['attrib_sort'][] =3;
+                       $default_attrib['custom'][] =1;
+
+                       $j++;
+                       $default_attrib['id'][]= $j;
+                       $default_attrib['column_name'][]= 'area_net';
+                       $default_attrib['type'][]='N';
+                       $default_attrib['precision'][] = false;
+                       $default_attrib['nullable'][] ='True';
+                       $default_attrib['input_text'][] ='Net area';
+                       $default_attrib['statustext'][] ='The wall-to-wall 
floor area of a room.';
+                       $default_attrib['attrib_sort'][] =4;
+                       $default_attrib['custom'][] =1;
+
+                       $j++;
+                       $default_attrib['id'][]= $j;
+                       $default_attrib['column_name'][]= 'area_usable';
+                       $default_attrib['type'][]='N';
+                       $default_attrib['precision'][] = false;
+                       $default_attrib['nullable'][] ='True';
+                       $default_attrib['input_text'][] ='Usable area';
+                       $default_attrib['statustext'][] ='Generally measured 
from "paint to paint" inside the permanent walls and to the middle of 
partitions separating rooms.';
+                       $default_attrib['attrib_sort'][] =5;
+                       $default_attrib['custom'][] =1;
+
+
                        $fd=array();
                        $fd['location_code'] = array('type' => 'varchar', 
'precision' => 25, 'nullable' => false);
 
@@ -334,6 +369,9 @@
                        $fd['remark'] = array('type' => 'text', 'nullable' => 
true);
                        $fd['status'] = array('type' => 'int', 'precision' => 
4, 'nullable' => true);
                        $fd['change_type'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => true);
+                       $fd['area_gross'] = array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00');
+                       $fd['area_net'] = array('type' => 'decimal','precision' 
=> '20','scale' => '2','nullable' => True,'default' => '0.00');
+                       $fd['area_usable'] = array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00');
 
                        $ix = array('location_code');
                        $uc = array();
@@ -341,7 +379,7 @@
                        $fd_history = $fd;
                        $fd_history['exp_date'] = array('type' => 
'timestamp','nullable' => true,'default' => 'current_timestamp');
 
-                       
$add_columns_in_tables=array('fm_project','fm_tts_tickets','fm_request','fm_document','fm_investment');
+                       $add_columns_in_tables = $this->get_tables_to_alter();
 
                        $this->db->transaction_begin();
 
@@ -364,6 +402,7 @@
                                        
$this->oProc->AddColumn($add_columns_in_tables[$i],'loc'. $standard['id'], 
array('type' => 'varchar', 'precision' => 4, 'nullable' => true));
                                }
 
+
                                $values_insert= array(
                                        $standard['id'],
                                        $standard['name'],
@@ -373,7 +412,7 @@
                                    $this->db->db_addslashes(implode(',',$uc)),
                                        );
 
-                               $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                               $values_insert  = 
$this->db->validate_insert($values_insert);
 
                                $this->db->query("INSERT INTO fm_location_type 
(id,name, descr,pk,ix,uc) "
                                        . "VALUES 
($values_insert)",__LINE__,__FILE__);
@@ -395,7 +434,7 @@
                                                $default_attrib['nullable'][$i]
                                                );
 
-                                       $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                                       $values_insert  = 
$this->db->validate_insert($values_insert);
 
                                        $this->db->query("INSERT INTO 
phpgw_cust_attribute 
(location_id,id,column_name,datatype,precision_,input_text,statustext,attrib_sort,custom,nullable)
 "
                                                . "VALUES 
($values_insert)",__LINE__,__FILE__);
@@ -433,6 +472,22 @@
                        return $receipt;
                }
 
+               function get_tables_to_alter()
+               {
+                       $tables = 
array('fm_project','fm_tts_tickets','fm_request','fm_document','fm_investment');
+                       $entity                 = 
CreateObject('property.soadmin_entity');
+                       $entity_list    = $entity->read(array('allrows' => 
true));
+                       foreach($entity_list as $entry)
+                       {
+                               $cat_list = 
$entity->read_category(array('allrows'=>true,'entity_id'=>$entry['id']));
+                               foreach($cat_list as $category)
+                               {
+                                       $tables[] = 
"fm_entity_{$entry['id']}_{$category['id']}";
+                               }
+                       }
+                       return $tables;
+               }
+
                function edit($values)
                {
 
@@ -445,7 +500,7 @@
                                'list_address'  => 
(isset($values['list_address'])?$values['list_address']:''),
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE $table SET $value_set WHERE 
id='" . $values['id']. "'",__LINE__,__FILE__);
 
@@ -457,8 +512,10 @@
 
                function delete($id)
                {
+                       $tables_to_drop_from = $this->get_tables_to_alter();
+                       
+                       $receipt = array();
                        $this->init_process();
-                       $this->oProc->m_odb->transaction_begin();
                        $this->db->transaction_begin();
 
                        $table          = 'fm_location_type';
@@ -467,17 +524,19 @@
                        if($this->db->f('id') > $id)
                        {
                                $this->db->transaction_abort();
-                               $this->oProc->m_odb->transaction_abort();
                                $receipt['error'][] = array('msg' => 
lang('please delete from the bottom'));
-                               
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
-
-                               return;
+                               return $receipt;
                        }
 
                        $this->oProc->DropTable('fm_location' . $id);
                        $this->oProc->DropTable('fm_location' . $id . 
'_category');
                        $this->oProc->DropTable('fm_location' . $id . 
'_history');
 
+                       foreach($tables_to_drop_from as $entry)
+                       {
+                               $this->oProc->DropColumn($entry 
,array(),"loc{$id}");
+                       }
+
                        $attrib_table   = 'phpgw_cust_attribute';
                        $choice_table   = 'phpgw_cust_choice';
                        $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$id}");
@@ -486,16 +545,22 @@
                        $this->db->query("DELETE FROM {$choice_table} WHERE 
location_id = {$location_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM {$table} WHERE id=" . 
(int)$id,__LINE__,__FILE__);
 
-                       $this->db->transaction_commit();
-                       $this->oProc->m_odb->transaction_commit();
+                       if($this->db->transaction_commit())
+                       {
+                               $receipt['message'][] = array('msg' => 
lang('location at level %1 has been deleted', $id));
+                       }
+                       else
+                       {
+                               $receipt['error'][] = array('msg' => lang('the 
process failed'));                       
+                       }
+                       return $receipt;
                }
 
 
-
                function init_process()
                {
                        $this->oProc                            = 
CreateObject('phpgwapi.schema_proc',$GLOBALS['phpgw_info']['server']['db_type']);
-                       $this->oProc->m_odb                     = $this->db;
+                       $this->oProc->m_odb                     = & $this->db;
                        $this->oProc->m_odb->Halt_On_Error      = 'yes';
                }
 
@@ -519,7 +584,7 @@
 //_debug_array($history_table_def);
                        if(!($location_type==$values[$column_name]))
                        {
-                               $id = 
$this->bocommon->next_id('phpgw_cust_attribute',array('location_id' => 
$location_id));
+                               $id = 
$this->db->next_id('phpgw_cust_attribute',array('location_id' => $location_id));
 
                                $this->init_process();
 
@@ -556,7 +621,7 @@
                                                ''
                                        );
 
-                                       $values = 
$this->bocommon->validate_db_insert($values);
+                                       $values = 
$this->db->validate_insert($values);
 
                                        $this->db->query("INSERT INTO 
phpgw_cust_attribute (location_id,id,column_name, input_text, 
statustext,datatype,precision_,scale,default_value,nullable,custom) "
                                                . "VALUES 
($values)",__LINE__,__FILE__);
@@ -585,6 +650,11 @@
                }
 
 
+               function get_location_type()
+               {
+                       return $this->select_location_type();
+               }
+
                function select_location_type()
                {
                        $this->db->query("SELECT * FROM fm_location_type ORDER 
BY id ");

Modified: people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soagreement.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -36,13 +36,12 @@
        {
                var $role;
 
-               function property_soagreement()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db           = $this->bocommon->new_db();
-                       $this->db2           = 
$this->bocommon->new_db($this->db);
+                       $this->db           = clone($GLOBALS['phpgw']->db);
+                       $this->db2          = clone($this->db);
 
                        $this->join                     = $this->bocommon->join;
                        $this->left_join        = $this->bocommon->left_join;
@@ -255,9 +254,11 @@
 
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
+                               $query = $this->db->db_addslashes($query);
 
+                               $querymethod[]= "fm_branch.descr {$this->like} 
'%{$query}%'";
+                               $querymethod[]= "{$entity_table}.name 
{$this->like} '%{$query}%'";
+
                                $this->db->query("SELECT * FROM 
$attribute_table WHERE search='1' AND $attribute_filter ");
 
                                while ($this->db->next_record())
@@ -280,7 +281,6 @@
                        }
 
                        $sql .= " $filtermethod $querymethod";
-//echo $sql;
 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -391,6 +391,7 @@
                                $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
                                $agreement_id   = 
(isset($data['agreement_id'])?$data['agreement_id']:'');
                        }
+$allrows = true; // return all..
 
                        $entity_table = 'fm_activity_price_index';
 

Modified: people/sigurdne/modules/property/trunk/inc/class.soalarm.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soalarm.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soalarm.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,14 +34,12 @@
 
        class property_soalarm
        {
-               function property_soalarm()
+               function __construct()
                {
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->socommon         = 
CreateObject('property.socommon');
-                       $this->db           = $this->socommon->new_db();
-
-                       $this->join                     = $this->socommon->join;
-                       $this->like                     = $this->socommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function select_method_list()

Modified: people/sigurdne/modules/property/trunk/inc/class.soasync.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soasync.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soasync.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,43 +34,32 @@
 
        class property_soasync
        {
-               function property_soasync()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read($data)
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
-                               }
-                               else
-                               {
-                                       $start=0;
-                               }
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
+                               $start  = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                               $query  = isset($data['query']) ? 
$data['query'] : '';
+                               $sort   = isset($data['sort']) && $data['sort'] 
? $data['sort'] : 'DESC';
+                               $order  = isset($data['order']) ? 
$data['order'] : '';
+                               $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
                        }
 
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
-
+                               $ordermethod = " ORDER BY $order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by id asc';
+                               $ordermethod = ' ORDER BY id asc';
                        }
 
                        $table='fm_async_method';
@@ -78,26 +67,33 @@
                        $querymethod = '';
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
-                               $querymethod = " where id $this->like 
'%$query%' or descr $this->like '%$query%'";
+                               $query = $this->db->db_addslashes($query);
+                               $querymethod = " WHERE name $this->like 
'%$query%' OR data $this->like '%$query%' OR descr $this->like '%$query%'";
                        }
 
                        $sql = "SELECT * FROM $table $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
+
+                       if(!$allrows)
+                       {
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
 
+                       $method = array();
                        while ($this->db->next_record())
                        {
                                $method[] = array
                                (
                                        'id'    => $this->db->f('id'),
-                                       'name'  => $this->db->f('name'),
-                                       'data'  => $this->db->f('data'),
-                                       'descr' => $this->db->f('descr')
+                                       'name'  => $this->db->f('name',true),
+                                       'data'  => $this->db->f('data',true),
+                                       'descr' => $this->db->f('descr',true)
                                );
                        }
                        return $method;
@@ -106,36 +102,43 @@
 
                function read_single($id)
                {
+                       $id = (int) $id;
+
                        $table='fm_async_method';
 
-                       $sql = "SELECT * FROM $table  where id='$id'";
+                       $sql = "SELECT * FROM {$table} WHERE id={$id}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $method = array();
                        if ($this->db->next_record())
                        {
                                $method['id']           = $this->db->f('id');
-                               $method['name']         = $this->db->f('name');
-                               $method['data']         = $this->db->f('data');
-                               $method['descr']        = $this->db->f('descr');
-
-                               return $method;
+                               $method['name']         = $this->db->f('name', 
true);
+                               $method['data']         = $this->db->f('data', 
true);
+                               $method['descr']        = $this->db->f('descr', 
true);
                        }
+                       return $method;
                }
 
                function add($method)
                {
+                       $receipt = array();
                        $table='fm_async_method';
 
-                       $method['id'] = $this->bocommon->next_id($table);
+                       $this->db->transaction_begin();
+                       $method['id'] = $this->db->next_id($table);
                        $method['name'] = 
$this->db->db_addslashes($method['name']);
                        $method['descr'] = 
$this->db->db_addslashes($method['descr']);
 
                        $this->db->query("INSERT INTO $table (id, name,data, 
descr) "
                                . "VALUES ('" . $method['id'] . "','" . 
$method['name'] . "','" . $method['data'] . "','" . $method['descr']. 
"')",__LINE__,__FILE__);
 
+                       if( $this->db->transaction_commit() )
+                       {
                        $receipt['id'] = $method['id'];
                        $receipt['message'][] = array('msg' => lang('async 
method has been saved'));
+                       }
 
                        return $receipt;
                }

Modified: people/sigurdne/modules/property/trunk/inc/class.sob_account.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sob_account.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sob_account.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,32 +34,23 @@
 
        class property_sob_account
        {
-               function property_sob_account()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  =       
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon = CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->like             = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read($data)
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
-                               }
-                               else
-                               {
-                                       $start=0;
-                               }
-                               $query          = 
(isset($data['query'])?$data['query']:'');
-                               $sort           = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order          = 
(isset($data['order'])?$data['order']:'');
-                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                               $query          = 
isset($data['query'])?$data['query']:'';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
+                               $order          = 
isset($data['order'])?$data['order']:'';
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                        }
 
                        if ($order)
@@ -76,16 +67,14 @@
 
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
+                               $query = $this->db->db_addslashes($query);
                                $querymethod = " where id $this->like 
'%$query%' or descr $this->like '%$query%'";
                        }
 
                        $sql = "SELECT * FROM $table $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {

Modified: people/sigurdne/modules/property/trunk/inc/class.sobudget.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sobudget.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sobudget.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,43 +34,70 @@
 
        class property_sobudget
        {
-               function property_sobudget()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->cats                                     = 
CreateObject('phpgwapi.categories');
+                       $this->cats->app_name           = 'property.project';
+                       $this->cats->supress_info       = true;
+
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon = CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
+               }
 
-                       $this->join             = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like             = $this->bocommon->like;
+
+               /**
+                * Get a list of categories , included subs
+                *
+                * @param int $cat_id the parent doc-type
+                * @return array parent and children
+                */
+
+               function get_sub_cats($cat_id = 0)
+               {
+                       $cat_ids = array();
+                       if($cat_id)
+                       {
+                               $cat_ids[] = $cat_id;
+                               $cat_sub = 
$this->cats->return_sorted_array($start = 0,$limit = false,$query = '',$sort = 
'',$order = '',$globals = False, $parent_id = $cat_id);
+                               foreach ($cat_sub as $category)
+                               {
+                                       $cat_ids[] = $category['id'];
+                               }
+                       }
+                       return $cat_ids;
                }
 
+
                function read($data)
                {
                        if(is_array($data))
                        {
-                               $start  = 
(isset($data['start'])?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $district_id = 
(isset($data['district_id'])?$data['district_id']:'');
-                               $year = (isset($data['year'])?$data['year']:'');
-                               $grouping = 
(isset($data['grouping'])?$data['grouping']:'');
-                               $revision = 
(isset($data['revision'])?$data['revision']:'');
+                               $start                  = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
+                               $filter                 = 
isset($data['filter']) && $data['filter'] ? $data['filter'] : 'none';
+                               $query                  = isset($data['query']) 
? $data['query'] : '';
+                               $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort'] : 'DESC';
+                               $order                  = isset($data['order']) 
? $data['order'] : '';
+                               $allrows                = 
isset($data['allrows']) ? $data['allrows'] : '';
+                               $district_id    = isset($data['district_id']) ? 
$data['district_id'] : '';
+                               $year                   = isset($data['year']) 
&& $data['year'] ? (int) $data['year'] : 0;
+                               $grouping               = 
isset($data['grouping']) ? $data['grouping'] : '';
+                               $revision               = 
isset($data['revision']) ? $data['revision'] : '';
+                               $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']: 0;
+                               $dimb_id                        = 
isset($data['dimb_id']) && $data['dimb_id'] ? $data['dimb_id']: 0;
                        }
 
+                       $cat_ids = $this->get_sub_cats($cat_id);
+
+
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
+                               $ordermethod = " ORDER BY $order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by id DESC';
+                               $ordermethod = ' ORDER BY id DESC';
                        }
 
 
@@ -90,7 +117,7 @@
                        }
                        if ($grouping > 0)
                        {
-                               $filtermethod .= " $where category='$grouping' 
";
+                               $filtermethod .= " $where 
fm_b_account.category='$grouping' ";
                                $where = 'AND';
 
                        }
@@ -101,20 +128,30 @@
 
                        }
 
-                       if($query)
+                       if ($cat_ids && is_array($cat_ids))
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
+                               $filtermethod .= " $where fm_budget.category IN 
(". implode(',', $cat_ids) . ')';
+                               $where = 'AND';
+                       }
 
-                               $querymethod = " $where ( descr $this->like 
'%$query%')";
+                       if ($dimb_id > 0)
+                       {
+                               $filtermethod .= " $where 
fm_budget.ecodimb={$dimb_id}";
+                               $where = 'AND';
                        }
 
+                       if($query)
+                       {
+                               $query = $this->db->db_addslashes($query);
+                               $querymethod = " $where ( descr $this->like 
'%$query%') OR fm_budget.b_account_id='$query'";
+                       }
 
-                       $sql = "SELECT fm_budget.*, descr,category FROM 
fm_budget $this->join fm_b_account ON fm_budget.b_account_id = fm_b_account.id 
$filtermethod $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $sql = "SELECT fm_budget.*, fm_budget.category as 
cat_id, ecodimb, descr,fm_b_account.category as grouping FROM fm_budget 
$this->join fm_b_account ON fm_budget.b_account_id = fm_b_account.id 
$filtermethod $querymethod";
 
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
+
                        if(!$allrows)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -124,20 +161,23 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
+                       $budget = array();
                        while ($this->db->next_record())
                        {
                                $budget[] = array
                                (
                                        'budget_id'             => 
$this->db->f('id'),
                                        'year'                  => 
$this->db->f('year'),
-                                       'grouping'              => 
$this->db->f('category'),
+                                       'grouping'                      => 
$this->db->f('grouping'),
                                        'b_account_id'          => 
$this->db->f('b_account_id'),
                                        'b_account_name'        => 
$this->db->f('descr'),
                                        'district_id'           => 
$this->db->f('district_id'),
                                        'revision'              => 
$this->db->f('revision'),
                                        'budget_cost'           => 
$this->db->f('budget_cost'),
                                        'entry_date'            => 
$this->db->f('entry_date'),
-                                       'user'                  => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
+                                       'ecodimb'                       => 
$this->db->f('ecodimb'),
+                                       'cat_id'                        => 
$this->db->f('cat_id'),
+               //                      'user'                          => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
                                );
                        }
                        return $budget;
@@ -147,16 +187,16 @@
                {
                        if(is_array($data))
                        {
-                               $start  = 
(isset($data['start'])?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $district_id = 
(isset($data['district_id'])?$data['district_id']:'');
-                               $year = (isset($data['year'])?$data['year']:'');
-                               $grouping = 
(isset($data['grouping'])?$data['grouping']:'');
-                               $revision = 
(isset($data['revision'])?$data['revision']:'');
+                               $start                  = isset($data['start']) 
&& $data['start'] ? $data['start']:0;
+                               $filter                 = 
isset($data['filter']) && $data['filter'] ?$data['filter']:'none';
+                               $query                  = 
isset($data['query'])?$data['query']:'';
+                               $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
+                               $order                  = 
isset($data['order'])?$data['order']:'';
+                               $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
+                               $district_id    = 
isset($data['district_id'])?$data['district_id']:'';
+                               $year                   = 
isset($data['year'])?$data['year']:'';
+                               $grouping               = 
isset($data['grouping'])?$data['grouping']:'';
+                               $revision               = 
isset($data['revision'])?$data['revision']:'';
                        }
 
                        if ($order)
@@ -198,17 +238,15 @@
 
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
+                               $query = $this->db->db_addslashes($query);
                        //      $querymethod = " $where ( descr $this->like 
'%$query%')";
                        }
 
 
                        $sql = "SELECT * FROM fm_budget_basis $filtermethod 
$querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -219,6 +257,7 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
+                       $budget = array();
                        while ($this->db->next_record())
                        {
                                $budget[] = array
@@ -230,7 +269,9 @@
                                        'revision'              => 
$this->db->f('revision'),
                                        'budget_cost'           => 
$this->db->f('budget_cost'),
                                        'entry_date'            => 
$this->db->f('entry_date'),
-                                       'user'                  => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
+                                       'ecodimb'                       => 
$this->db->f('ecodimb'),
+                                       'cat_id'                        => 
$this->db->f('category'),
+                       //              'user'                  => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
                                );
                        }
                        return $budget;
@@ -238,19 +279,26 @@
 
                function read_single_basis($budget_id)
                {
-                       $this->db->query("select * from fm_budget_basis where 
id='$budget_id'",__LINE__,__FILE__);
+                       $budget_id = (int) $budget_id;
+                       $this->db->query("SELECT * FROM fm_budget_basis WHERE 
id = {$budget_id}",__LINE__,__FILE__);
 
+                       $budget = array();
                        if ($this->db->next_record())
                        {
-                               $budget['id']                   = 
(int)$this->db->f('id');
-                               $budget['year']                 = 
$this->db->f('year');
-                               $budget['district_id']          = 
$this->db->f('district_id');
-                               $budget['revision']             = 
$this->db->f('revision');
-                               $budget['b_group']              = 
$this->db->f('b_group');
-                               $budget['remark']               = 
stripslashes($this->db->f('remark'));
-                               $budget['budget_cost']          = 
$this->db->f('budget_cost');
-                               $budget['entry_date']           = 
$this->db->f('entry_date');
-                               $budget['distribute_year']      = 
unserialize($this->db->f('distribute_year'));
+                               $budget = array
+                               (
+                                       'id'                            => 
$budget_id,
+                                       'year'                          => 
$this->db->f('year'),
+                                       'district_id'           => 
$this->db->f('district_id'),
+                                       'revision'                      => 
$this->db->f('revision'),
+                                       'b_group'                       => 
$this->db->f('b_group'),
+                                       'remark'                        => 
$this->db->f('remark',true),
+                                       'budget_cost'           => 
$this->db->f('budget_cost'),
+                                       'entry_date'            => 
$this->db->f('entry_date'),
+                                       'distribute_year'       => 
unserialize($this->db->f('distribute_year')),
+                                       'ecodimb'                       => 
$this->db->f('ecodimb'),
+                                       'cat_id'                        => 
$this->db->f('category')
+                               );
                        }
 
                        return $budget;
@@ -276,7 +324,7 @@
 
                        if(!$receipt['error'])
                        {
-                               $id = 
$this->bocommon->next_id('fm_budget_basis');
+                               $id = $this->db->next_id('fm_budget_basis');
 
                                $values= array(
                                        $id,
@@ -288,13 +336,15 @@
                                        $budget['district_id'],
                                        $budget['b_group'],
                                        $budget['budget_cost'],
-                                       serialize($budget['distribute_year'])
+                                       serialize($budget['distribute_year']),
+                                       $budget['ecodimb'],
+                                       $budget['cat_id']
                                        );
 
-                               $values = 
$this->bocommon->validate_db_insert($values);
+                               $values = $this->db->validate_insert($values);
 
 
-                               $this->db->query("INSERT INTO fm_budget_basis 
(id,entry_date,remark,user_id,year,revision,district_id,b_group,budget_cost,distribute_year)"
+                               $this->db->query("INSERT INTO fm_budget_basis 
(id,entry_date,remark,user_id,year,revision,district_id,b_group,budget_cost,distribute_year,ecodimb,category)"
                                        . "VALUES ($values)",__LINE__,__FILE__);
 
                                $receipt['budget_id']= $id;
@@ -311,14 +361,17 @@
 
                        $budget['remark'] = 
$this->db->db_addslashes($budget['remark']);
 
-                       $value_set=array(
+                       $value_set=array
+                       (
                                'remark'        => $budget['remark'],
                                'entry_date'    => time(),
                                'budget_cost'   => $budget['budget_cost'],
-                               'distribute_year' => 
serialize($budget['distribute_year'])
+                               'distribute_year'       => 
serialize($budget['distribute_year']),
+                               'ecodimb'                       => 
$budget['ecodimb'],
+                               'category'                      => 
$budget['cat_id'],
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->transaction_begin();
                        $this->db->query("UPDATE fm_budget_basis set $value_set 
WHERE id=" . intval($budget['budget_id']),__LINE__,__FILE__);
@@ -339,16 +392,22 @@
                {
                        $this->db->query("select * from fm_budget where 
id='$budget_id'",__LINE__,__FILE__);
 
+                       $budget = array();
                        if ($this->db->next_record())
                        {
-                               $budget['id']                   = 
(int)$this->db->f('id');
-                               $budget['year']                 = 
$this->db->f('year');
-                               $budget['district_id']          = 
$this->db->f('district_id');
-                               $budget['revision']             = 
$this->db->f('revision');
-                               $budget['b_account_id']         = 
$this->db->f('b_account_id');
-                               $budget['remark']       = 
stripslashes($this->db->f('remark'));
-                               $budget['budget_cost']  = 
$this->db->f('budget_cost');
-                               $budget['entry_date']   = 
$this->db->f('entry_date');
+                               $budget = array
+                               (
+                                       'id'                    => 
(int)$this->db->f('id'),
+                                       'year'                  => 
$this->db->f('year'),
+                                       'district_id'   => 
$this->db->f('district_id'),
+                                       'revision'              => 
$this->db->f('revision'),
+                                       'b_account_id'  => 
$this->db->f('b_account_id'),
+                                       'remark'                => 
$this->db->f('remark', true),
+                                       'budget_cost'   => 
$this->db->f('budget_cost'),
+                                       'entry_date'    => 
$this->db->f('entry_date'),
+                                       'ecodimb'                       => 
$this->db->f('ecodimb'),
+                                       'cat_id'                        => 
$this->db->f('category')
+                               );
                        }
 
                        return $budget;
@@ -356,11 +415,17 @@
 
                function add($budget)
                {
+                       $receipt = array();
                        $budget['remark'] = 
$this->db->db_addslashes($budget['remark']);
 
                        $this->db->transaction_begin();
 
-                       $sql = "SELECT id FROM fm_budget WHERE year ='" . 
$budget['year'] . "'  AND b_account_id ='" . $budget['b_account_id'] . "' AND 
revision = '" . $budget['revision'] . "' AND district_id='" . 
$budget['district_id'] . "'";
+                       if($budget['district_id'])
+                       {
+                               $district_filter =  "AND 
district_id='{$budget['district_id']}";
+                       }
+                       $sql = "SELECT id FROM fm_budget WHERE year 
='{$budget['year']}' AND b_account_id ='{$budget['b_account_id']}' AND revision 
= '{$budget['revision']}' {$district_filter}";
+
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        if($this->db->next_record())
@@ -370,7 +435,7 @@
 
                        if(!$receipt['error'])
                        {
-                               $id = $this->bocommon->next_id('fm_budget');
+                               $id = $this->db->next_id('fm_budget');
 
                                $values= array(
                                        $id,
@@ -382,11 +447,13 @@
                                        $budget['district_id'],
                                        $budget['b_account_id'],
                                        $budget['budget_cost'],
+                                       $budget['ecodimb'],
+                                       $budget['cat_id']
                                        );
 
-                               $values = 
$this->bocommon->validate_db_insert($values);
+                               $values = $this->db->validate_insert($values);
 
-                               $this->db->query("INSERT INTO fm_budget 
(id,entry_date,remark,user_id,year,revision,district_id,b_account_id,budget_cost)"
+                               $this->db->query("INSERT INTO fm_budget 
(id,entry_date,remark,user_id,year,revision,district_id,b_account_id,budget_cost,ecodimb,category)"
                                        . "VALUES ($values)",__LINE__,__FILE__);
 
                                $receipt['budget_id']= $id;
@@ -400,20 +467,24 @@
 
                function edit($budget)
                {
+                       $receipt = array();
                        $budget['remark'] = 
$this->db->db_addslashes($budget['remark']);
 
                        $this->db->transaction_begin();
 
-                       $value_set=array(
+                       $value_set = array
+                       (
                                'remark'        => $budget['remark'],
                                'entry_date'    => time(),
                                'budget_cost'   => $budget['budget_cost'],
                                'year'                  => $budget['year'],
                                'revision'              => $budget['revision'],
                                'district_id'   => $budget['district_id'],
+                               'ecodimb'               => $budget['ecodimb'],
+                               'category'              => $budget['cat_id']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE fm_budget set $value_set WHERE 
id=" . intval($budget['budget_id']),__LINE__,__FILE__);
 
@@ -424,29 +495,39 @@
                        return $receipt;
                }
 
-
-
                function read_obligations($data)
                {
+//_debug_array($data);                 
                        if(is_array($data))
                        {
-                               $start  = (isset($data['start']) && 
$data['start'] ?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $district_id = 
(isset($data['district_id'])?$data['district_id']:'');
-                               $year = (isset($data['year'])?$data['year']:'');
-                               $grouping = 
(isset($data['grouping'])?$data['grouping']:'');
-                               $revision = 
(isset($data['revision'])?$data['revision']:'');
-                               $year = (isset($data['year'])?$data['year']:'');
-                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:'');
+                               $start                  = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
+                               $filter                 = 
isset($data['filter']) ? $data['filter'] : 'none';
+                               $query                  = isset($data['query']) 
? $data['query'] : '';
+                               $sort                   = isset($data['sort']) 
? $data['sort'] : 'DESC';
+                               $order                  = isset($data['order']) 
? $data['order'] : '';
+                               $allrows                = 
isset($data['allrows']) ? $data['allrows'] : '';
+                               $district_id    = isset($data['district_id']) ? 
$data['district_id'] : '';
+                               $year                   = isset($data['year']) 
? (int)$data['year'] : '';
+                               $grouping               = 
isset($data['grouping']) ? $data['grouping'] : '';
+                               $revision               = 
isset($data['revision']) ? $data['revision'] : 1;
+                               $year                   = isset($data['year']) 
? $data['year'] : '';
+                               $cat_id                 = 
isset($data['cat_id']) ? $data['cat_id'] : '';
+                               $details                = 
isset($data['details']) ? $data['details'] : '';
                        }
 
+                       if(!$year)
+                       {
+                               return array();
+                       }
+//_debug_array($allrows);
                        $ordermethod = '';
                        /* 0 => cancelled, 1 => obligation , 2 => paid */
-                       $filtermethod = " WHERE fm_workorder.paid = 1 and 
fm_workorder.vendor_id > 0";
+                       $filtermethod = "WHERE fm_workorder.paid = 1 and 
fm_workorder.vendor_id > 0";
+
+                       $start_date = mktime(1, 1, 1, 1, 1, $year);
+                       $end_date = mktime  (23, 59, 59, 12, 31, $year);
+                       $filtermethod .= " AND fm_workorder.start_date >= 
$start_date AND fm_workorder.start_date <= $end_date";
+
                        $where = 'AND';
 
                        if ($cat_id > 0)
@@ -460,13 +541,7 @@
                                $filtermethod .= " $where district_id=" . 
(int)$district_id;
                                $where = 'AND';
                        }
-/*
-                       if ($year > 0)
-                       {
-                               $filtermethod .= " $where year='$year' ";
-                               $where = 'AND';
-                       }
-*/
+
                        if ($grouping > 0)
                        {
                                $filtermethod .= " $where 
fm_b_account.category='$grouping' ";
@@ -474,39 +549,39 @@
                        }
 
                        $querymethod = '';
-                       if($query)
+/*                     if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
-                       //      $querymethod = " $where ( descr $this->like 
'%$query%')";
+                               $query = $this->db->db_addslashes($query);
                        }
+*/
+                       if( $details )
+                       {
+                               $b_account_field = 'id';
+                       }
+                       else
+                       {
+                               $b_account_field = 'category';
+                       }
 
-
-                       $sql = "SELECT sum(combined_cost) as combined_cost, 
count(fm_workorder.id) as hits, fm_b_account.category as b_group, district_id 
FROM"
-                               . " fm_workorder $this->join fm_b_account ON 
fm_workorder.account_id =fm_b_account.id "
+                       $sql = "SELECT sum(combined_cost) as combined_cost, 
count(fm_workorder.id) as hits, fm_b_account.{$b_account_field} as 
{$b_account_field}, district_id"
+                               . " FROM fm_workorder"
+                               . " $this->join fm_b_account ON 
fm_workorder.account_id =fm_b_account.id "
                                . " $this->join fm_project ON  
fm_workorder.project_id =fm_project.id "
                                . " $this->join fm_location1 ON fm_project.loc1 
= fm_location1.loc1 "
-                               . " $this->join fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id $filtermethod 
$querymethod GROUP BY fm_b_account.category,district_id ";
+                               . " $this->join fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id $filtermethod 
$querymethod GROUP BY fm_b_account.{$b_account_field},district_id ";
 
                        $this->db->query($sql . $ordermethod,__LINE__,__FILE__);
-                       $this->total_records = $this->db->num_rows();
-//_debug_array($sql);
-                       if(!$year)
-                       {
-                               $year = date("Y");
-                       }
 
                        while ($this->db->next_record())
                        {
-                               
$obligations[$this->db->f('b_group')][$this->db->f('district_id')] = 
round($this->db->f('combined_cost'));
-                               
$hits[$this->db->f('b_group')][$this->db->f('district_id')] = 
$this->db->f('hits');
-                               $group_info[$this->db->f('b_group')] = true;
+                               
$obligations[$this->db->f($b_account_field)][$this->db->f('district_id')] = 
round($this->db->f('combined_cost'));
+                               
$hits[$this->db->f($b_account_field)][$this->db->f('district_id')] = 
$this->db->f('hits');
+                               $accout_info[$this->db->f($b_account_field)] = 
true;
                                $district[$this->db->f('district_id')] = true;
                        }
 
 //_debug_array($obligations);
-                       $this->db->query("select max(revision) as revision from 
fm_budget_basis where year='$year'",__LINE__,__FILE__);
+                       $this->db->query("select max(revision) as revision from 
fm_budget where year={$year}",__LINE__,__FILE__);
                        $this->db->next_record();
                        $revision = (int)$this->db->f('revision');
 
@@ -515,9 +590,19 @@
                        $where = 'AND';
                        if ($grouping > 0)
                        {
+                               $filtermethod = " $where 
fm_b_account.category='$grouping' ";
+/*
+                               if (!$details)
+                               {
                                $filtermethod = " $where b_group='$grouping' ";
                                $where = 'AND';
                        }
+                               else
+                               {
+                                       $filtermethod = " $where 
fm_b_account.category='$grouping' ";
+                               }
+*/
+                       }
 
                        if ($district_id > 0)
                        {
@@ -525,14 +610,24 @@
                                $where = 'AND';
                        }
 
-                       $sql = "select budget_cost,b_group,district_id from 
fm_budget_basis where year='$year' AND revision = '$revision' $filtermethod 
GROUP BY budget_cost,b_group,district_id";
+                       if( $details )
+                       {
+                               $sql = "SELECT budget_cost,b_account_id as 
b_account_field,district_id FROM fm_budget"
+                                . " $this->join fm_b_account ON 
fm_budget.b_account_id =fm_b_account.id WHERE year={$year} AND revision = 
'$revision' $filtermethod GROUP BY budget_cost,b_account_id,district_id";
+                       }
+                       else
+                       {
+                               $sql = "SELECT sum(budget_cost) as budget_cost 
,fm_b_account.category as b_account_field,district_id FROM fm_budget"
+                                . " $this->join fm_b_account ON 
fm_budget.b_account_id =fm_b_account.id WHERE year={$year} AND revision = 
'$revision' $filtermethod GROUP BY fm_b_account.category,district_id";
+                       }
+//_debug_array($sql);
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        $budget_cost = array();
                        while ($this->db->next_record())
                        {
-                               
$budget_cost[$this->db->f('b_group')][$this->db->f('district_id')] = 
round($this->db->f('budget_cost'));
-                               $group_info[$this->db->f('b_group')] = true;
+                               
$budget_cost[$this->db->f('b_account_field')][$this->db->f('district_id')] = 
round($this->db->f('budget_cost'));
+                               $accout_info[$this->db->f('b_account_field')] = 
true;
                                $district[$this->db->f('district_id')] = true;
                        }
 
@@ -560,85 +655,109 @@
                        }
 
 
-                       $start_date1 = 
date($this->bocommon->dateformat,mktime(2,0,0,3,1,$year));
-                       $start_date2 = 
date($this->bocommon->dateformat,mktime(2,0,0,1,1,$year));
-                       $end_date = 
date($this->bocommon->dateformat,mktime(2,0,0,12,31,$year));
+                       $start_date1 = 
date($this->db->date_format(),mktime(2,0,0,3,1,$year));
+                       $start_date2 = 
date($this->db->date_format(),mktime(2,0,0,1,1,$year));
+                       $end_date = 
date($this->db->date_format(),mktime(2,0,0,12,31,$year));
 
-                       $sql = "SELECT fm_b_account.category as b_group, 
district_id, sum(godkjentbelop) as actual_cost FROM fm_ecobilagoverf"
-                               . " $this->join fm_project ON 
fm_ecobilagoverf.project_id =fm_project.id"
+                       $sql = "SELECT fm_b_account.{$b_account_field} as 
$b_account_field, district_id, sum(godkjentbelop) as actual_cost FROM 
fm_ecobilagoverf"
                                . " $this->join fm_b_account ON 
fm_ecobilagoverf.spbudact_code =fm_b_account.id"
                                . " $this->join fm_location1 ON 
fm_ecobilagoverf.loc1 = fm_location1.loc1"
                                . " $this->join fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id"
                                . " WHERE (fakturadato > '$start_date1' AND 
fakturadato < '$end_date' $filtermethod)"
                                . " OR (fakturadato > '$start_date2' AND 
fakturadato < '$end_date' AND periode < 3 $filtermethod)"
-                               . " GROUP BY b_group, district_id";
+                               . " GROUP BY fm_b_account.{$b_account_field}, 
district_id";
 
 //_debug_array($sql);
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        while ($this->db->next_record())
                        {
-                               
$actual_cost[$this->db->f('b_group')][$this->db->f('district_id')] = 
round($this->db->f('actual_cost'));
-                               $group_info[$this->db->f('b_group')] = true;
+                               
$actual_cost[$this->db->f($b_account_field)][$this->db->f('district_id')] = 
round($this->db->f('actual_cost'));
+                               $accout_info[$this->db->f($b_account_field)] = 
true;
                                $district[$this->db->f('district_id')] = true;
                        }
 
+                       $result = array();
 
-                       if (is_array($group_info))
+                       if (is_array($accout_info))
                        {
-                               if ($order == 'b_group')
+                               if ($order == 'b_account')
                                {
                                        switch ($sort)
                                        {
                                                case 'ASC':
-                                                       ksort($group_info);
+                                                       ksort($accout_info);
                                                        break;
                                                case 'DESC':
-                                                       krsort($group_info);
+                                                       krsort($accout_info);
                                                        break;
                                                default:
-                                                       ksort($group_info);
+                                                       ksort($accout_info);
                                        }
                                }
                                else
                                {
-                                       ksort($group_info);
+                                       ksort($accout_info);
                                }
 
                                ksort($district);
-                               $group_info = array_keys($group_info);
+                               $accout_info = array_keys($accout_info);
                                $district = array_keys($district);
 
-                               foreach($group_info as $b_group)
+                               $result = array();
+                               foreach($accout_info as $b_account)
                                {
                                        foreach($district as $district_id)
                                        {
-                                               if( 
(isset($actual_cost[$b_group][$district_id]) && 
$actual_cost[$b_group][$district_id])
-                                                || 
(isset($budget_cost[$b_group][$district_id]) && 
$budget_cost[$b_group][$district_id])
-                                                || 
(isset($obligations[$b_group][$district_id]) && 
$obligations[$b_group][$district_id]))
+                                               if( 
(isset($actual_cost[$b_account][$district_id]) && 
$actual_cost[$b_account][$district_id])
+                                                || 
(isset($budget_cost[$b_account][$district_id]) && 
$budget_cost[$b_account][$district_id])
+                                                || 
(isset($obligations[$b_account][$district_id]) && 
$obligations[$b_account][$district_id]))
                                                {
                                                        $result[] = array(
-                                                               'grouping'      
        => $b_group,
+                                                               'grouping'      
        => $details ? '' : $b_account, 
+                                                               'b_account'     
        => $b_account,
                                                                'district_id'   
=> $district_id,
-                                                               'actual_cost'   
=> isset($actual_cost[$b_group][$district_id]) && 
$actual_cost[$b_group][$district_id] ? 
round($actual_cost[$b_group][$district_id]) : 0,
-                                                               'budget_cost'   
=> isset($budget_cost[$b_group][$district_id]) && 
$budget_cost[$b_group][$district_id] ? 
round($budget_cost[$b_group][$district_id]) : 0,
-                                                               'obligation'    
=> isset($obligations[$b_group][$district_id]) && 
$obligations[$b_group][$district_id] ? 
round($obligations[$b_group][$district_id]) : 0,
-                                                               'hits'          
        => isset($hits[$b_group][$district_id])?$hits[$b_group][$district_id]:0,
+                                                               'actual_cost'   
=> isset($actual_cost[$b_account][$district_id]) && 
$actual_cost[$b_account][$district_id] ? 
round($actual_cost[$b_account][$district_id]) : 0,
+                                                               'budget_cost'   
=> isset($budget_cost[$b_account][$district_id]) && 
$budget_cost[$b_account][$district_id] ? 
round($budget_cost[$b_account][$district_id]) : 0,
+                                                               'obligation'    
=> isset($obligations[$b_account][$district_id]) && 
$obligations[$b_account][$district_id] ? 
round($obligations[$b_account][$district_id]) : 0,
+                                                               'hits'          
        => 
isset($hits[$b_account][$district_id])?$hits[$b_account][$district_id]:0,
                                                        );
                                                }
                                        }
                                }
                        }
 
-//_debug_array($result);
+                       $this->total_records = count($result);
+                       
+                       //cramirez
+                       if($this->total_records == 0)
+                       {
+                               return $result;                         
+                       }
+
+                       if(!$allrows)
+                       {
+                               $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])?intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']):15;
+
+//_debug_array(array($start,$this->total_records,$this->total_records,$num_rows));
                             
+                               $page = ceil( ( $start / $this->total_records ) 
* ($this->total_records/ $num_rows) );
+
+                               $out = array_chunk($result, $num_rows);
+
+                               return $out[$page];
+                       }
+                       else
+                       {
                        return $result;
                }
+               }
 
                function get_b_group_list()
                {
-                       $sql = "SELECT id FROM fm_b_account_category order by 
id asc";
+                       $sql = "SELECT DISTINCT fm_b_account.category as id 
FROM fm_budget $this->join fm_b_account ON (fm_budget.b_account_id = 
fm_b_account.id) ORDER BY id asc";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $group_list = array();
                        while ($this->db->next_record())
                        {
                                $group_list[] = array
@@ -654,6 +773,7 @@
                function get_revision_list($year='',$basis = '')
                {
                        $table = $basis?'fm_budget_basis':'fm_budget';
+                       $revision_list = array();
 
                        if(!$year)
                        {
@@ -689,6 +809,7 @@
                        $sql = "SELECT year FROM $table group by year ORDER BY 
year ASC";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $year_list = array();
                        while ($this->db->next_record())
                        {
                                $year_list[] = array
@@ -715,6 +836,7 @@
                        $sql = "SELECT revision FROM $table WHERE year =". 
(int)$year . "  group by revision";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $revision_list = array();
                        while ($this->db->next_record())
                        {
                                $revision_list[] = array
@@ -734,11 +856,12 @@
                        }
                        else
                        {
-                               $sql = "SELECT category as grouping FROM 
fm_budget $this->join fm_b_account ON fm_budget.b_account_id = fm_b_account.id 
WHERE year =". (int)$year . "  group by category";
+                               $sql = "SELECT fm_b_account.category as 
grouping FROM fm_budget $this->join fm_b_account ON fm_budget.b_account_id = 
fm_b_account.id WHERE year =". (int)$year . "  group by fm_b_account.category";
                        }
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $grouping_list = array();
                        while ($this->db->next_record())
                        {
                                $grouping_list[] = array
@@ -756,6 +879,7 @@
                        $sql = "SELECT year FROM $table group by year order by 
year asc";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $year_list = array();
                        while ($this->db->next_record())
                        {
                                $year_list[] = array
@@ -800,7 +924,7 @@
                        $this->db->transaction_commit();
                }
 
-               function distribute($values,$receipt='')
+               function distribute($values,$receipt = array())
                {
                        $year_condition = 'year in (' . 
implode(",",$values['distribute_year']). ')';
 
@@ -859,7 +983,7 @@
                                                {
 
                                                        
$this->db->query("INSERT INTO fm_budget (id, year, b_account_id, 
district_id,revision,user_id,entry_date,budget_cost) VALUES ("
-                                                       . 
$this->bocommon->next_id('fm_budget') . ","
+                                                       . 
$this->db->next_id('fm_budget') . ","
                                                        . $basis['year'] . ",'"
                                                        . 
$entry['b_account_id']. "',"
                                                        . $basis['district_id'] 
. ","

Modified: people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free 
Software Foundation, Inc. http://www.fsf.org/
        * This file is part of phpGroupWare.
        *
        * phpGroupWare is free software; you can redistribute it and/or modify
@@ -34,233 +34,1231 @@
 
        class property_socategory
        {
-               function property_socategory()
+               var $location_info = array();
+
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->custom   = 
createObject('property.custom_fields');
+                       $this->_db              = & $GLOBALS['phpgw']->db;
+                       $this->_like    = & $this->_db->like;
+                       $this->_join    = & $this->_db->join;
                }
 
                function read($data)
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start']:0;
+                               $query          = 
isset($data['query'])?$data['query']:'';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
+                               $order          = 
isset($data['order'])?$data['order']:'';
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                                }
-                               else
+
+                       $values = array();
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
                                {
-                                       $start=0;
+                               return $values;
                                }
-                               $query          = 
(isset($data['query'])?$data['query']:'');
-                               $sort           = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order          = 
(isset($data['order'])?$data['order']:'');
-                               $type           = 
(isset($data['type'])?$data['type']:'');
-                               $type_id                = 
(isset($data['type_id'])?$data['type_id']:'');
-                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
+
+                       $uicols = array();
+                       $uicols['input_type'][]         = 'text';
+                       $uicols['name'][]                       = 
$this->location_info['id']['name'];
+                       $uicols['descr'][]                      = lang('id');
+                       $uicols['datatype'][]           = 
$this->location_info['id']['type'] == 'varchar' ? 'V' : 'I';
+
+                       foreach($this->location_info['fields'] as $field)
+                       {
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
$field['name'];
+                               $uicols['descr'][]                      = 
$field['descr'];
+                               $uicols['datatype'][]           = 'V';
                        }
 
-                       if(!$type)
+                       
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
                        {
-                               return;
+
+                               $choice_table = 'phpgw_cust_choice';
+                               $attribute_table = 'phpgw_cust_attribute';
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
$this->location_info['acl_location']);
+                               $attribute_filter = " location_id = 
{$location_id}";
+
+                               $this->_db->query("SELECT * FROM 
$attribute_table WHERE list=1 AND $attribute_filter ORDER BY attrib_sort ASC");
+
+                               $i      = count($uicols['name']);
+                               while ($this->_db->next_record())
+                       {
+                                       $uicols['input_type'][]         = 
'text';
+                                       $uicols['name'][]                       
= $this->_db->f('column_name');
+                                       $uicols['descr'][]                      
= $this->_db->f('input_text');
+                                       $uicols['statustext'][]         = 
$this->_db->f('statustext');
+                                       $uicols['datatype'][$i]         = 
$this->_db->f('datatype');
+                                       $uicols['attib_id'][$i]         = 
$this->_db->f('id');
+                                       $cols_return_extra[]= array(
+                                               'name'  => 
$this->_db->f('column_name'),
+                                               'datatype'      => 
$this->_db->f('datatype'),
+                                               'attrib_id'     => 
$this->_db->f('id')
+                                       );
+
+                                       $i++;
+                               }
                        }
+
+                       $this->uicols = $uicols;
+
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
-
+                               $ordermethod = " ORDER BY $order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by id asc';
+                               $ordermethod = ' ORDER BY id ASC';
                        }
 
-                       $table = $this->select_table($type,$type_id);
-
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
+                               if($this->location_info['id']['type']=='auto' 
|| $this->location_info['id']['type']=='int')
+                               {
+                                       $id_query = (int) $query;
+                               }
+                               else
+                               {
+                                       $id_query = "'{$query}'";
+                               }
 
-                               $querymethod = " where id $this->like 
'%$query%' or descr $this->like '%$query%'";
+                               $query = $this->_db->db_addslashes($query);
+                               $querymethod = " WHERE 
{$table}.{$this->location_info['id']['name']} = {$id_query}";
+                               foreach($this->location_info['fields'] as 
$field)
+                               {
+                                       if($field['type'] == 'varchar')
+                                       {
+                                               $querymethod .= " OR 
{$table}.{$field['name']} $this->_like '%$query%'";
+                                       }
+                               }
                        }
 
                        $sql = "SELECT * FROM $table $querymethod";
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->_db->num_rows();
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
-
                        if(!$allrows)
                        {
-                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                               $this->_db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
                        }
                        else
                        {
-                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                               $this->_db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
-                       while ($this->db->next_record())
+                       $cols_return = $uicols['name'];
+                       $j=0;
+//                     $n=count($cols_return);
+
+                       $dataset = array();
+                       while ($this->_db->next_record())
                        {
-                               $category[] = array
+                               foreach($cols_return as $key => $field)
+                               {
+                                       $dataset[$j][$field] = array
                                (
-                                       'id'    => $this->db->f('id'),
-                                       'descr' => 
stripslashes($this->db->f('descr'))
+                                               'value'         => 
$this->_db->f($field),
+                                               'datatype'      => 
$uicols['datatype'][$key],
+                                               'attrib_id'     => 
$uicols['attib_id'][$key]
                                );
                        }
-                       return $category;
+                               $j++;
                }
 
+                       $values = $this->custom->translate_value($dataset, 
$location_id);
 
-               function select_table($type,$type_id)
+                       return $values;
+               }
+
+
+               function get_location_info($type,$type_id)
                {
-
+                       $type_id = (int)$type_id;
+                       $info = array();
                        switch($type)
                        {
-                               case 'dim_b':
-                                       $table='fm_ecodimb';
+//-------- ID type integer
+                               case 'project_group':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_project_group',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::project_group'
+                                       );
                                        break;
-                               case 'dim_d':
-                                       $table='fm_ecodimd';
+                               case 'dimb':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecodimb',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('dimb'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_dimb'
+                                       );
                                        break;
+                               case 'dimd':
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecodimd',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('dimd'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_dimd'
+                                       );
+                                       break;
                                case 'tax':
-                                       $table='fm_ecomva';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecomva',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_tax'
+                                       );
                                        break;
                                case 'voucher_cat':
-                                       $table='fm_ecobilag_category';
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_ecobilag_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::voucher_cats'
+                                       );
                                        break;
                                case 'voucher_type':
-                                       $table='fm_ecoart';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_ecoart',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::voucher_type'
+                                       );
                                        break;
                                case 'tender_chapter':
-                                       $table='fm_chapter';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_chapter',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::tender'
+                                       );
                                        break;
                                case 'location':
-                                       $table='fm_location' . $type_id . 
'_category';
+
+                                       $this->_db->query("SELECT id FROM 
fm_location_type WHERE id ={$type_id}",__LINE__,__FILE__);
+
+                                       if($this->_db->next_record())
+                                       {
+                                               $info = array
+                                               (
+                                                       'table' => 
"fm_location{$type_id}_category",
+                                                       'id'                    
        => array('name' => 'id', 'type' => 'int'),
+                                                       'fields'                
        => array
+                                                       (
+                                                               array
+                                                               (
+                                                                       'name' 
=> 'descr',
+                                                                               
'descr' => lang('descr'),
+                                                               'type' => 
'varchar'
+                                                               )
+                                                       ),
+                                                       'edit_msg'      => 
lang('edit'),
+                                                       'add_msg'       => 
lang('add'),
+                                                       'name'          => '',
+                                                       'acl_location' => 
'.admin',
+                                                       'menu_selection' => 
"admin::property::location::location::category_{$type_id}"
+                                               );
+                                       }
+                                       else
+                                       {
+                                               throw new 
Exception(lang('ERROR: illegal type %1', $type_id));
+                                       }
                                        break;
-                               case 'meter':
-                                       $table='fm_meter_category';
-                                       break;
-                               case 'document':
-                                       $table='fm_document_category';
-                                       break;
                                case 'owner':
-                                       $table='fm_owner_category';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_owner_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::owner::owner_cats'
+                                       );
                                        break;
                                case 'tenant':
-                                       $table='fm_tenant_category';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_tenant_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('tenant 
category'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::tenant::tenant_cats'
+                                       );
                                        break;
                                case 'vendor':
-                                       $table='fm_vendor_category';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_vendor_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('vendor 
category'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::vendor::vendor_cats'
+                                       );
                                        break;
                                case 'district':
-                                       $table='fm_district';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_district',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => 
lang('district'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::location::district'
+                                       );
                                        break;
                                case 'street':
-                                       $table='fm_streetaddress';
+                                       $info = array
+                                       (
+                                               'table' => 'fm_streetaddress',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => 
lang('streetaddress'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::location::street'
+                                       );
                                        break;
                                case 's_agreement':
-                                       $table='fm_s_agreement_category';
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_s_agreement_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::agreement::service_agree_cats'
+                                       );
                                        break;
                                case 'tenant_claim':
-                                       $table='fm_tenant_claim_category';
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_tenant_claim_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::tenant::claims_cats'
+                                       );
                                        break;
                                case 'wo_hours':
-                                       $table='fm_wo_hours_category';
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_wo_hours_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::workorder_detail'
+                                       );
                                        break;
                                case 'r_condition_type':
-                                       $table='fm_request_condition_type';
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_request_condition_type',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::request_condition'
+                                       );
                                        break;
                                case 'r_agreement':
-                                       $table='fm_r_agreement_category';
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_r_agreement_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => '',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::agreement::rental_agree_cats'
+                                       );
                                        break;
                                case 'b_account':
-                                       $table='fm_b_account_category';
+                                       $info = array
+                                       (
+                                               'table' => 
'fm_b_account_category',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'      => lang('edit'),
+                                               'add_msg'       => lang('add'),
+                                               'name'          => lang('budget 
account'),
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::accounting::accounting_cats'
+                                       );
                                        break;
+//-------- ID type varchar
+                               case 'project_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_project_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'approved',
+                                                               'descr' => 
lang('approved'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('project status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::project_status'
+                                       );
+                                       break;
+                               case 'workorder_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_workorder_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'approved',
+                                                               'descr' => 
lang('approved'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'in_progress',
+                                                               'descr' => 
lang('In progress'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'delivered',
+                                                               'descr' => 
lang('delivered'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('workorder status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::workorder_status'
+                                       );
+                                       break;
+                               case 'request_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_request_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('request status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::request_status'
+                                       );
+                                       break;
+                               case 'agreement_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_agreement_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('agreement status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::agreement::agreement_status'
+                                       );
+                                       break;
+                               case 'building_part':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_building_part',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('building part'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::building_part'
+                                       );
+                                       break;
+                               case 'document_status':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_document_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('document status'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::document_status'
+                                       );
+                                       break;
+                               case 'unit':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_standard_unit',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit unit'),
+                                               'add_msg'                       
=> lang('add unit'),
+                                               'name'                          
=> lang('unit'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::unit'
+                                       );
+                                       break;
+//-------- ID type auto
                                case 'branch':
-                                       $table='fm_branch';
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_branch',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 'num',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('branch'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::branch'
+                                       );
+
                                        break;
+                               case 'key_location':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_key_loc',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 'num',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('key location'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('branch'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::key_location'
+                                       );
 
+                                       break;
+
+                               case 'async':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_async_method',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'data',
+                                                               'descr' => 
lang('data'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('Async services'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::async'
+                                       );
+                                       break;
+
+                               case 'event_action':
+
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_event_action',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'action',
+                                                               'descr' => 
lang('action'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'data',
+                                                               'descr' => 
lang('data'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('event action'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::event_action',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               )
+                                       );
+
+                                       break;
+
+                               case 'ticket_status':
+
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_tts_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'color',
+                                                               'descr' => 
lang('color'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'approved',
+                                                               'descr' => 
lang('approved'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'in_progress',
+                                                               'descr' => 
lang('In progress'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'delivered',
+                                                               'descr' => 
lang('delivered'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('event action'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::ticket_status'
+                                       );
+                                       break;
+                               case 'pending_action_type':
+                                       $info = array
+                                       (
+                                               'table'                         
=> 'fm_action_pending_category',
+                                               'id'                            
=> array('name' => 'num', 'type' => 'varchar'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=> lang('Pending action type'),
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::action_type'
+                                       );
+
+                                       break;
+
+                               default:
+                                       $receipt = array();
+                                       
$receipt['error'][]=array('msg'=>lang('ERROR: illegal type %1', $type));
+                                       phpgwapi_cache::session_set('phpgwapi', 
'phpgw_messages', $receipt);
+                               //      throw new Exception(lang('ERROR: 
illegal type %1', $type));
                        }
 
-                       return $table;
+                       $this->location_info = $info;
+                       return $info;
                }
 
+               function read_single($data,$values = array())
+               {
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return $values;
+                       }
 
-               function read_single($id,$type,$type_id)
+                       if($this->location_info['id']['type']=='auto' || 
$this->location_info['id']['type']=='int')
+                       {
+                               $id = (int) $data['id'];
+                       }
+                       else
                {
+                               $id = "'{$data['id']}'";
+                       }
 
-                       $table = $this->select_table($type,$type_id);
+                       $sql = "SELECT * FROM $table WHERE 
{$this->location_info['id']['name']} = {$id}";
 
-                       $sql = "SELECT * FROM $table  where id='$id'";
+                       $this->_db->query($sql,__LINE__,__FILE__);
 
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       if ($this->_db->next_record())
+                       {
+                               $values['id'] = 
$this->_db->f($this->location_info['id']['name']);
 
-                       if ($this->db->next_record())
+                               // FIXME - add field to $values['attributes']
+                               foreach($this->location_info['fields'] as 
$field)
                        {
-                               $category['id']         = $this->db->f('id');
-                               $category['descr']      = 
stripslashes($this->db->f('descr'));
+                                       $values[$field['name']] = 
$this->_db->f($field['name'], true);
+                               }
 
-                               return $category;
+                               if ( isset($values['attributes']) && 
is_array($values['attributes']) )
+                               {
+                                       foreach ( $values['attributes'] as 
&$attr )
+                                       {
+                                               $attr['value']  = 
$this->_db->f($attr['column_name']);
                        }
                }
+                       }
+                       return $values;
+               }
 
 
                function select_category_list($data)
                {
-                       $table = 
$this->select_table($data['type'],$data['type_id']);
+                       $values = array();
+
+                       $this->get_location_info($data['type'], 
$data['type_id']);
+
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return $values;
+                       }
                        $order          = isset($data['order']) && 
$data['order'] == 'id' ? 'id' :'descr';
 
-                       $this->db->query("SELECT id, descr FROM $table ORDER BY 
$order");
+                       $this->_db->query("SELECT id, descr FROM $table ORDER 
BY $order");
 
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
-                               $categories[] = array(
-                                       'id'    => $this->db->f('id'),
-                                       'name'  => 
stripslashes($this->db->f('descr'))
+                               $values[] = array
+                               (
+                                       'id'    => $this->_db->f('id'),
+                                       'name'  => $this->_db->f('descr', true)
                                        );
                        }
-                       return (isset($categories)?$categories:false);
+                       return $values;
                }
 
 
-               function add($category,$type,$type_id)
+               function add($data,$values_attribute)
                {
-                       $table = $this->select_table($type,$type_id);
+                       $receipt = array();
 
-                       $category['descr'] = 
$this->db->db_addslashes($category['descr']);
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
 
-                       $this->db->query("INSERT INTO $table (id, descr) "
-                               . "VALUES ('" . $category['id'] . "','" . 
$category['descr']. "')",__LINE__,__FILE__);
+                       if(isset($data['save']))
+                       {
+                               unset($data['save']);
+                       }
+                       if(isset($data['apply']))
+                       {
+                               unset($data['apply']);
+               }
+                       $cols = array();
+                       $vals = array();
 
-                       $receipt['message'][]=array('msg'=>lang('category has 
been saved'));
-                       return $receipt;
+                       $data['descr'] = 
$this->_db->db_addslashes($data['descr']);
+
+                       if(isset($data['extra']))
+               {
+                               foreach ($data['extra'] as $input_name => 
$value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $cols[] = $input_name;
+                                               $vals[] = $value;
+                                       }
+                               }
+                       }
+                       unset($data['extra']);
+
+                       foreach ($data as $input_name => $value)
+                       {
+                               if(isset($value) && $value)
+                               {
+                                       $cols[] = $input_name;
+                                       $vals[] = 
$this->_db->db_addslashes($value);
+                               }
+                       }
+
+                       $data_attribute = $this->custom->prepare_for_db($table, 
$values_attribute);
+                       if(isset($data_attribute['value_set']))
+                       {
+                               foreach($data_attribute['value_set'] as 
$input_name => $value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $cols[] = $input_name;
+                                               $vals[] = $value;
+                                       }
+                               }
+                       }
+
+
+                       if(isset($this->location_info['default']) && 
is_array($this->location_info['default']))
+                       {
+                               foreach ($this->location_info['default'] as 
$field => $default)
+                               {
+                                       if(isset($default['add']))
+                                       {
+                                               $cols[] = $field;
+                                               eval('$vals[] = ' . 
$default['add'] .';');
                }
+                               }
+                       }
 
-               function edit($category,$type,$type_id)
+                       $this->_db->transaction_begin();
+
+                       if($this->location_info['id']['type']!='auto')
+                       {
+                               $this->_db->query("SELECT id FROM {$table} 
WHERE {$this->location_info['id']['name']} = 
'{$data['id']}'",__LINE__,__FILE__);
+                               if($this->_db->next_record())
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('duplicate key value'));
+                                       
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
+                                       return $receipt;
+                               }
+                               $id = $data['id'];
+                       }
+                       else
                {
+                               $id = $this->_db->next_id($table);
+                               $cols[] = 'id';
+                               $vals[] = $id;
+                       }
 
-                       $table = $this->select_table($type,$type_id);
+                       $cols   = implode(",", $cols);
+                       $vals   = $this->_db->validate_insert($vals);
 
-                       $category['descr'] = 
$this->db->db_addslashes($category['descr']);
+                       $this->_db->query("INSERT INTO {$table} ({$cols}) 
VALUES ({$vals})",__LINE__,__FILE__);
 
-                       $this->db->query("UPDATE $table set descr='" . 
$category['descr']
-                                                       . "' WHERE id='" . 
$category['id']. "'",__LINE__,__FILE__);
+/*                     if($this->location_info['id']['type']=='auto')
+                       {
+                               if(!$data['id'] = 
$this->_db->get_last_insert_id($table, 'id'))
+                               {
+                                       $this->_db->transaction_abort();
+                                       
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
+                               }
+                       }
+*/
+                       $this->_db->transaction_commit();
+                       $receipt['id'] = $id;
+                       $receipt['message'][]=array('msg'=>lang('record has 
been saved'));
+                       return $receipt;
+               }
 
+               function edit($data,$values_attribute)
+               {
+                       $receipt = array();
 
-                       $receipt['message'][]=array('msg'=>lang('category has 
been edited'));
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
                        return $receipt;
                }
 
-               function delete($id,$type,$type_id)
+                       $value_set = array();
+
+                       if(isset($data['extra']))
+                       {
+                               foreach ($data['extra'] as $input_name => 
$value)
+                               {
+                                       $value_set[$input_name] = $value;
+                               }
+                               unset($data['extra']);
+                       }
+
+                       $data_attribute = $this->custom->prepare_for_db($table, 
$values_attribute, $data['id']);
+
+                       if(isset($data_attribute['value_set']))
+                       {
+                               $value_set = array_merge($value_set, 
$data_attribute['value_set']);
+                       }
+                       foreach($this->location_info['fields'] as $field)
                {
-                       $table = $this->select_table($type,$type_id);
+                               $value_set[$field['name']] = 
$this->_db->db_addslashes($data[$field['name']]);
+                       }
 
-                       $this->db->query("DELETE FROM $table WHERE id='" . $id 
. "'",__LINE__,__FILE__);
+                       if(isset($this->location_info['default']) && 
is_array($this->location_info['default']))
+                       {
+                               foreach ($this->location_info['default'] as 
$field => $default)
+                               {
+                                       if(isset($default['edit']))
+                                       {
+                                               eval('$value_set[$field] = ' . 
$default['edit'] .';');
+                                       }
+                               }
+                       }
+
+                       $value_set      = 
$this->_db->validate_update($value_set);
+                       $this->_db->transaction_begin();
+                       $this->_db->query("UPDATE $table SET {$value_set} WHERE 
{$this->location_info['id']['name']}='" . $data['id']. "'",__LINE__,__FILE__);
+
+/*                     //FIXME
+                       if (isset($data_attribute['history_set']) && 
is_array($data_attribute['history_set']))
+                       {
+                               $historylog     = 
CreateObject('phpgwapi.historylog','property', 
$this->location_info['acl_location']);
+                               foreach ($data_attribute['history_set'] as 
$attrib_id => $history)
+                               {
+                                       
$historylog->add('SO',$data['id'],$history['value'],false, 
$attrib_id,$history['date']);
+                               }
+                       }
+*/
+                       $this->_db->transaction_commit();
+
+                       $receipt['id'] = $data['id'];
+
+                       $receipt['message'][]=array('msg'=>lang('record has 
been edited'));
+                       return $receipt;
                }
+
+               function delete($id)
+               {
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return false;
+                       }
+                       $this->_db->query("DELETE FROM $table WHERE 
{$this->location_info['id']['name']}='{$id}'",__LINE__,__FILE__);
+               }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.socommon.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -32,6 +32,8 @@
         * @package property
         */
 
+       phpgw::import_class('phpgwapi.datetime');
+
        class property_socommon
        {
                /**
@@ -45,12 +47,13 @@
                 var $like = 'LIKE';
 
 
-               function property_socommon()
+               function __construct()
                {
 
                        if(is_object($GLOBALS['phpgw']->db))
                        {
-                               $this->db = CreateObject('phpgwapi.db');
+                               $this->db = & $GLOBALS['phpgw']->db;
+                               //$this->db = CreateObject('phpgwapi.db');
                        }
                        else // for setup
                        {
@@ -114,8 +117,18 @@
                                        $value = 
$GLOBALS['phpgw']->db->db_addslashes($value);
                                }
 
+                               $this->db->query("SELECT value FROM fm_cache 
WHERE name='{$name}'");
+
+                               if($this->db->next_record())
+                               {
+                                       $this->db->query("UPDATE fm_cache SET 
value = '{$value}' WHERE name='{$name}'",__LINE__,__FILE__);
+                               }
+                               else
+                               {
                                $this->db->query("INSERT INTO fm_cache 
(name,value)VALUES ('$name','$value')",__LINE__,__FILE__);
                        }
+
+                       }
                        else
                        {
                                $this->db->query("SELECT value FROM fm_cache 
where name='$name'");
@@ -298,11 +311,15 @@
 
                function increment_id($name)
                {
-                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name='$name'");
+                       if($name == 'order') // FIXME: temporary hack
+                       {
+                               $name = 'workorder';
+                       }
+                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name='{$name}'");
                        $this->db->next_record();
-                       $next_id=$this->db->f('value') +1;
+                       $next_id = $this->db->f('value') +1;
 
-                       $this->db->query("update fm_idgenerator set value = 
$next_id WHERE name = 'workorder'");
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}'");
                        return $next_id;
                }
 
@@ -312,6 +329,10 @@
                        {
                                $db = clone($db);
                        }
+                       else if( is_object($GLOBALS['phpgw']->db) )
+                       {
+                               $db = & $GLOBALS['phpgw']->db;
+                       }
                        else
                        {
                                $db = CreateObject('phpgwapi.db');

Modified: people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,17 +34,12 @@
 
        class property_socustom
        {
-               function property_socustom()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read($data)
@@ -80,16 +75,14 @@
 
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
+                               $query = $this->db->db_addslashes($query);
                                $querymethod = " $where name $this->like 
'%$query%'";
                        }
 
                        $sql = "SELECT * FROM fm_custom $filtermethod 
$querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -115,15 +108,20 @@
 
                function read_single($custom_id)
                {
-                       $this->db->query("select * from fm_custom where 
id='$custom_id'",__LINE__,__FILE__);
+                       $custom_id = (int) $custom_id;
+                       $this->db->query("SELECT * from fm_custom where 
id={$custom_id}",__LINE__,__FILE__);
 
+                       $custom = array();
                        if ($this->db->next_record())
                        {
-                               $custom['id']                   = 
(int)$this->db->f('id');
-                               $custom['name']                 = 
stripslashes($this->db->f('name'));
-                               $custom['sql_text']                     = 
stripslashes($this->db->f('sql_text'));
-                               $custom['entry_date']   = 
$this->db->f('entry_date');
-                               $custom['cols']                 = 
$this->read_cols($custom_id);
+                               $custom = array
+                               (
+                                       'id'                    => 
(int)$this->db->f('id'),
+                                       'name'                  => 
$this->db->f('name', true),
+                                       'sql_text'              => 
$this->db->f('sql_text', true),
+                                       'entry_date'    => 
$this->db->f('entry_date'),
+                                       'cols'                  => 
$this->read_cols($custom_id)
+                               );
                        }
 
                        return $custom;
@@ -131,43 +129,41 @@
 
                function read_cols($custom_id)
                {
-                       $sql = "SELECT * FROM fm_custom_cols WHERE 
custom_id=$custom_id ORDER by sorting";
+                       $custom_id = (int) $custom_id;
+                       $sql = "SELECT * FROM fm_custom_cols WHERE 
custom_id={$custom_id} ORDER by sorting";
                        $this->db->query($sql);
 
+                       $cols = array();
                        while ($this->db->next_record())
                        {
-                               $choice[] = array
+                               $cols[] = array
                                (
                                        'id'    => $this->db->f('id'),
                                        'name'  => $this->db->f('name'),
-                                       'descr' => $this->db->f('descr'),
+                                       'descr' => $this->db->f('descr', true),
                                        'sorting'=> $this->db->f('sorting')
                                );
 
                        }
-                       return $choice;
+                       return $cols;
                }
 
                function read_custom_name($custom_id)
                {
-                       $this->db->query("select name from fm_custom where 
id='$custom_id'",__LINE__,__FILE__);
-
-                       if ($this->db->next_record())
-                       {
-                               $name                   = 
stripslashes($this->db->f('name'));
-                       }
-
-                       return $name;
+                       $custom_id = (int) $custom_id;
+                       $this->db->query("SELECT name FROM fm_custom where 
id={$custom_id}",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f('name', true);
                }
 
                function add($custom)
                {
                        $custom['name'] = 
$this->db->db_addslashes($custom['name']);
-                       $custom['sql_text'] = 
$this->db->db_addslashes($custom['sql_text']);
+                       $custom['sql_text'] = 
$this->db->db_addslashes(htmlspecialchars_decode($custom['sql_text']));
 
                        $this->db->transaction_begin();
 
-                       $id = $this->bocommon->next_id('fm_custom');
+                       $id = $this->db->next_id('fm_custom');
 
                        $this->db->query("INSERT INTO fm_custom 
(id,entry_date,sql_text,name,user_id) "
                                . "VALUES ($id,'" . time() . "','" . 
$custom['sql_text'] . "','" . $custom['name'] . "'," . $this->account . 
")",__LINE__,__FILE__);
@@ -184,20 +180,19 @@
                function edit($custom)
                {
                        $custom['name'] = 
$this->db->db_addslashes($custom['name']);
-                       $custom['sql_text'] = 
$this->db->db_addslashes($custom['sql_text']);
+                       $custom['sql_text'] = 
$this->db->db_addslashes(htmlspecialchars_decode($custom['sql_text']));
 
-                       $this->db->query("UPDATE fm_custom set sql_text='" . 
$custom['sql_text'] . "', entry_date='" . time() . "', name='" . 
$custom['name'] . "' WHERE id=" . 
intval($custom['custom_id']),__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_custom set sql_text='" . 
$custom['sql_text'] . "', entry_date='" . time() . "', name='" . 
$custom['name'] . "' WHERE id=" . (int) $custom['custom_id'],__LINE__,__FILE__);
 
                        if($custom['new_name'])
                        {
-                               $column_id = 
$this->bocommon->next_id('fm_custom_cols' 
,array('custom_id'=>$custom['custom_id']));
+                               $column_id = 
$this->db->next_id('fm_custom_cols', array('custom_id'=>$custom['custom_id']));
 
                                $sql = "SELECT max(sorting) as max_sort FROM 
fm_custom_cols WHERE custom_id=" . $custom['custom_id'];
                                $this->db->query($sql);
                                $this->db->next_record();
                                $sorting        = $this->db->f('max_sort')+1;
 
-
                                $values= array(
                                        $custom['custom_id'],
                                        $column_id,
@@ -206,7 +201,7 @@
                                        $sorting
                                        );
 
-                               $values = 
$this->bocommon->validate_db_insert($values);
+                               $values = $this->db->validate_insert($values);
 
                                $this->db->query("INSERT INTO fm_custom_cols 
(custom_id,id,name,descr,sorting) "
                                . "VALUES ($values)");
@@ -291,25 +286,27 @@
                {
                        if(is_array($data))
                        {
-                               $start  = 
(isset($data['start'])?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $custom_id              = 
(isset($data['custom_id'])?$data['custom_id']:'');
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                               $filter         = isset($data['filter']) && 
$data['filter'] ? $data['filter'] : 'none';
+                               $query          = isset($data['query']) ? 
$data['query'] : '';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort'] : 'DESC';
+                               $order          = isset($data['order']) ? 
$data['order'] : '';
+                               $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
+                               $custom_id      = isset($data['custom_id']) && 
$data['custom_id'] ? (int)$data['custom_id'] : 0;
                        }
 
-                       $this->db->query("select sql_text from fm_custom where 
id='$custom_id'",__LINE__,__FILE__);
+                       $this->db->query("SELECT sql_text FROM fm_custom where 
id={$custom_id}",__LINE__,__FILE__);
                        $this->db->next_record();
-                       $sql = stripslashes($this->db->f('sql_text'));
+                       $sql = $this->db->f('sql_text', true);
 
                        $uicols = $this->read_cols($custom_id);
                        $this->uicols = $uicols;
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       //FIXME:
+                       $ordermethod = '';
+                       
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -338,8 +335,9 @@
 
                function delete($custom_id)
                {
-                       $this->db->query('DELETE FROM fm_custom WHERE id=' . 
intval($custom_id),__LINE__,__FILE__);
-                       $this->db->query('DELETE FROM fm_custom_cols WHERE 
custom_id=' . intval($custom_id),__LINE__,__FILE__);
+                       $custom_id = (int) $custom_id;
+                       $this->db->query("DELETE FROM fm_custom WHERE 
id={$custom_id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_custom_cols WHERE 
custom_id={$custom_id}",__LINE__,__FILE__);
                }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sodocument.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,57 +35,55 @@
        class property_sodocument
        {
 
-               function property_sodocument()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db           = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
                        $this->historylog       = 
CreateObject('property.historylog','document');
                        $this->vfs                      = 
CreateObject('phpgwapi.vfs');
-                       $this->rootdir          = $this->vfs->basedir;
+                       $this->vfs->fakebase            = '/property';
                        $this->fakebase         = $this->vfs->fakebase;
-                       $this->socommon         = 
CreateObject('property.socommon');
+                       $this->cats                                     = 
CreateObject('phpgwapi.categories');
+                       $this->cats->app_name           = 'property.document';
+                       $this->cats->supress_info       = true;
 
-                       $this->join                     = $this->socommon->join;
-                       $this->like                     = $this->socommon->like;
+
+                       $this->db               = & $GLOBALS['phpgw']->db;
+                       $this->join                             = & 
$this->db->join;
+                       $this->like                             = & 
$this->db->like;
                }
 
 
-               function read_single_category($id='')
-               {
-                       $this->db->query("SELECT descr FROM 
fm_document_category where id='$id' ");
-                       $this->db->next_record();
-                       return $this->db->f('descr');
-               }
-
                function select_status_list()
                {
+                       $status = array();
                        $this->db->query("SELECT id, descr FROM 
fm_document_status ORDER BY id ");
 
-                       $i = 0;
                        while ($this->db->next_record())
                        {
-                               $status_entries[$i]['id']                       
        = $this->db->f('id');
-                               $status_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
-                               $i++;
+                               $status[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('descr',true)
+                               );
                        }
-                       return $status_entries;
+                       return $status;
                }
 
                function select_branch_list()
                {
+                       $branch = array();
                        $this->db->query("SELECT id, descr FROM fm_branch ORDER 
BY id ");
 
-                       $i = 0;
                        while ($this->db->next_record())
                        {
-                               $branch_entries[$i]['id']                       
        = $this->db->f('id');
-                               $branch_entries[$i]['name']                     
        = stripslashes($this->db->f('descr'));
-                               $i++;
+                               $branch[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('descr',true)
+                               );
                        }
-                       return $branch_entries;
+                       return $branch;
                }
 
                function read($data)
@@ -99,9 +97,11 @@
                                $order          = 
isset($data['order'])?$data['order']:'';
                                $cat_id         = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id']:0;
                                $entity_id      = 
isset($data['entity_id'])?$data['entity_id']:'';
-                               $doc_type       = isset($data['doc_type']) && 
$data['doc_type'] ? $data['doc_type']:0;
+                               $doc_type               = 
isset($data['doc_type']) && $data['doc_type'] ? $data['doc_type']: 0;
                        }
 
+                       $doc_types = $this->get_sub_doc_types($doc_type);
+
                        $sql = $this->bocommon->fm_cache('sql_document_' . 
$entity_id);
 
                        if(!$sql)
@@ -174,7 +174,7 @@
                                $this->cols_extra       = 
$this->bocommon->fm_cache('cols_extra_document_' . $entity_id);
                        }
 
-                       $groupmethod= " GROUP BY 
fm_document.location_code,fm_document.address,fm_document.document_name";
+                       $groupmethod= " GROUP BY 
fm_document.location_code,fm_document.address";
 
                        if ($entity_id)
                        {
@@ -195,7 +195,7 @@
 
                        $filtermethod = '';
 
-                       $GLOBALS['phpgw']->config->read_repository();
+                       $GLOBALS['phpgw']->config->read();
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
                        {
                                $access_location = 
$this->bocommon->get_location_list(PHPGW_ACL_READ);
@@ -215,10 +215,10 @@
                                $where= 'AND';
                        }
 
-                       if ($doc_type > 0)
+                       if ($doc_types && is_array($doc_types))
                        {
-                               $filtermethod .= " $where 
fm_document.category='$doc_type' ";
-                               $where= 'AND';
+                               $filtermethod .= " $where fm_document.category 
IN (". implode(',', $doc_types) . ')';
+                               $where = 'AND';
                        }
 
                        if ($filter!='all' && $filter)
@@ -237,8 +237,8 @@
 
 //echo $sql;
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
 
                        $document_list = array();
@@ -270,24 +270,20 @@
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
-                               }
-                               else
-                               {
-                                       $start=0;
-                               }
-                               $filter = 
(isset($data['filter'])?$data['filter']:'');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $entity_id = 
(isset($data['entity_id'])?$data['entity_id']:0);
-                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $doc_type = 
(isset($data['doc_type'])?$data['doc_type']:0);
-                               $location_code = 
(isset($data['location_code'])?$data['location_code']:'');
+                               $start                  = isset($data['start']) 
&& $data['start'] ? $data['start']:0;
+                               $query                  = 
isset($data['query'])?$data['query']:'';
+                               $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
+                               $order                  = 
isset($data['order'])?$data['order']:'';
+                               $filter                 = 
isset($data['filter']) && $data['filter'] ? (int) $data['filter']: 0;
+                               $entity_id              = 
isset($data['entity_id']) && $data['entity_id'] ? (int)$data['entity_id']:0;
+                               $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? (int)$data['cat_id']: 0;
+                               $doc_type               = 
isset($data['doc_type']) && $data['doc_type'] ? $data['doc_type']: 0;
+                               $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
+                               $location_code  = 
isset($data['location_code'])?$data['location_code']:'';
                        }
 
+                       $doc_types = $this->get_sub_doc_types($doc_type);
+
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
@@ -297,38 +293,55 @@
                                $ordermethod = ' order by location_code ASC';
                        }
 
-                       $filtermethod = " fm_document.location_code $this->like 
'$location_code%'";
+                       $where = 'WHERE';
+                       $filtermethod = '';
+                       if($location_code)
+                       {
+                               $filtermethod = " $where 
fm_document.location_code $this->like '$location_code%'";
+                               $where = 'AND';
+                       }
 
-                       if ($doc_type > 0)
+                       if ($doc_types && is_array($doc_types))
                        {
-                               $filtermethod .= " AND 
fm_document.category='$doc_type' ";
+                               $filtermethod .= " $where fm_document.category 
IN (". implode(',', $doc_types) . ')';
+                               $where = 'AND';
                        }
                        if ($cat_id > 0)
                        {
-                               $filtermethod .= " AND 
fm_document.p_cat_id=$cat_id AND fm_document.p_entity_id=$entity_id ";
+                               $filtermethod .= " $where 
fm_document.p_cat_id={$cat_id} AND fm_document.p_entity_id={$entity_id} ";
+                               $where = 'AND';
                        }
 
-
-                       if ($filter)
+                       if ($filter > 0)
                        {
-                               $filtermethod .= " AND 
fm_document.user_id='$filter' ";
+                               $filtermethod .= "  $where 
fm_document.user_id='$filter' ";
+                               $where = 'AND';
                        }
 
                        if($query)
                        {
                                $query = $this->db->db_addslashes($query);
-                               $querymethod = " AND fm_document.title 
$this->like '%$query%' OR fm_document.document_name"
-                               . " $this->like '%$query%' OR 
fm_document.location_code $this->like '$location_code%'";
+                               $querymethod = " $where (fm_document.title 
$this->like '%$query%' OR fm_document.document_name"
+                               . " $this->like '%$query%')";
                        }
 
-                       $sql = "SELECT fm_document.*, 
fm_document_category.descr as category FROM fm_document"
-                       . " $this->join fm_document_category on 
fm_document.category = fm_document_category.id"
-                       . " WHERE  $filtermethod $querymethod";
+                       $sql = "SELECT fm_document.*, phpgw_categories.cat_name 
as category FROM fm_document"
+                       . " $this->join phpgw_categories on 
fm_document.category = phpgw_categories.cat_id"
+                       . " $filtermethod $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
+
+                       if(!$allrows)
+                       {
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
 
+                       $document_list = array();
                        while ($this->db->next_record())
                        {
                                $document_list[] = array
@@ -341,7 +354,7 @@
                                        'user_id'                       => 
$this->db->f('user_id')
                                        );
                        }
-//_debug_array($document_list);
+
                        return $document_list;
                }
 
@@ -439,7 +452,7 @@
                                $document['vendor_id'],
                                $this->account);
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
                        $this->db->query("INSERT INTO fm_document 
(document_name,link,title,access,category,entry_date,document_date,version,coordinator,status,"
                                . 
"descr,location_code,address,branch_id,vendor_id,user_id $cols) "
@@ -468,6 +481,7 @@
 
                function edit($document)
                {
+                       $receipt = array();
                        while (is_array($document['location']) && 
list($input_name,$value) = each($document['location']))
                        {
                                $vals[] = "$input_name = '$value'";
@@ -495,28 +509,43 @@
                                $address = 
$this->db->db_addslashes($document['location_name']);
                        }
 
-                       $this->db->query("SELECT 
status,category,coordinator,document_name,loc1,link,p_num FROM fm_document 
where id='" .$document['document_id']."'",__LINE__,__FILE__);
+                       $this->db->query("SELECT 
status,category,coordinator,document_name,location_code,link,p_entity_id,p_cat_id,p_num
 FROM fm_document where id='" .$document['document_id']."'",__LINE__,__FILE__);
                        $this->db->next_record();
 
                        $old_status = $this->db->f('status');
                        $old_doc_type = $this->db->f('category');
                        $old_coordinator = $this->db->f('coordinator');
                        $old_document_name = $this->db->f('document_name');
-                       $old_loc1 = $this->db->f('loc1');
                        $old_link = $this->db->f('link');
+                       $old_location_code      = $this->db->f('location_code');
+                       $old_p_entity_id        = $this->db->f('p_entity_id');
+                       $old_p_cat_id           = $this->db->f('p_cat_id');
                        $old_p_num = $this->db->f('p_num');
 
+                       $move_file = false;
+
+                       if($old_location_code != $document['location_code'])
+                       {
+                               $move_file = true;                      
+                       }
+
+                       if("{$old_p_entity_id}_{$old_p_cat_id}" != 
"{$document['extra']['p_entity_id']}_{$document['extra']['p_cat_id']}")
+                       {
+                               $move_file = true;                      
+                       }
+
                        if ($old_status != $document['status'])
                        {
-                               
$this->historylog->add('S',$document['document_id'],$document['status']);
+                               
$this->historylog->add('S',$document['document_id'],$document['status'],$old_status);
                        }
                        if ($old_doc_type != $document['doc_type'])
                        {
-                               
$this->historylog->add('T',$document['document_id'],$document['doc_type']);
+                               
$this->historylog->add('T',$document['document_id'],$document['doc_type'],$old_doc_type);
+                               $move_file = true;
                        }
                        if ((int)$old_coordinator != 
(int)$document['coordinator'])
                        {
-                               
$this->historylog->add('C',$document['document_id'],$document['coordinator']);
+                               
$this->historylog->add('C',$document['document_id'],$document['coordinator'],$old_coordinator);
                        }
 
                        if($document['document_name_orig'] && 
!$document['document_name'] )
@@ -526,32 +555,34 @@
 
                        if($old_link !=$document['link'] )
                        {
-                                       
$this->historylog->add('L',$document['document_id'],$document['link']);
+                                       
$this->historylog->add('L',$document['document_id'],$document['link'],$old_link);
                                        $alter_link=true;
                        }
 
-//_debug_array($document);
-                       if ($old_document_name && ($old_document_name != 
$document['document_name']))
+
+                       if ($old_document_name && ($old_document_name != 
$document['document_name'] || $move_file = true))
                        {
                                if($document['link'] && !$alter_link)
                                {
-                                       
$this->historylog->add('L',$document['document_id'],$document['link']);
+                                       
$this->historylog->add('L',$document['document_id'],$document['link'],$old_document_name);
                                }
                                else
                                {
-                                       
$this->historylog->add('F',$document['document_id'],$document['document_name']);
+                                       
$this->historylog->add('F',$document['document_id'],$document['document_name'],$old_document_name);
                                }
 
-                               if($old_p_num)
+                               // file is already moved
+                       /*      if($old_p_entity_id)
                                {
-                                       $file = $this->fakebase. '/' . 
'document' . '/' . $old_loc1 . '/' . $document['entity_name'] . '/' . 
$document['category_name'] . '/' . $p_num . '/' . $old_document_name;
+                                       $file = 
"{$this->fakebase}/document/entity_{$old_p_entity_id}_{$old_p_cat_id}/{$old_p_num}/{$old_doc_type}/$old_document_name";
                                }
                                else
                                {
-                                       $file = $this->fakebase. '/' . 
'document' . '/' . $old_loc1 . '/' . $old_document_name;
+                                       $file = 
"{$this->fakebase}/document/{$old_location_code}/{$old_doc_type}/{$old_document_name}";
                                }
 
                                $receipt= $this->delete_file($file);
+                       */
                        }
 
                        if($document['link'])
@@ -579,18 +610,122 @@
                                'address'               =>$address
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE fm_document set $value_set 
$vals WHERE id= '" . $document['document_id'] ."'",__LINE__,__FILE__);
 
                        $receipt['document_id'] = $document['document_id'];
                        $receipt['message'][] = array('msg'=>lang('document %1 
has been edited',"'".$document['title']."'"));
                        return $receipt;
+               }
 
+               /**
+                * Get a list of doc-types , included subtypes
+                *
+                * @param int $doc_type the parent doc-type
+                * @return array parent and children
+                */
+
+               function get_sub_doc_types($doc_type = 0)
+               {
+                       $doc_types = array();
+                       if($doc_type)
+                       {
+                               $doc_types[] = $doc_type;
+                               $cat_sub = 
$this->cats->return_sorted_array($start = 0,$limit = false,$query = '',$sort = 
'',$order = '',$globals = False, $parent_id = $doc_type);
+                               foreach ($cat_sub as $doc_type)
+                               {
+                                       $doc_types[] = $doc_type['id'];
+                               }
+                       }
+                       return $doc_types;
                }
 
+
+               /**
+                * Get a hierarchical array of doc-types with number of hits 
for each level at locatin and link to list.
+                * Basis for the folder-menu
+                *
+                * @param string $location_code location_code in the (physical) 
location-hierarchy
+                * @return array parent and children
+                */
+
+               function get_files_at_location($location_code)
+               {
+                       $documents = array();
+                       $sql = "SELECT count(*) as hits FROM fm_document WHERE 
location_code $this->like '$location_code%'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if($this->db->next_record())
+                       {
+                               $hits = (int) $this->db->f('hits');
+
+                               $x = 0; // within level
+                               $y = 0; //level
+                               $cache_x_at_y[$y] = $x;
+                               $documents[$x] = array
+                               (
+                                       'link'  => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.list_doc','location_code'=> $location_code)),
+                                       'text'          => lang('documents') . 
' [' . $hits . ']:',
+                                       'descr'         => 
lang('Documentation'),
+                                       'level'         => 0
+                               );
+                       }
+                       else
+                       {
+                               return $documents;
+                       }
+
+                       $categories = $this->cats->return_sorted_array(0, 
false);
+
+                       foreach ($categories as $category)
+                       {                       
+                               $doc_types = 
$this->get_sub_doc_types($category['id']);
+
+                               $sql = "SELECT count(*) as hits FROM 
fm_document WHERE location_code $this->like '$location_code%' AND category IN 
(". implode(',', $doc_types) . ')';
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $hits = (int) $this->db->f('hits');
+
+                               $level = $category['level']+1;
+                               if($level == $y)
+                               {
+                                       $x++;
+                               }
+                               else if($level < $y )
+                               {
+                                       $x = $cache_x_at_y[$level]+1;
+                               }
+                               else if($level > $y )
+                               {
+                                       $x = 0;
+                               }
+                               $y = $level;
+
+                                       $map = '$documents'; 
+                                       for ($i = 0; $i < $level ; $i++)
+                                       {
+                                               
+                                               $map .= '[' . $cache_x_at_y[$i] 
."]['children']"; 
+                                       }
+
+                                       $map .= '[]'; 
+
+                                       eval($map . ' =array('
+                                       .       "'link' => '" . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.list_doc','location_code'=> $location_code, 'doc_type'=> 
$category['id'])) . "',\n"
+                                       .       "'text'                 => '" . 
$category['name'] . ' [' . $hits . ']' . "',\n"
+                                       .       "'descr'                => '" . 
lang('Documentation') . "',\n"
+                                       .       "'level'                => "  . 
($category['level']+1) . "\n"
+                                        . ');');
+
+                               $cache_x_at_y[$y] = $x;
+                       }
+
+                       return $documents;
+               }
+
                function delete_file($file)
                {
+                       $receipt = array();
                        if($this->vfs->file_exists(array(
                                        'string' => $file,
                                        'relatives' => Array(RELATIVE_NONE)
@@ -605,52 +740,51 @@
                                     )
                                )))
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'. 
$this->fakebase. '/' . 'document'. '/' . $document_name);
+                                       
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'. $file);
                                }
                                else
                                {
-                                       
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'. 
$this->fakebase. '/' . 'document'. '/' . $document_name);
+                                       
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'. $file);
                                }
                                $this->vfs->override_acl = 0;
                        }
-
+                       return $receipt;
                }
 
-               function delete($document_id )
+               function delete($document_id)
                {
-                       $this->db->query("SELECT 
document_name,location_code,p_num,p_entity_id,p_cat_id FROM fm_document where 
id='$document_id'",__LINE__,__FILE__);
+                       $receipt = array();
+                       $document_id = (int) $document_id;
+                       $this->db->query("SELECT 
document_name,location_code,p_num,p_entity_id,p_cat_id,category FROM 
fm_document where id='$document_id'",__LINE__,__FILE__);
                        $this->db->next_record();
                        $document_name  = $this->db->f('document_name');
                        $location_code  = $this->db->f('location_code');
-                       $p_num                  = $this->db->f('p_num');
                        $p_entity_id    = $this->db->f('p_entity_id');
                        $p_cat_id               = $this->db->f('p_cat_id');
+                       $p_num          = $this->db->f('p_num');
+                       $category       = $this->db->f('category');
 
-                       $location               = split("-", $location_code);
-                       $loc1   = $location[0];
-                       if($p_cat_id)
-                       {
-                               $boadmin_entity         = 
CreateObject('property.boadmin_entity');
-                               $entity = 
$boadmin_entity->read_single($p_entity_id,false);
-                               $category = 
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
-                       }
-
                        if($document_name)
                        {
-                               if($p_num)
+                               if($p_cat_id > 0)
                                {
-                                       $file = $this->fakebase. '/' . 
'document' . '/' . $loc1 . '/' . $entity['name'] . '/' . $category['name'] . 
'/' . $p_num . '/' . $document_name;
+                                       $file = 
"{$this->fakebase}/document/entity_{$p_entity_id}_{$p_cat_id}/{$p_num}/{$category}/$document_name";
                                }
                                else
                                {
-                                       $file = $this->fakebase. '/' . 
'document' . '/' . $loc1 . '/' . $document_name;
+                                       $file = 
"{$this->fakebase}/document/{$location_code}/{$category}/{$document_name}";
                                }
 
                                $receipt= $this->delete_file($file);
                        }
-
-                       $this->db->query("DELETE FROM fm_document WHERE 
id='$document_id'",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_document_history  
WHERE  history_record_id='$document_id'",__LINE__,__FILE__);
+                       if(!isset($receipt['error']))
+                       {
+                               $this->db->transaction_begin();
+                               $this->db->query("DELETE FROM fm_document WHERE 
id={$document_id}",__LINE__,__FILE__);
+                               $this->db->query("DELETE FROM 
fm_document_history  WHERE  
history_record_id={$document_id}",__LINE__,__FILE__);
+                               $this->db->transaction_commit();
+                       }
+                       return $receipt;
                }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soentity.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -40,18 +40,19 @@
                var $uicols;
                var $cols_extra;
                var $cols_return_lookup;
+               var $type = 'entity';
+               var $type_app;
 
-               function property_soentity($entity_id='',$cat_id='')
+               function __construct($entity_id='',$cat_id='')
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db           = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
+                       $this->custom           = 
createObject('property.custom_fields');
+                       $this->db           = & $GLOBALS['phpgw']->db;
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
                        $this->entity_id        = $entity_id;
                        $this->cat_id           = $cat_id;
                }
@@ -63,7 +64,7 @@
                                return;
                        }
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
 
                        $sql= "SELECT phpgw_cust_choice.id, 
phpgw_cust_choice.value FROM phpgw_cust_attribute"
                        . " $this->join phpgw_cust_choice ON"
@@ -105,6 +106,9 @@
                                $status                 = 
isset($data['status']) ? $data['status'] : '';
                                $start_date             = 
isset($data['start_date']) ? $data['start_date'] : '';
                                $end_date               = 
isset($data['end_date']) ? $data['end_date'] : '';
+                               $dry_run                = 
isset($data['dry_run']) ? $data['dry_run'] : '';
+                               $this->type             = isset($data['type']) 
&& $data['type'] ? $data['type'] : $this->type;
+                               $location_code  = isset($data['location_code']) 
? $data['location_code'] : '';
                        }
 
                        if(!$entity_id || !$cat_id)
@@ -112,66 +116,99 @@
                                return;
                        }
 
-                       $grants         = 
$GLOBALS['phpgw']->session->appsession('grants_entity_'.$entity_id.'_'.$cat_id,'property');
+                       $grants         = 
$GLOBALS['phpgw']->session->appsession('grants_entity_'.$entity_id.'_'.$cat_id,$this->type_app[$this->type]);
 
                        if(!$grants)
                        {
                                $this->acl      = & $GLOBALS['phpgw']->acl;
-                               $grants         = 
$this->acl->get_grants('property','.entity.' . $entity_id . '.' . $cat_id);
-                               
$GLOBALS['phpgw']->session->appsession('grants_entity_'.$entity_id.'_'.$cat_id,'property',$grants);
+                               $grants         = 
$this->acl->get_grants($this->type_app[$this->type],".{$this->type}.{$entity_id}.{$cat_id}");
+                               
$GLOBALS['phpgw']->session->appsession('grants_entity_'.$entity_id.'_'.$cat_id, 
$this->type_app[$this->type], $grants);
                        }
 
-                       $sql = $this->bocommon->fm_cache('sql_entity_' . 
$entity_id . '_' . $cat_id . '_' . $lookup);
+                       $sql = 
$this->bocommon->fm_cache("sql_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
 
                        $admin_entity   = 
CreateObject('property.soadmin_entity');
+                       $admin_entity->type = $this->type;
+
                        $category = 
$admin_entity->read_single_category($entity_id,$cat_id);
 
-                       $entity_table = 'fm_entity_' . $entity_id . '_' . 
$cat_id;
+                       $entity_table = 
"fm_{$this->type}_{$entity_id}_{$cat_id}";
                        $choice_table = 'phpgw_cust_choice';
                        $attribute_table = 'phpgw_cust_attribute';
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
                        $attribute_filter = " location_id = {$location_id}";
 
                        if(!$sql)
                        {
+                               $cols_return_extra      = array();
+                               $cols_return            = array();
+                               $uicols                         = array();
                                $cols = $entity_table . '.*';
+
                                $cols_return[] = 'location_code';
+                               $uicols['input_type'][]         = 'hidden';
+                               $uicols['name'][]                       = 
'location_code';
+                               $uicols['descr'][]                      = 
'dummy';
+                               $uicols['statustext'][]         = 'dummy';
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
 
                                $cols_return[]                  = 'num';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]               = 'num';
                                $uicols['descr'][]              = lang('ID');
                                $uicols['statustext'][]         = lang('ID');
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
 
                                $cols_return[]                  = 'id';
                                $uicols['input_type'][]         = 'hidden';
                                $uicols['name'][]               = 'id';
                                $uicols['descr'][]              = false;
                                $uicols['statustext'][]         = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+
                                if($lookup)
                                {
                                        $cols .= ',num as entity_num_' . 
$entity_id;
                                        $cols_return[] = 'entity_num_' . 
$entity_id;
+                                       $uicols['input_type'][]         = 
'hidden';
+                                       $uicols['name'][]                       
= 'entity_num_' . $entity_id;
+                                       $uicols['descr'][]                      
= 'dummy';
+                                       $uicols['statustext'][]         = 
'dummy';
+                                       $uicols['align'][]                      
= '';
+                                       $uicols['datatype'][]           = '';
                                }
 
-                               $cols .= ',account_lid';
-                               $cols_return[]                          = 
'account_lid';
+                               $cols .= ", {$entity_table}.user_id";
+                               $cols_return[]                          = 
'user_id';
                                $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 
'account_lid';
+                               $uicols['name'][]                       = 
'user_id';
                                $uicols['descr'][]                      = 
lang('User');
                                $uicols['statustext'][]         = lang('User');
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = 'user';
 
-                               $joinmethod = " $this->join phpgw_accounts ON 
($entity_table.user_id = phpgw_accounts.account_id))";
-                               $paranthesis ='(';
+                               $cols_return_extra[]= array
+                                                               (
+                                                                       'name'  
        => 'user_id',
+                                                                       
'datatype'      => 'user'
+                                                               );
 
+                               // Don't work with LDAP - where phpgw_accounts 
is empty
+       //                      $joinmethod = " $this->join phpgw_accounts ON 
($entity_table.user_id = phpgw_accounts.account_id))";
+       //                      $paranthesis ='(';
+
                                $sql = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols_return'=>$cols_return,'cols'=>$cols,
                                                                
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,'lookup'=>$lookup,'location_level'=>$category['location_level']));
 
-                               $this->bocommon->fm_cache('sql_entity_' . 
$entity_id . '_' . $cat_id . '_' . $lookup,$sql);
-                               $this->bocommon->fm_cache('uicols_entityt_' . 
$entity_id . '_' . $cat_id . '_' . $lookup,$this->bocommon->uicols);
-                               
$this->bocommon->fm_cache('cols_return_entityt_' . $entity_id . '_' . $cat_id . 
'_' . $lookup,$this->bocommon->cols_return);
-                               
$this->bocommon->fm_cache('cols_return_lookup_entityt_' . $entity_id . '_' . 
$cat_id . '_' . $lookup,$this->bocommon->cols_return_lookup);
-                               $this->bocommon->fm_cache('cols_extra_entityt_' 
. $entity_id . '_' . $cat_id . '_' . $lookup,$this->bocommon->cols_extra);
+                               
$this->bocommon->fm_cache("sql_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}", 
$sql);
+                               
$this->bocommon->fm_cache("uicols_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->uicols);
+                               
$this->bocommon->fm_cache("cols_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->cols_return);
+                               
$this->bocommon->fm_cache("cols_return_lookup_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->cols_return_lookup);
+                               
$this->bocommon->fm_cache("cols_extra_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->cols_extra);
+                               
$this->bocommon->fm_cache("cols_extra_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $cols_return_extra);
 
                                $uicols                         = 
$this->bocommon->uicols;
                                $cols_return                    = 
$this->bocommon->cols_return;
@@ -180,24 +217,25 @@
                        }
                        else
                        {
-                               $uicols                         = 
$this->bocommon->fm_cache('uicols_entityt_' . $entity_id . '_' . $cat_id . '_' 
. $lookup);
-                               $cols_return                    = 
$this->bocommon->fm_cache('cols_return_entityt_' . $entity_id . '_' . $cat_id . 
'_' . $lookup);
-                               $this->cols_return_lookup       = 
$this->bocommon->fm_cache('cols_return_lookup_entityt_' . $entity_id . '_' . 
$cat_id . '_' . $lookup);
-                               $this->cols_extra               = 
$this->bocommon->fm_cache('cols_extra_entityt_' . $entity_id . '_' . $cat_id . 
'_' . $lookup);
+                               $uicols                                         
= 
$this->bocommon->fm_cache("uicols_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
+                               $cols_return                            = 
$this->bocommon->fm_cache("cols_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
+                               $this->cols_return_lookup       = 
$this->bocommon->fm_cache("cols_return_lookup_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
+                               $this->cols_extra                       = 
$this->bocommon->fm_cache("cols_extra_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
+                               $cols_return_extra                      = 
$this->bocommon->fm_cache("cols_extra_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
                        }
 
                        if ($cat_id > 0)
                        {
 //-------------------
 
-                               $user_columns = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['entity_columns_'.$entity_id.'_'.$cat_id])?$GLOBALS['phpgw_info']['user']['preferences']['property']['entity_columns_'.$entity_id.'_'.$cat_id]:'';
+                               $user_columns = 
isset($GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]['entity_columns_'.$entity_id.'_'.$cat_id])?$GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]['entity_columns_'.$entity_id.'_'.$cat_id]:'';
                                $user_column_filter = '';
                                if (isset($user_columns) AND 
is_array($user_columns) AND $user_columns[0])
                                {
                                        $user_column_filter = " OR 
($attribute_filter AND id IN (" . implode(',',$user_columns) .'))';
                                }
 
-                               $this->db->query("SELECT * FROM 
$attribute_table WHERE list=1 AND $attribute_filter $user_column_filter ORDER 
BY attrib_sort ASC");
+                               $this->db->query("SELECT * FROM 
$attribute_table WHERE list=1 AND $attribute_filter $user_column_filter ORDER 
BY group_id, attrib_sort ASC");
 
                                $i      = count($uicols['name']);
                                while ($this->db->next_record())
@@ -207,6 +245,14 @@
                                        $uicols['descr'][]                      
= $this->db->f('input_text');
                                        $uicols['statustext'][]         = 
$this->db->f('statustext');
                                        $uicols['datatype'][$i]         = 
$this->db->f('datatype');
+                                       $uicols['cols_return_extra'][$i] = array
+                                       (
+                                               'name'  => 
$this->db->f('column_name'),
+                                               'datatype'      => 
$this->db->f('datatype'),
+                                               'attrib_id'     => 
$this->db->f('id')                                   
+                                       );
+                                       
+                                       
                                        $cols_return_extra[]= array(
                                                'name'  => 
$this->db->f('column_name'),
                                                'datatype'      => 
$this->db->f('datatype'),
@@ -220,7 +266,14 @@
                                $uicols['name'][]                       = 
'entry_date';
                                $uicols['descr'][]                      = 
lang('entry date');
                                $uicols['statustext'][]         = lang('entry 
date' );
-                               $uicols['datatype'][$i]         = 'timestamp';
+                               $uicols['datatype'][]           = 'timestamp';
+                               $uicols['cols_return_extra'][$i] = array
+                               (
+                                       'name'          => 'entry_date',
+                                       'datatype'      => 'timestamp',
+                               );
+
+
                                $cols_return_extra[]= array(
                                        'name'  => 'entry_date',
                                        'datatype'      => 'timestamp',
@@ -236,7 +289,14 @@
 //_debug_array($cols_return_extra);
                        if ($order)
                        {
-                               $ordermethod = " order by $entity_table.$order 
$sort";
+                               switch($order)
+                               {
+                                       case 'user_id':
+               //                              $ordermethod = " ORDER BY 
phpgw_accounts.account_lastname {$sort}";  // Don't work with LDAP. 
+                                               break;
+                                       default:
+                                               $ordermethod = " ORDER BY 
$entity_table.$order $sort";  
+                               }
                        }
                        else
                        {
@@ -246,7 +306,7 @@
                        $where= 'WHERE';
                        $filtermethod = '';
 
-                       $GLOBALS['phpgw']->config->read_repository();
+                       $GLOBALS['phpgw']->config->read();
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location'])
                                && 
$GLOBALS['phpgw']->config->config_data['acl_at_location']
                                && $category['location_level'] > 0)
@@ -284,7 +344,7 @@
 
                        if ($district_id > 0)
                        {
-                               $filtermethod .= " $where  
district_id='$district_id' ";
+                               $filtermethod .= " $where  
fm_part_of_town.district_id='$district_id' ";
                                $where = 'AND';
                        }
 
@@ -294,6 +354,12 @@
                                $where= 'AND';
                        }
 
+                       if ($location_code)
+                       {
+                               $filtermethod .= " $where 
$entity_table.location_code $this->like '$location_code%'";
+                               $where= 'AND';                  
+                       }
+
                        $querymethod = '';
                        if($query)
                        {
@@ -341,11 +407,17 @@
 
                        $sql .= " $filtermethod $querymethod";
 
-//echo $sql;
+//_debug_array($sql);
                        $this->db->query('SELECT count(*)' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
                        $this->db->next_record();
                        $this->total_records = $this->db->f(0);
 
+                       if($dry_run)
+                       {
+                               return array();
+                       }
+                       else
+                       {
                        if(!$allrows)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -354,102 +426,49 @@
                        {
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
+                       }
 
                        $j=0;
-                       $n=count($cols_return);
-//_debug_array($cols_return);
-                       $contacts                       = 
CreateObject('phpgwapi.contacts');
-
-                       $entity_list = array();
+                       $cols_return = $uicols['name'];
+                       $dataset = array();
                        while ($this->db->next_record())
                        {
-                               for ($i=0;$i<$n;$i++)
-                               {
-                                       $entity_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
-                                       $entity_list[$j]['grants'] = 
(int)$grants[$this->db->f('user_id')];
-                                       if($lookup)
-                                       {
-                                               
$entity_list[$j]['entity_cat_name_' . $entity_id] = $category['name'];
-                                               $entity_list[$j]['entity_id_' . 
$entity_id] = $entity_id;
-                                               $entity_list[$j]['cat_id_' . 
$entity_id] = $cat_id;
-                                       }
-                               }
-
-                               if(isset($cols_return_extra) && 
is_array($cols_return_extra))
-                               {
-                                       for 
($i=0;$i<count($cols_return_extra);$i++)
-                                       {
-                                               $value = 
$this->db->f($cols_return_extra[$i]['name'], true);
-
-                                               
if(($cols_return_extra[$i]['datatype']=='R' || 
$cols_return_extra[$i]['datatype']=='LB') && $value)
-                                               {
-                                                       $sql="SELECT value FROM 
$choice_table WHERE $attribute_filter AND attrib_id=" 
.$cols_return_extra[$i]['attrib_id']. "  AND id=" . $value;
-                                                       $this->db2->query($sql);
-                                                       
$this->db2->next_record();
-                                                       
$entity_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('value');
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='AB' && $value)
-                                               {
-                                                       $contact_data   = 
$contacts->read_single_entry($value,array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-                                                       
$entity_list[$j][$cols_return_extra[$i]['name']]        = 
$contact_data[0]['n_family'] . ', ' . $contact_data[0]['n_given'];
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='VENDOR' && $value)
-                                               {
-                                                       $sql="SELECT org_name 
FROM fm_vendor where id=$value";
-                                                       $this->db2->query($sql);
-                                                       
$this->db2->next_record();
-                                                       
$entity_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('org_name');
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='CH' && $value)
-                                               {
-                                                       $ch= 
unserialize($value);
-
-                                                       if (isset($ch) AND 
is_array($ch))
+                               foreach($cols_return as $key => $field)
                                                        {
-                                                               for 
($k=0;$k<count($ch);$k++)
-                                                               {
-                                                                       
$sql="SELECT value FROM $choice_table WHERE $attribute_filter AND attrib_id=" 
.$cols_return_extra[$i]['attrib_id']. "  AND id=" . $ch[$k];
-                                                                       
$this->db2->query($sql);
-                                                                       while 
($this->db2->next_record())
-                                                                       {
-                                                                               
$ch_value[]=$this->db2->f('value');
-                                                                       }
-                                                               }
-                                                               
$entity_list[$j][$cols_return_extra[$i]['name']] = @implode(",", $ch_value);
-                                                               
unset($ch_value);
-                                                       }
+                                       $dataset[$j][$field] = array
+                                       (
+                                               'value'         => 
$this->db->f($field),
+                                               'datatype'      => 
$uicols['datatype'][$key],
+                                               'attrib_id'     => 
$uicols['cols_return_extra'][$key]['attrib_id']
+                                       );
                                                }
-                                               else 
if($cols_return_extra[$i]['datatype']=='D' && $value)
+                               if($lookup)
                                                {
-                                                       
$entity_list[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($value));
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='timestamp' && $value)
-                                               {
-                                                       
$entity_list[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$value);
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='link' && $value)
-                                               {
-                                                       
$entity_list[$j][$cols_return_extra[$i]['name']]= phpgw::safe_redirect($value);
-                                               }
-                                               else
-                                               {
-                                                       
$entity_list[$j][$cols_return_extra[$i]['name']] = $value;
-                                               }
+                                       
$dataset[$j]["entity_cat_name_{$entity_id}"] = array
+                                       (
+                                               'value'         => 
$category['name'],
+                                               'datatype'      => false,
+                                               'attrib_id'     => false
+                                       );
+                                       $dataset[$j]["entity_id_{$entity_id}"] 
= array
+                                       (
+                                               'value'         => $entity_id,
+                                               'datatype'      => false,
+                                               'attrib_id'     => false
+                                       );
+                                       $dataset[$j]["cat_id_{$entity_id}"] = 
array
+                                       (
+                                               'value'         => $cat_id,
+                                               'datatype'      => false,
+                                               'attrib_id'     => false
+                                       );
                                        }
+                               $j++;                           
                                }
 
-                               $location_code= $this->db->f('location_code');
-                               $location = split('-',$location_code);
-                               for ($m=0;$m<count($location);$m++)
-                               {
-                                       $entity_list[$j]['loc' . ($m+1)] = 
$location[$m];
-                                       
$entity_list[$j]['query_location']['loc' . ($m+1)]=implode("-", 
array_slice($location, 0, ($m+1)));
-                               }
+                       $values = $this->custom->translate_value($dataset, 
$location_id);
 
-                               $j++;
-                       }
-//_debug_array($entity_list);
-                       return $entity_list;
+                       return $values;
                }
 
                function read_single($data,$values = array())
@@ -457,7 +476,7 @@
                        $entity_id =$data['entity_id'];
                        $cat_id =$data['cat_id'];
                        $id =$data['id'];
-                       $table='fm_entity_' . $entity_id .'_' . $cat_id;
+                       $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";
 
                                $this->db->query("SELECT * FROM $table WHERE id 
=$id");
 
@@ -489,7 +508,7 @@
 
                function check_entity($entity_id,$cat_id,$num)
                {
-                       $table='fm_entity_' . $entity_id .'_' . $cat_id;
+                       $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";
                        $this->db->query("SELECT count(*) FROM $table where 
num='$num'");
 
                        $this->db->next_record();
@@ -502,7 +521,7 @@
 
                function generate_id($data)
                {
-                       $table='fm_entity_' . $data['entity_id'] .'_' . 
$data['cat_id'];
+                       $table = 
"fm_{$this->type}_{$data['entity_id']}_{$data['cat_id']}";
                        $this->db->query("select max(id) as id from $table");
                        $this->db->next_record();
                        $id = $this->db->f('id')+1;
@@ -512,7 +531,7 @@
 
                function generate_num($entity_id,$cat_id,$id)
                {
-                       $this->db->query("select prefix from fm_entity_category 
WHERE entity_id=$entity_id AND id=$cat_id ");
+                       $this->db->query("select prefix from 
fm_{$this->type}_category WHERE entity_id=$entity_id AND id=$cat_id ");
                        $this->db->next_record();
                        $prefix = $this->db->f('prefix');
 
@@ -533,6 +552,9 @@
 
                function add($values,$values_attribute,$entity_id,$cat_id)
                {
+                       $cols = array();
+                       $vals = array();
+
                        if(isset($values['street_name']) && 
$values['street_name'])
                        {
                                $address[]= $values['street_name'];
@@ -542,9 +564,21 @@
 
                        if(!isset($address) || !$address)
                        {
-                               $address = 
$this->db->db_addslashes($values['location_name']);
+                               $address = isset($values['location_name']) ? 
$this->db->db_addslashes($values['location_name']) : '';
                        }
 
+                       if(isset($address) && $address)
+                       {
+                               $cols[] = 'address';
+                               $vals[] = $address;
+                       }
+
+                       if (isset($values['location_code']) && 
$values['location_code'])
+                       {
+                               $cols[] = 'location_code';
+                               $vals[] = $values['location_code'];             
        
+                       }
+
                        if(isset($values['location']) && 
is_array($values['location']))
                        {
                                foreach ($values['location'] as $input_name => 
$value)
@@ -596,17 +630,21 @@
                                $cols   = "," . implode(",", $cols);
                                $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
                        }
+                       else
+                       {
+                               $cols = '';
+                               $vals = '';
+                       }
 
-                       $table='fm_entity_' . $entity_id .'_' . $cat_id;
+                       $table = "fm_{$this->type}_{$entity_id}_$cat_id";
+                       $this->db->transaction_begin();
+                       $values['id'] = 
$this->generate_id(array('entity_id'=>$entity_id,'cat_id'=>$cat_id));
                        
$num=$this->generate_num($entity_id,$cat_id,$values['id']);
-                       $this->db->transaction_begin();
 
-                       $this->db->query("INSERT INTO $table 
(id,num,address,location_code,entry_date,user_id $cols) "
+                       $this->db->query("INSERT INTO $table 
(id,num,entry_date,user_id $cols) "
                                . "VALUES ("
                                . $values['id']. ",'"
-                               . $num . "','"
-                               . $address. "','"
-                               . $values['location_code']. "',"
+                               . $num . "',"
                                . time() . ","
                                . $this->account. " $vals)",__LINE__,__FILE__);
 
@@ -618,7 +656,7 @@
                                        (
                                                'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$values['origin'][0]['location']),
                                                'location1_item_id' => 
$values['origin'][0]['data'][0]['id'],
-                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}"),
+                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
".{$this->type}.{$entity_id}.{$cat_id}"),
                                                'location2_item_id' => 
$values['id'],
                                                'account_id'            => 
$this->account
                                        );
@@ -630,7 +668,7 @@
 
                        if (isset($history_set) AND is_array($history_set))
                        {
-                               $historylog     = 
CreateObject('property.historylog','entity_' . $entity_id .'_' . $cat_id);
+                               $historylog     = 
CreateObject('property.historylog',"{$this->type}_{$entity_id}_{$cat_id}");
                                foreach ($history_set as $attrib_id => 
$new_value)
                                {
                                        
$historylog->add('SO',$values['id'],$new_value,false, $attrib_id);
@@ -639,37 +677,51 @@
 
                        $this->db->transaction_commit();
 
+                       $receipt = array();
+                       $receipt['id'] = $values['id'];
                        $receipt['message'][] = array('msg'=>lang('Entity %1 
has been saved',$values['id']));
                        return $receipt;
                }
 
                function edit($values,$values_attribute,$entity_id,$cat_id)
                {
+                       $receipt        = array();
+                       $value_set      = array();
+                       $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";
+
                        if(isset($values['street_name']) && 
$values['street_name'])
                        {
                                $address[]= $values['street_name'];
                                $address[]= $values['street_number'];
-                               $address        = implode(" ", $address);
+                               $value_set['address'] = 
$this->db->db_addslashes(implode(" ", $address));
                        }
 
                        if(!isset($address) || !$address)
                        {
-                               $address = $values['location_name'];
+                               $address = isset($values['location_name']) ? 
$this->db->db_addslashes($values['location_name']) : '';
+                               if($address)
+                               {
+                                       $value_set['address'] = $address;
+                               }
                        }
 
-                       $value_set=array(
-                               'location_code' => $values['location_code'],
-                               'address'       => 
$this->db->db_addslashes($address)
-                               );
+                       if (isset($values['location_code']) && 
$values['location_code'])
+                       {
+                                       $value_set['location_code'] = 
$values['location_code'];
+                       }
 
                        $admin_location = 
CreateObject('property.soadmin_location');
                        $admin_location->read(false);
 
                        // Delete old values for location - in case of moving 
up in the hierarchy
+                       $metadata = $this->db->metadata($table);
                        for ($i = 1;$i < $admin_location->total_records + 1; 
$i++)
                        {
+                               if(isset($metadata["loc{$i}"]))
+                               {
                                $value_set["loc{$i}"]   = false;
                        }
+                       }
 
                        if(isset($values['location']) && 
is_array($values['location']))
                        {
@@ -687,14 +739,11 @@
                                }
                        }
 
-//_debug_array($values_attribute);
-                       $table = 'fm_entity_' . $entity_id .'_' . $cat_id;
-
                        if (isset($values_attribute) AND 
is_array($values_attribute))
                        {
                                foreach($values_attribute as $entry)
                                {
-                                       if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR')
+                                       if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR' && $entry['datatype']!='user' && 
$entry['datatype']!='event')
                                        {
                                                if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] == 
'link')
                                                {
@@ -736,7 +785,7 @@
                        }
 
 //_debug_array($history_set);
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->transaction_begin();
 
@@ -744,7 +793,7 @@
 
                        if (isset($history_set) AND is_array($history_set))
                        {
-                               $historylog     = 
CreateObject('property.historylog','entity_' . $entity_id .'_' . $cat_id);
+                               $historylog     = 
CreateObject('property.historylog',"{$this->type}_{$entity_id}_{$cat_id}");
                                foreach ($history_set as $attrib_id => $history)
                                {
                                        
$historylog->add('SO',$values['id'],$history['value'],false, 
$attrib_id,$history['date']);
@@ -753,14 +802,15 @@
 
                        $this->db->transaction_commit();
 
+                       $receipt['id'] = $values['id'];
                        $receipt['message'][] = array('msg'=>lang('entity %1 
has been edited',$values['num']));
                        return $receipt;
                }
 
                function delete($entity_id,$cat_id,$id )
                {
-                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");                   
-                       $table='fm_entity_' . $entity_id .'_' . $cat_id;
+                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");                  
+                       $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";
                        $this->db->transaction_begin();
                        $this->db->query("DELETE FROM $table WHERE 
id=$id",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM phpgw_interlink WHERE 
location2_id ={$location2_id} AND location2_item_id = {$id}",__LINE__,__FILE__);
@@ -778,7 +828,7 @@
                                return;
                        }
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
 
                        $this->db->query("SELECT helpmsg FROM 
fphpgw_cust_attribute WHERE location_id = {$location_id} AND id =" . 
(int)$attrib_id );
 

Added: people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,507 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage admin
+       * @version $Id$
+       */
+
+       /*
+        * Import the datetime class for date processing
+        */
+       phpgw::import_class('phpgwapi.datetime');
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_soevent
+       {
+
+               function __construct()
+               {
+                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->_db                      = & 
$GLOBALS['phpgw']->db;
+                       $this->_join            = & $this->_db->loin;
+                       $this->_like            = & $this->_db->like;
+               }
+
+               function read($data)
+               {
+                       if(!isset($data['location_id']) || 
!$data['location_id'])
+                       {
+                               if(!isset($data['appname']) || 
!$data['appname'] || !isset($data['location']) || !$data['location'])
+                               {
+                                       throw new 
Exception("property_soevent::read - Missing location info in input");
+                               }
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($data['appname'], $data['location']);
+                       }
+                       else
+                       {
+                               $location_id = (int) $data['location_id'];
+                       }
+
+                       $location_item_id       = 
isset($data['location_item_id']) && $data['location_item_id'] ? 
(int)$data['location_item_id'] : '';
+                       $start                          = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
+                       $query                          = isset($data['query']) 
? $data['query'] : '';
+                       $sort                           = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
+                       $order                          = isset($data['order']) 
? $data['order'] : '';
+                       $allrows                        = 
isset($data['allrows']) ? $data['allrows'] : '';
+
+                       if(!isset($data['location_item_id']) || 
!$data['location_item_id'])
+                       {
+                               throw new Exception("property_soevent::read - 
Missing location_item_id in input");
+                       }
+
+                       $location_item_id       = $data['location_item_id'];
+
+                       $events = array();
+
+                       $table = 'fm_event';
+
+                       $filtermethod = "WHERE location_id = {$location_id}";
+                       
+                       if($location_item_id)
+                       {
+                               $filtermethod .= " AND location_item_id = 
{$location_item_id}";
+                       }
+                       
+                       if($query)
+                       {
+                               $query = $this->_db->db_addslashes($query);
+
+                               $querymethod = " AND id $this->_like '%$query%' 
OR descr $this->_like '%$query%'";
+                       }
+
+                       $sql = "SELECT * FROM {$table} {$filtermethod} 
{$querymethod}";
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->_db->num_rows();
+
+                       if(!$allrows)
+                       {
+                               $this->_db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->_db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+
+                       while ($this->_db->next_record())
+                       {
+                               $events[] = array
+                               (
+                                       'id'    => $this->_db->f('id'),
+                                       'descr' => $this->_db->f('descr')
+                               );
+                       }
+                       return $events;
+               }
+
+               function read_single($id)
+               {
+                       $values = array();
+
+                       $table = 'fm_event';
+
+                       $sql = "SELECT * FROM $table WHERE id='{$id}'";
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       if ($this->_db->next_record())
+                       {
+                               $start_date             = 
$this->_db->f('start_date');
+                               $end_date               = 
$this->_db->f('end_date');                            
+                               $values = array
+                               (
+                                       'id'                            => 
$this->_db->f('id'),
+                                       'descr'                         => 
$this->_db->f('descr', true),
+                                       'start_date'            => $start_date,
+                                       'responsible'           => 
$this->_db->f('responsible_id'),
+                                       'action'                        => 
$this->_db->f('action_id'),
+                                       'end_date'                      => 
$end_date,
+                                       'repeat_type'           => 
$this->_db->f('repeat_type'),
+                                       'rpt_day'                       => 
(int)$this->_db->f('repeat_day'),
+                                       'repeat_interval'       => 
$this->_db->f('repeat_interval'),
+                                       'enabled'                       => 
$this->_db->f('enabled'),
+                                       'user_id'                       => 
$this->_db->f('user_id'),
+                                       'entry_date'            => 
$this->_db->f('entry_date'),
+                                       'modified_date'         => 
$this->_db->f('modified_date'),
+                                       'location_id'           => 
$this->_db->f('location_id'),
+                                       'location_item_id'      => 
$this->_db->f('location_item_id'),
+                                       'attrib_id'                     => 
$this->_db->f('attrib_id')
+                               );
+
+                               $values['start']['month']       = 
date('m',$start_date);
+                               $values['start']['mday']        = 
date('d',$start_date);
+                               $values['start']['year']        = 
date('Y',$start_date);
+                               $values['start']['hour']        = 
date('G',$start_date);
+                               $values['start']['min']         = 
date('i',$start_date);
+                               $values['start']['sec']         = 
date('s',$start_date);
+
+                               $values['end']['month'] = $end_date ? 
date('m',$end_date) : 0;
+                               $values['end']['mday']  = $end_date ? 
date('d',$end_date) : 0;
+                               $values['end']['year']  = $end_date ? 
date('Y',$end_date) : 0;
+                               $values['end']['hour']  = $end_date ? 
date('G',$end_date) : 0;
+                               $values['end']['min']   = $end_date ? 
date('i',$end_date) : 0;
+                               $values['end']['sec']   = $end_date ? 
date('s',$end_date) : 0;
+
+                               $sql = "SELECT * FROM fm_event_exception WHERE 
event_id ='{$id}'";
+
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               while ($this->_db->next_record())
+                               {
+                                       $values['repeat_exception'][] = 
$this->_db->f('exception_time');
+                               }
+                       }
+
+                       return $values;
+               }
+
+               function add($data)
+               {
+                       $receipt = array();
+                       $table = 'fm_event';
+
+                       $data['descr'] = 
$this->_db->db_addslashes($data['descr']);
+
+                       $cols = array
+                       (
+                               'location_id',
+                               'location_item_id',
+                               'attrib_id',
+                               'descr',
+                               'start_date',
+                               'responsible_id',
+                               'action_id',
+                               'end_date',
+                               'repeat_type',
+                               'repeat_day',
+                               'repeat_interval',
+                               'enabled',
+                               'user_id',
+                               'entry_date'
+                       );
+
+                       $repeat_day = 0;
+                       if(isset($data['repeat_day']) && 
is_array($data['repeat_day']))
+                       {
+                               foreach ($data['repeat_day'] as $day)
+                               {
+                                       $repeat_day |= $day;
+                               }
+                       }
+
+                       $vals = array
+                       (
+                               $data['location_id'],
+                               $data['item_id'],
+                               $data['attrib_id'],
+                               $data['descr'],                         
+                               $data['start_date'],
+                               $data['responsible'],
+                               $data['action'],
+                               $data['end_date'],
+                               $data['repeat_type'],                           
+                               $repeat_day,
+                               $data['repeat_interval'],
+                               $data['enabled'],
+                               $this->account,
+                               time()
+                       );
+
+                       $this->_db->transaction_begin();
+
+                       $id = $this->_db->next_id($table);
+                       $cols[] = 'id';
+                       $vals[] = $id;
+
+                       $cols   = implode(",", $cols);
+                       $vals   = $this->_db->validate_insert($vals);
+
+                       $this->_db->query("INSERT INTO {$table} ({$cols}) 
VALUES ({$vals})",__LINE__,__FILE__);
+
+                       if($this->_db->transaction_commit())
+                       {
+                               $receipt['id'] = $id;
+                               $receipt['message'][] = array('msg' => 
lang('event has been saved'));
+                       }
+                       else
+                       {
+                               $receipt['error'][] = array('msg' => 
lang('event has not been saved'));
+                       }
+                       return $receipt;
+               }
+
+               function edit($data)
+               {
+                       $receipt = array();
+                       $table = 'fm_event';
+
+                       $repeat_day = 0;
+                       if(isset($data['repeat_day']) && 
is_array($data['repeat_day']))
+                       {
+                               foreach ($data['repeat_day'] as $day)
+                               {
+                                       $repeat_day |= $day;
+                               }
+                       }
+
+                       $value_set = array
+                       (
+                               'descr'                         => 
$this->_db->db_addslashes($data['descr']),
+                               'start_date'            => $data['start_date'],
+                               'responsible_id'        => $data['responsible'],
+                               'action_id'                     => 
$data['action'],
+                               'end_date'                      => 
$data['end_date'],
+                               'repeat_type'           => $data['repeat_type'],
+                               'repeat_day'            => $repeat_day,
+                               'repeat_interval'       => 
$data['repeat_interval'],
+                               'enabled'                       => 
$data['enabled'],
+                               'modified_date'         => time()
+                       );
+
+                       
+                       $value_set      = 
$this->_db->validate_update($value_set);
+
+                       $this->_db->transaction_begin();
+                       $this->_db->query("UPDATE $table SET {$value_set} WHERE 
id='" . $data['id']. "'",__LINE__,__FILE__);
+
+                       $receipt['id'] = $data['id'];
+                       if($this->_db->transaction_commit())
+                       {
+                               $receipt['message'][] = array('msg' => 
lang('event has been updated'));
+                       }
+                       else
+                       {
+                               $receipt['error'][] = array('msg' => 
lang('event has not been updated'));
+                       }
+                       return $receipt;
+               }
+
+               function check_event_exception($event_id, $time)
+               {
+                       $event_id = (int) $event_id;
+                       $time = (int) $time;
+                       $sql = "SELECT event_id FROM fm_event_exception WHERE 
event_id = {$event_id} AND exception_time = {$time}";
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->_db->next_record();
+                       return !!$this->_db->f('id');
+               }
+
+               function cron_log($data)
+               {
+                       $insert_values= array(
+                               !!$data['cron'], // or manual...
+                               date($this->_db->datetime_format()),
+                               $data['action'],
+                               $data['message']
+                               );
+
+                       $insert_values  = 
$this->_db->validate_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->_db->query($sql,__LINE__,__FILE__);
+               }
+
+               function delete($id)
+               {
+                       $receipt = array();
+                       $table = 'fm_event';
+                       $this->_db->transaction_begin();
+                       $ret = !!$this->_db->query("DELETE FROM $table WHERE 
id='{$id}'",__LINE__,__FILE__);
+                       if($this->_db->transaction_commit())
+                       {
+                               return $ret;
+                       }
+                       return false;
+               }
+
+               //FIXME adapt from calendar     
+               function list_events($data = array())
+               {
+                       $startYear                      = $data['syear'];
+                       $startMonth                     = $data['smonth'];
+                       $startDay                       = $data['sday'];
+                       $endYear                        = $data['eyear'] ? 
$data['eyear'] : 0;
+                       $endMonth                       = $data['emonth'] ? 
$data['emonth'] : 0;
+                       $endDay                         = $data['eday'] ? 
$data['eday'] : 0;
+                       $extra                          = $data['extra'] ? 
$data['extra'] : '';
+                       $tz_offset                      = $data['tz_offset'] ? 
$data['tz_offset'] : 0;
+                       $owner_id                       = $data['owner_id'] ? 
$data['owner_id'] : 0;
+                       $location_id            = (int) $data['location_id'];
+                       $location_item_id       = (int) 
$data['location_item_id'];
+
+                       if(!$startYear || !$startMonth || !$startDay || 
!$location_id || !$location_item_id)
+                       {
+                               throw new 
Exception("property_soevent::list_events - Missing start date info");
+                       }
+
+//                     $datetime = 
mktime(0,0,0,$startMonth,$startDay,$startYear) - $tz_offset;
+                       $datetime = 
mktime(13,0,0,$startMonth,$startDay,$startYear);            
+                       $sql = ' WHERE (fm_event.user_id in (';
+                       if($owner_id)
+                       {
+                               $sql .= implode(',',$owner_id);
+                       }
+                       else
+                       {
+                               $sql .= $this->account;
+                       }
+                       $member_groups = 
$GLOBALS['phpgw']->accounts->membership($this->account);
+                       @reset($member_groups);
+                       foreach ($member_groups as $key => $group_info)
+                       {
+                               $member[] = $group_info->id;            
+                       }
+
+                       @reset($member);
+       //              $sql .= ','.implode(',',$member);
+                       $sql .= ')) ';
+
+                       $sql .= 'AND ( ( (fm_event.start_date >= '.$datetime.') 
';
+
+                       if($endYear != 0 && $endMonth != 0 && $endDay != 0)
+                       {
+//                             $edatetime = 
mktime(23,59,59,intval($endMonth),intval($endDay),intval($endYear)) - 
$tz_offset;
+                               $edatetime = 
mktime(13,0,0,intval($endMonth),intval($endDay),intval($endYear));
+                               $sql .= 'AND (fm_event.end_date <= 
'.$edatetime.') ) '
+                                       . 'OR ( (fm_event.start_date <= 
'.$datetime.') '
+                                       . 'AND (fm_event.end_date >= 
'.$edatetime.') ) '
+                                       . 'OR ( (fm_event.start_date >= 
'.$datetime.') '
+                                       . 'AND (fm_event.start_date <= 
'.$edatetime.') '
+                                       . 'AND (fm_event.end_date >= 
'.$edatetime.') ) '
+                                       . 'OR ( (fm_event.start_date <= 
'.$datetime.') '
+                                       . 'AND (fm_event.end_date >= 
'.$datetime.') '
+                                       . 'AND (fm_event.end_date <= 
'.$edatetime.') ';
+                       }
+                       $sql .= ") ) AND location_id = {$location_id} AND 
location_item_id = {$location_item_id}";
+
+                       $order_by = ' ORDER BY fm_event.start_date ASC, 
fm_event.end_date ASC';
+
+                       return 
$this->get_event_ids(False,$sql.$extra.$order_by);
+               }
+
+               function list_repeated_events($data = array())
+               {
+                       $syear                          = $data['syear'];
+                       $smonth                         = $data['smonth'];
+                       $sday                           = $data['sday'];
+                       $eyear                          = $data['eyear'];
+                       $emonth                         = $data['emonth'];
+                       $eday                           = $data['eday'];
+                       $owner_id                       = $data['owner_id'] ? 
$data['owner_id'] : 0;
+                       $location_id            = (int) $data['location_id'];
+                       $location_item_id       = (int) 
$data['location_item_id'];
+                       if(!$syear || !$smonth || !$sday || !$eyear || !$emonth 
|| !$eday || !$location_id || !$location_item_id)
+                       {
+                               throw new 
Exception("property_soevent::list_repeated_events - Missing date info");
+                       }
+
+                       $user_timezone = phpgwapi_datetime::user_timezone();
+
+                       $starttime = mktime(0,0,0,$smonth,$sday,$syear) - 
$user_timezone;
+                       $endtime = mktime(23,59,59,$emonth,$eday,$eyear) - 
$user_timezone;
+                       $sql = "(fm_event.location_id = {$location_id} AND 
fm_event.location_item_id = {$location_item_id})"
+                               . ' AND ((fm_event.end_date >= '.$starttime.') 
OR (fm_event.end_date=0))'
+                               . ' ORDER BY fm_event.start_date ASC, 
fm_event.end_date ASC';
+
+                       return $this->get_event_ids(true, $sql);
+               }
+
+               function get_event_ids($search_repeats = false, $extra = '')
+               {
+       //              $where = 'WHERE';
+                       $repeat = '';
+                       if($search_repeats)
+                       {
+                               $repeat = 'WHERE (fm_event.repeat_type > 0) ';
+                               $where = 'AND';
+                       }
+
+                       $sql = 'SELECT DISTINCT fm_event.id,'
+                                       . ' 
fm_event.start_date,fm_event.end_date'
+                                       . " FROM fm_event {$repeat} {$where} 
{$extra}";
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $retval = array();
+                       if($this->_db->num_rows() == 0)
+                       {
+                               return $retval;
+                       }
+       
+                       while($this->_db->next_record())
+                       {
+                               $retval[] = intval($this->_db->f('id'));
+                       }
+                       if($this->debug)
+                       {
+                               echo "Records found!<br />\n";
+                       }
+                       return $retval;
+               }
+
+               public function set_exceptions($data = array())
+               {
+                       if(!isset($data['event_id']) || !$data['event_id'])
+                       {
+                                       throw new 
Exception("property_soevent::set_exceptions - Missing event_id in input");
+                       }
+
+                       foreach ($data['alarm'] as $exception_id)
+                       {
+                               $exception_time = 
mktime(13,0,0,intval(substr($exception_id,4,2)),intval(substr($exception_id,6,2)),intval(substr($exception_id,0,4)));
+                               if($data['exception'])
+                               {
+                                       $sql = "SELECT * FROM 
fm_event_exception WHERE event_id ='{$data['event_id']}' AND exception_time = 
{$exception_time}";
+                                       
$this->_db->query($sql,__LINE__,__FILE__);
+                                       if ($this->_db->next_record())
+                                       {
+                                               continue;
+                                       }
+                                       else
+                                       {
+                                               $vals = array
+                                               (
+                                                       $data['event_id'],
+                                                       $exception_time,
+                                                       $this->account,
+                                                       
phpgwapi_datetime::user_localtime(),
+                                               );                              
                
+                                               $vals   = 
$this->_db->validate_insert($vals);
+                                               $this->_db->query("INSERT INTO 
fm_event_exception (event_id, exception_time, user_id, entry_date) VALUES 
({$vals})",__LINE__,__FILE__);
+                                       }
+                               
+                               }
+                               else
+                               {
+                                       $sql = "DELETE FROM fm_event_exception 
WHERE event_id ='{$data['event_id']}' AND exception_time = {$exception_time}";
+                                       
$this->_db->query($sql,__LINE__,__FILE__);
+                               }
+                       }
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.soevent.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision

Modified: people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sogab.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -37,17 +37,18 @@
                var $gab_insert_level;
                var $payment_date;
 
-               function property_sogab($gab_insert_level)
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->db2          = clone($this->db);
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
 
-                       $this->gab_insert_level = $gab_insert_level;
+                       $this->config           = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read();
+                       $this->gab_insert_level = 
isset($this->config->config_data['gab_insert_level']) && 
$this->config->config_data['gab_insert_level'] ? 
$this->config->config_data['gab_insert_level'] : 3;
                }
 
                function read($data)
@@ -59,7 +60,7 @@
                                $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort'] : 'DESC';
                                $order                  = isset($data['order']) 
? $data['order'] : '';
                                $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id'] : 0;
-                               $loc1                   = isset($data['loc1']) 
? $data['loc1'] : '';
+                               $location_code  = isset($data['location_code']) 
? $data['location_code'] : '';
                                $gaards_nr              = 
isset($data['gaards_nr'])? (int)$data['gaards_nr'] : '';
                                $bruksnr                = 
isset($data['bruksnr']) ? (int)$data['bruksnr'] : '';
                                $feste_nr               = 
isset($data['feste_nr']) ? (int)$data['feste_nr'] : '';
@@ -92,9 +93,9 @@
                                $filtermethod .= " $where 
fm_gab_location.address $this->like '%$address%' ";
                                $where = 'AND';
                        }
-                       if ($loc1)
+                       if ($location_code)
                        {
-                               $filtermethod .= " $where 
fm_gab_location.loc1='$loc1' ";
+                               $filtermethod .= " $where 
fm_gab_location.location_code $this->like '$location_code%' ";
                                $where = 'AND';
                        }
 
@@ -140,11 +141,11 @@
 
                        if($check_payments)
                        {
-                               $sql = "SELECT gab_id,count(gab_id) as hits, 
loc" . $j . "_name as address ,fm_gab_location.loc1 as location_code, 
fm_gab_location.owner as owner FROM fm_gab_location $joinmethod $filtermethod 
GROUP BY gab_id,fm_gab_location.loc1,loc" . $j . "_name,owner ";
+                               $sql = "SELECT gab_id,count(gab_id) as hits, 
address ,fm_gab_location.loc1 as location_code, fm_gab_location.owner as owner 
FROM fm_gab_location $joinmethod $filtermethod GROUP BY 
gab_id,fm_gab_location.loc1,address,owner ";
                        }
                        else
                        {
-                               $sql = "SELECT gab_id,count(gab_id) as hits, 
loc" . $j . "_name as address ,fm_gab_location.location_code, 
fm_gab_location.owner as owner FROM fm_gab_location $joinmethod $filtermethod 
GROUP BY gab_id,fm_gab_location.location_code,loc" . $j . "_name,owner ";
+                               $sql = "SELECT gab_id,count(gab_id) as hits, 
address ,fm_gab_location.location_code, fm_gab_location.owner as owner FROM 
fm_gab_location $joinmethod $filtermethod GROUP BY 
gab_id,fm_gab_location.location_code,address,owner ";
                        }
 
                        $this->db->query($sql,__LINE__,__FILE__);

Modified: people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soinvestment.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -38,16 +38,15 @@
                {
                //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function get_type_list()
                {
                        $this->db->query("SELECT entity_type FROM fm_investment 
GROUP BY entity_type ");
+                       $type_list = array();
                        while ($this->db->next_record())
                        {
                                $type_list[] = Array(
@@ -142,8 +141,8 @@
                        }
                        if($sql)
                        {
-                               $this->db2->query($sql,__LINE__,__FILE__);
-                               $this->total_records = $this->db2->num_rows();
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->total_records = $this->db->num_rows();
 
                                if(!$allrows)
                                {
@@ -156,6 +155,7 @@
                        }
 
 
+                       $investment = array();
                        $i=0;
                        while ($this->db->next_record())
                        {
@@ -192,6 +192,7 @@
                {
 //_debug_array($values);
 
+                       $receipt = array();
                        while (is_array($values['location']) && 
list($input_name,$value) = each($values['location']))
                        {
                                if($value)
@@ -263,7 +264,9 @@
 
                function update_investment($values)
                {
-                       if (isSet($values) AND is_array($values))
+                       $receipt = array();
+
+                       if ($values)
                        {
                                $this->db->transaction_begin();
                                foreach($values as $entry)
@@ -286,13 +289,16 @@
                                                1
                                                );
 
-                                       $insert = 
$this->bocommon->validate_db_insert($insert);
+                                       $insert = 
$this->db->validate_insert($insert);
 
 
                                        $this->db->query("insert into 
fm_investment_value (entity_id, invest_id, index_count, this_index, 
value,initial_value, index_date,current_index) "
                                        . " values ($insert)");
+
+                                       
$receipt['message'][]=array('msg'=>lang('investment %1 is updated at entity 
%2', $entry['invest_id'], $entry['entity_id']));
                                }
                                $this->db->transaction_commit();
+                               return $receipt;
                        }
                }
 
@@ -307,8 +313,8 @@
                        $sql = "SELECT index_count, 
this_index,current_index,value, initial_value, index_date  "
                        . " FROM fm_investment_value Where entity_id= 
'$entity_id' and invest_id= '$investment_id' order by index_count";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -319,6 +325,7 @@
                                $this->db->query($sql,__LINE__,__FILE__);
                        }
 
+                       $investment = array();
                        $i=0;
                        while ($this->db->next_record())
                        {
@@ -341,6 +348,7 @@
                {
                        $this->db->query("SELECT writeoff_year FROM 
fm_investment GROUP BY writeoff_year ",__LINE__,__FILE__);
 
+                       $period_list = array();
                        while ($this->db->next_record())
                        {
                                $period_list[] = Array(

Modified: people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soinvoice.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,33 +35,39 @@
        class property_soinvoice
        {
                var $total_records = 0;
+               var $role = array();
 
                function property_soinvoice()
                {
-                       $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->account_id       = 
$GLOBALS['phpgw_info']['user']['account_id'];
-
                        $this->acl                      = & 
$GLOBALS['phpgw']->acl;
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
-                       $this->db               = $this->bocommon->new_db();
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read_invoice($data)
                {
+
+                       $valid_order = array
+                       (
+                               'bilagsnr'              => true,
+                               'spvend_code'   => true,
+                               'fakturadato'   => true
+                       );
+
                        if(is_array($data))
                        {
                                $start                  = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
                                $query                  = 
isset($data['query'])?$data['query']:'';
                                $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
-                               $order                  = 
isset($data['order'])?$data['order']:'';
+                               $order                  = isset($data['order']) 
&& $valid_order[$data['order']] ? $data['order']:'';
                                $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']:0;
                                $user_lid               = 
isset($data['user_lid']) && $data['user_lid']?$data['user_lid']:'none';
                                $paid                   = 
isset($data['paid'])?$data['paid']:'';
-                               $start_date     = 
isset($data['start_date'])?$data['start_date']:'';
-                               $end_date               = 
isset($data['end_date'])?$data['end_date']:'';
+                               $start_date     = isset($data['start_date']) && 
$data['start_date'] ? date($this->db->datetime_format(), $data['start_date']) : 
'';
+                               $end_date               = 
isset($data['end_date']) && $data['end_date'] ? 
date($this->db->datetime_format(), $data['end_date']) : '';
                                $vendor_id              = 
isset($data['vendor_id'])?$data['vendor_id']:'';
                                $loc1                   = 
isset($data['loc1'])?$data['loc1']:'';
                                $workorder_id   = 
isset($data['workorder_id'])?$data['workorder_id']:'';
@@ -75,6 +81,13 @@
                        $querymethod    = '';
 //_debug_array($data);
 
+                       $this->db->query("SELECT * FROM fm_ecoart");
+                       $art_list = array();
+                       while ($this->db->next_record())
+                       {
+                               $art_list[$this->db->f('id')] = 
$this->db->f('descr',true);
+                       }
+
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
@@ -103,7 +116,7 @@
                                $where= 'AND';
                        }
 
-                       if ($district_id > 0)
+                       if ($district_id > 0 && $paid)
                        {
                                $filtermethod .= " $where  
district_id='$district_id' ";
                                $join_tables = " $this->join fm_location1 ON 
fm_ecobilagoverf.loc1 = fm_location1.loc1"
@@ -130,7 +143,7 @@
 
                        if ($voucher_id)
                        {
-                               $filtermethod .= " $where  bilagsnr $this->like 
'%$voucher_id%' ";
+                               $filtermethod .= " $where  bilagsnr = " . 
(int)$voucher_id;
                                $where= 'AND';
                        }
 
@@ -146,48 +159,9 @@
                                        $join_tables .= " $this->join 
fm_b_account ON fm_ecobilagoverf.spbudact_code = fm_b_account.id";
                                }
 
-                               if (!$workorder_id && !$voucher_id)
-                               {
-                                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                                       $dateformat = 
str_replace(".","",$dateformat);
-                                       $dateformat = 
str_replace("-","",$dateformat);
-                                       $dateformat = 
str_replace("/","",$dateformat);
-                                       $y=strpos($dateformat,'y');
-                                       $d=strpos($dateformat,'d');
-                                       $m=strpos($dateformat,'m');
-
-                                       $dateparts = explode('/', $start_date);
-                                       $sday = $dateparts[$d];
-                                       $smonth = $dateparts[$m];
-                                       $syear = $dateparts[$y];
-
-                                       $dateparts = explode('/', $end_date);
-                                       $eday = $dateparts[$d];
-                                       $emonth = $dateparts[$m];
-                                       $eyear = $dateparts[$y];
-
-                                       $start_date = 
date($this->bocommon->dateformat,mktime(2,0,0,$smonth,$sday,$syear));
-                                       if ($syear == $eyear)
+                               if (!$workorder_id && !$voucher_id  && 
$start_date)
                                        {
-                                               $end_date = 
date($this->bocommon->dateformat,mktime(2,0,0,12,31,$eyear));
-                                               $filtermethod .= " $where 
(fakturadato >'$start_date' AND fakturadato < '$end_date'"
-                                                               . " AND periode 
>" . ($smonth -1) . " AND periode <" . ($emonth+1) . ')';
-                                       }
-
-                                       $end_date = 
date($this->bocommon->dateformat,mktime(2,0,0,$emonth,$eday,$eyear));
-
-
-               /*                      $filtermethod .= " $where (fakturadato 
>'$start_date' AND fakturadato < '$end_date'";
-
-                                       if($smonth < 3)
-                                       {
-                                               $filtermethod .= " AND periode 
= 1)";
-                                       }
-                                       else
-                                       {
-                                               $filtermethod .= ")";
-                                       }
-               */
+                                       $filtermethod .= " $where (fakturadato 
>'$start_date' AND fakturadato < '$end_date')";
                                }
                        }
                        else
@@ -201,10 +175,9 @@
                                $querymethod = " $where ( spvend_code = 
{$query} OR bilagsnr = {$query})";
                        }
 
-                       $sql = "SELECT bilagsnr, count(bilagsnr) as 
invoice_count, sum(belop) as belop,spvend_code,fakturadato FROM  $table 
$join_tables $filtermethod $querymethod group by 
bilagsnr,spvend_code,fakturadato ";
+                       $sql = "SELECT bilagsnr, count(bilagsnr) as 
invoice_count, sum(belop) as belop,spvend_code,fakturadato FROM  $table 
$join_tables $filtermethod $querymethod GROUP BY 
bilagsnr,spvend_code,fakturadato ";
                        $sql2 = "SELECT DISTINCT bilagsnr FROM  $table 
$join_tables $filtermethod $querymethod";
 
-//echo $sql;
                        $this->db->query($sql2,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
 
@@ -217,6 +190,7 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
+                       $temp = array();
                        while ($this->db->next_record())
                        {
                                $temp[] = array
@@ -228,13 +202,13 @@
                        }
 
                        $invoice = array();
-                       if (isset($temp) && $temp)
+                       if ($temp)
                        {
                                $role= $this->check_role();
                                $i = 0;
                                foreach($temp as $invoice_temp)
                                {
-                                       $voucher_id=$invoice_temp['voucher_id'];
+                                       $voucher_id = 
$invoice_temp['voucher_id'];
 
                                        $sql = "SELECT 
spvend_code,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
                                        . " 
utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,fakturadato,org_name,"
@@ -253,8 +227,6 @@
 
                                        if($this->db->f('oppsynsmannid') && 
$this->db->f('oppsynsigndato'))
                                        {
-//                                             $timestamp_jan_date             
        = 
mktime(0,0,0,date(m,strtotime($this->db->f('oppsynsigndato'))),date(d,strtotime($this->db->f('oppsynsigndato'))),date(y,strtotime($this->db->f('oppsynsigndato'))));
-//                                             $invoice[$i]['jan_date']        
= 
$GLOBALS['phpgw']->common->show_date($timestamp_jan_date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                                
$invoice[$i]['jan_date']=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($this->db->f('oppsynsigndato')));
                                        }
                                        else
@@ -263,8 +235,6 @@
                                        }
                                        if($this->db->f('saksbehandlerid') && 
$this->db->f('saksigndato'))
                                        {
-//                                             $timestamp_super_date           
= 
mktime(0,0,0,date(m,strtotime($this->db->f('saksigndato'))),date(d,strtotime($this->db->f('saksigndato'))),date(y,strtotime($this->db->f('saksigndato'))));
-//                                             $invoice[$i]['super_date']      
= 
$GLOBALS['phpgw']->common->show_date($timestamp_super_date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                                
$invoice[$i]['super_date']=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($this->db->f('saksigndato')));
                                        }
                                        else
@@ -274,8 +244,6 @@
 
                                        if($this->db->f('budsjettansvarligid') 
&& $this->db->f('budsjettsigndato'))
                                        {
-//                                                     $timestamp_budget_date  
        = 
mktime(0,0,0,date(m,strtotime($this->db->f('budsjettsigndato'))),date(d,strtotime($this->db->f('budsjettsigndato'))),date(y,strtotime($this->db->f('budsjettsigndato'))));
-//                                                     
$invoice[$i]['budget_date']     = 
$GLOBALS['phpgw']->common->show_date($timestamp_budget_date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                                        
$invoice[$i]['budget_date']=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($this->db->f('budsjettsigndato')));
                                        }
                                        else
@@ -285,8 +253,6 @@
 
                                        if($this->db->f('utbetalingid') && 
$this->db->f('utbetalingsigndato'))
                                        {
-//                                             $timestamp_transfer_date= 
mktime(0,0,0,date(m,strtotime($this->db->f('utbetalingsigndato'))),date(d,strtotime($this->db->f('utbetalingsigndato'))),date(y,strtotime($this->db->f('utbetalingsigndato'))));
-//                                             $invoice[$i]['transfer_date']   
                = 
$GLOBALS['phpgw']->common->show_date($timestamp_transfer_date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                                
$invoice[$i]['transfer_date']=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($this->db->f('utbetalingsigndato')));
                                        }
                                        else
@@ -312,7 +278,7 @@
                                        $invoice[$i]['voucher_date']            
        = 
$GLOBALS['phpgw']->common->show_date($timestamp_voucher_date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                        $invoice[$i]['payment_date']            
        = 
$GLOBALS['phpgw']->common->show_date($timestamp_payment_date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                        $invoice[$i]['period']                  
                = $this->db->f('periode');
-                                       $invoice[$i]['type']                    
                = $this->db->f('artid');
+                                       $invoice[$i]['type']                    
                = $art_list[$this->db->f('artid')];
                                        $invoice[$i]['kidnr']                   
                = $this->db->f('kidnr');
                                        $invoice[$i]['kreditnota']              
                = $this->db->f('kreditnota');
                                        $invoice[$i]['amount']                  
                = $invoice_temp['amount'];
@@ -373,7 +339,7 @@
                        }
                        else
                        {
-                               $ordermethod = ' order by bilagsnr DESC';
+                               $ordermethod = ' order by id DESC';
                        }
 
                        if ($voucher_id)
@@ -381,42 +347,44 @@
                                $filtermethod = " WHERE ( bilagsnr= 
'$voucher_id')";
                        }
 
-                       $sql = "SELECT 
$table.*,fm_workorder.status,fm_workorder.charge_tenant,org_name,fm_workorder.claim_issued
 FROM $table "
-                       . " $this->left_join fm_workorder on fm_workorder.id = 
$table.pmwrkord_code  "
+                       $sql = "SELECT 
$table.*,fm_workorder.status,fm_workorder.charge_tenant,org_name,fm_workorder.claim_issued,
 fm_workorder.paid_percent, project_group FROM $table"
+                       . " $this->left_join fm_workorder ON fm_workorder.id = 
$table.pmwrkord_code"
+                       . " $this->left_join fm_project ON 
fm_workorder.project_id = fm_project.id"
                        . " $this->join fm_vendor ON $table.spvend_code = 
fm_vendor.id $filtermethod";
 
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query($sql . $ordermethod,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
-                       $this->db->query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
 
                        $i = 0;
 
+                       $invoice = array();
                        while ($this->db->next_record())
                        {
-                               $invoice[$i]['counter']                         
        = $i;
-                               $invoice[$i]['claim_issued']                    
= $this->db->f('claim_issued');
-                               $invoice[$i]['project_id']                      
        = $this->db->f('project_id');
-                               $invoice[$i]['workorder_id']                    
= $this->db->f('pmwrkord_code');
-                               $invoice[$i]['status']                          
        = $this->db->f('status');
-                               if ($this->db->f('status')=='closed')
-                               {
-                                       $invoice[$i]['closed']                  
        = true;
-                               }
-                               $invoice[$i]['voucher_id']                      
        = $voucher_id;
-                               $invoice[$i]['id']                              
                = $this->db->f('id');
-                               $invoice[$i]['invoice_id']                      
        = $this->db->f('fakturanr');
-                               $invoice[$i]['budget_account']                  
= $this->db->f('spbudact_code');
-                               $invoice[$i]['dima']                            
        = $this->db->f('dima');
-                               $invoice[$i]['dimb']                            
        = $this->db->f('dimb');
-                               $invoice[$i]['dimd']                            
        = $this->db->f('dimd');
-                               if ($this->db->f('merknad'))
-                               {
-                                       $invoice[$i]['remark']                  
        = true;
-                               }
-                               $invoice[$i]['tax_code']                        
        = $this->db->f('mvakode');
-                               $invoice[$i]['amount']                          
        = $this->db->f('belop');
-                               $invoice[$i]['charge_tenant']                   
= $this->db->f('charge_tenant');
-                               $invoice[$i]['vendor']                          
        = $this->db->f('org_name');
+                               $invoice[] = array
+                               (
+                                       'counter'                               
=> $i,
+                                       'claim_issued'                  => 
$this->db->f('claim_issued'),
+                                       'project_id'                    => 
$this->db->f('project_id'),
+                                       'workorder_id'                  => 
$this->db->f('pmwrkord_code'),
+                                       'status'                                
=> $this->db->f('status'),
+                                       'closed'                                
=> $this->db->f('status') == 'closed',
+                                       'voucher_id'                    => 
$voucher_id,
+                                       'id'                                    
=> $this->db->f('id'),
+                                       'invoice_id'                    => 
$this->db->f('fakturanr'),
+                                       'budget_account'                => 
$this->db->f('spbudact_code'),
+                                       'dima'                                  
=> $this->db->f('dima'),
+                                       'dimb'                                  
=> $this->db->f('dimb'),
+                                       'dimd'                                  
=> $this->db->f('dimd'),
+                                       'remark'                                
=> !!$this->db->f('merknad'),
+                                       'tax_code'                              
=> $this->db->f('mvakode'),
+                                       'amount'                                
=> $this->db->f('belop'),
+                                       'charge_tenant'                 => 
$this->db->f('charge_tenant'),
+                                       'vendor'                                
=> $this->db->f('org_name'),
+                                       'paid_percent'                  => 
$this->db->f('paid_percent'),
+                                       'project_group'                 => 
$this->db->f('project_group'),
+                                       'external_ref'                  => 
$this->db->f('external_ref')
+                               );
+
                                $i++;
                        }
 
@@ -434,37 +402,17 @@
                                $sort                   = 
isset($data['sort'])?$data['sort']:'DESC';
                                $order                  = 
isset($data['order'])?$data['order']:'';
                                $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id']:0;
-                               $start_date     = 
isset($data['start_date'])?$data['start_date']:'';
-                               $end_date               = 
isset($data['end_date'])?$data['end_date']:'';
+                               $start_date     = isset($data['start_date']) && 
$data['start_date'] ? date($this->db->datetime_format(), $data['start_date']) : 
'';
+                               $end_date               = 
isset($data['end_date']) && $data['end_date'] ? 
date($this->db->datetime_format(), $data['end_date']) : '';
                                $vendor_id              = 
isset($data['vendor_id'])?$data['vendor_id']:'';
                                $loc1                   = 
isset($data['loc1'])?$data['loc1']:'';
                                $district_id    = 
isset($data['district_id'])?$data['district_id']:'';
                                $workorder_id   = isset($data['workorder_id']) 
&& $data['workorder_id'] ? $data['workorder_id']:0;
                                $b_account_class = 
isset($data['b_account_class'])?$data['b_account_class']:'';
+                               $b_account              = 
isset($data['b_account']) ? $data['b_account'] : '';
                        }
 //_debug_array($data);
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $dateformat = str_replace(".","",$dateformat);
-                       $dateformat = str_replace("-","",$dateformat);
-                       $dateformat = str_replace("/","",$dateformat);
-                       $y=strpos($dateformat,'y');
-                       $d=strpos($dateformat,'d');
-                       $m=strpos($dateformat,'m');
-                       $dateparts = explode('/', $start_date);
-                       $sday = $dateparts[$d];
-                       $smonth = $dateparts[$m];
-                       $syear = $dateparts[$y];
-
-                       $dateparts = explode('/', $end_date);
-                       $eday = $dateparts[$d];
-                       $emonth = $dateparts[$m];
-                       $eyear = $dateparts[$y];
-
-                       $start_date = 
date($this->bocommon->dateformat,mktime(2,0,0,$smonth,$sday,$syear));
-                       $end_date = 
date($this->bocommon->dateformat,mktime(2,0,0,$emonth,$eday,$eyear));
-
-
                        $where = 'AND';
 
                        if($b_account_class)
@@ -478,6 +426,16 @@
                                $group_account_class=', 
spbudact_code,fm_b_account.category';
                        }
 
+                       if ($b_account)
+                       {
+                               $filtermethod .= " {$where} fm_b_account.id = 
'{$b_account}'";
+                               $where= 'AND';
+                               $select_account_class=',fm_b_account.id as 
b_account_class';
+                               $group_account_class=', 
spbudact_code,fm_b_account.id';
+
+                       }
+
+
                        if ($vendor_id)
                        {
                                $filtermethod .= " $where (spvend_code = 
$vendor_id)";
@@ -510,49 +468,31 @@
                                $where= 'AND';
                        }
 
-
-                       $year = date("Y",strtotime($start_date));
-                       $month = date("m",strtotime($start_date));
-                       if($month < 3)
-                       {
-                               $start_date = 
date($this->bocommon->dateformat,mktime(2,0,0,3,1,$year));
-                       }
-
-                       $start_date2 = 
date($this->bocommon->dateformat,mktime(2,0,0,1,1,$year));
-
                        $sql = "SELECT district_id,periode,sum(godkjentbelop) 
as consume $select_account_class "
                                . " FROM  fm_ecobilagoverf $this->join 
fm_location1 ON (fm_ecobilagoverf.loc1 = fm_location1.loc1) "
                                . " $this->join fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id) "
                                . " $this->join fm_b_account ON 
(fm_ecobilagoverf.spbudact_code = fm_b_account.id) "
                                . " WHERE (fakturadato >'$start_date' AND 
fakturadato < '$end_date' $filtermethod )"
-                               . " OR (fakturadato >'$start_date2' AND 
fakturadato < '$end_date'  AND periode < 3  $filtermethod) "
                                . " GROUP BY district_id,periode 
$group_account_class"
                                . " ORDER BY periode";
 //echo $sql;
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
-                       $this->db->query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
 
-                       $i = 0;
+                       $consume = array();
 
                        while ($this->db->next_record())
                        {
-                               $consume[$i]['consume']                         
= round($this->db->f('consume'));
-                               $consume[$i]['period']                          
        = $this->db->f('periode');
-                               $consume[$i]['district_id']                     
        = $this->db->f('district_id');
-                               if(!$b_account_class)
-                               {
-                                       $consume[$i]['account_class']           
        = $this->db->f('b_account_class');
+                               $consume[] = array
+                               (
+                                       'consume'               => 
round($this->db->f('consume')),
+                                       'period'                => 
$this->db->f('periode'),
+                                       'district_id'   => 
$this->db->f('district_id'),
+                                       'account_class' => $b_account_class ? 
$b_account_class : $this->db->f('b_account_class')
+                               );      
                                }
-                               else
-                               {
-                                       $consume[$i]['account_class']           
        = $b_account_class;
-                               }
 
-                               $i++;
-                       }
-//_debug_array($consume);
                        return $consume;
                }
 
@@ -595,7 +535,7 @@
 
                function update_invoice_sub($values)
                {
-
+                       $receipt = array();
                        $GLOBALS['phpgw']->db->transaction_begin();
 
                        while($entry=each($values['counter']))
@@ -607,12 +547,11 @@
 
 //_debug_array($entry);
 
-
                                if ($values['budget_account'][$n])
                                {
                                        
$budget_account=$values['budget_account'][$n];
 
-                                       $GLOBALS['phpgw']->db->query("select 
count(*) from fm_b_account  where id =$budget_account");
+                                       $GLOBALS['phpgw']->db->query("select 
count(*) from fm_b_account  where id ='{$budget_account}'");
                                        $GLOBALS['phpgw']->db->next_record();
                                        if ($GLOBALS['phpgw']->db->f(0) == 0)
                                        {
@@ -690,6 +629,11 @@
                                                
$update_status[$workorder_id]='R';
                                        }
 
+                                       if(isset($values['paid_percent'][$n]) 
&& $values['paid_percent'][$n])
+                                       {
+                                               
$update_paid_percent[$workorder_id] = $values['paid_percent'][$n];
+                                       }
+
                                        $GLOBALS['phpgw']->db->query("UPDATE 
fm_ecobilag set $dima_field ,$kostra_field,$dimd_field, mvakode = 
'$tax_code',spbudact_code = '$budget_account',dimb = $dimb where id='$id'");
 
                                        $receipt['message'][] = 
array('msg'=>lang('Voucher is updated '));
@@ -705,12 +649,40 @@
 
                                while (list($id,$entry) = each($update_status))
                                {
+                                       $this->db->query("SELECT type FROM 
fm_orders WHERE id={$id}",__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       switch ( $this->db->f('type') )
+                                       {
+                                               case 'workorder':
                                        
$historylog_workorder->add($entry,$id,$status_code[$entry]);
                                        $GLOBALS['phpgw']->db->query("UPDATE 
fm_workorder set status=" . "'$status_code[$entry]'" . "where id=$id");
                                        $receipt['message'][] = 
array('msg'=>lang('Workorder %1 is %2',$id, $status_code[$entry]));
                                }
                        }
+                       }
 
+                       if (isset($update_paid_percent) AND 
is_array($update_paid_percent))
+                       {
+                               $workorder = 
CreateObject('property.soworkorder');
+                               foreach ($update_paid_percent as $workorder_id 
=> $paid_percent)
+                               {
+                                       $paid_percent = (int) $paid_percent;
+                                       $GLOBALS['phpgw']->db->query("UPDATE 
fm_workorder set paid_percent={$paid_percent} WHERE id= $workorder_id");        
                   
+       
+                                       $this->db->query("SELECT type FROM 
fm_orders WHERE id={$workorder_id}",__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       switch ( $this->db->f('type') )
+                                       {
+                                               case 'workorder':
+                                                       
$this->db->query("SELECT project_id FROM fm_workorder WHERE 
id={$workorder_id}",__LINE__,__FILE__);
+                                                       
$this->db->next_record();
+                                                       $project_id = 
$this->db->f('project_id');
+                                                       
$workorder->update_planned_cost($project_id);
+                                                       break;
+                                       }
+                               }
+                       }
+
                        $GLOBALS['phpgw']->db->transaction_commit();
 
                        return $receipt;
@@ -768,6 +740,7 @@
 
                function update_period($voucher_id='',$period='')
                {
+                       $receipt = array();
                        $this->db->transaction_begin();
 
                        $this->db->query("UPDATE fm_ecobilag set 
periode='$period' where bilagsnr='$voucher_id'");
@@ -812,6 +785,7 @@
                function tax_code_list($selected='')
                {
                        $this->db->query("SELECT * FROM fm_ecomva order by id 
asc ");
+                       $tax_code_list = array();
                        while ($this->db->next_record())
                        {
                                $tax_code_list[] = Array(
@@ -826,6 +800,7 @@
                function get_lisfm_ecoart()
                {
                        $this->db->query("SELECT * FROM fm_ecoart order by id 
asc ");
+                       $art_list = array();
                        while ($this->db->next_record())
                        {
                                $art_list[] = Array(
@@ -842,20 +817,22 @@
                function get_type_list()
                {
                        $this->db->query("SELECT * FROM fm_ecobilag_category 
order by id asc ");
+                       $category = array();
                        while ($this->db->next_record())
                        {
-                               $art_list[] = Array(
+                               $category[] = Array(
                                        'id'        => $this->db->f('id'),
                                        'name'       => $this->db->f('descr')
                                );
                        }
-                       return $art_list;
+                       return $category;
                }
 
        //----------
                function select_dimb_list()
                {
                        $this->db->query("SELECT * FROM fm_ecodimb order by id 
asc ");
+                       $dimb_list = array();
                        while ($this->db->next_record())
                        {
                                $dimb_list[] = Array(
@@ -870,6 +847,7 @@
                function select_dimd_list()
                {
                        $this->db->query("SELECT * FROM fm_ecodimd order by id 
asc ");
+                       $dimd_list = array();
                        while ($this->db->next_record())
                        {
                                $dimd_list[] = Array(
@@ -884,6 +862,7 @@
                function select_tax_code_list()
                {
                        $this->db->query("SELECT * FROM fm_ecomva order by id 
asc ");
+                       $tax_code_list = array();
                        while ($this->db->next_record())
                        {
                                $tax_code_list[] = Array(
@@ -899,6 +878,7 @@
                        $sql = "SELECT id from fm_b_account_category order by 
id";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $class = array();
                        while ($this->db->next_record())
                        {
                                $class[] = Array(
@@ -919,6 +899,7 @@
                        $sql = "SELECT * from fm_ecobilag WHERE bilagsnr 
='$bilagsnr'";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $values = array();
                        while ($this->db->next_record())
                        {
                                $values[] = Array(
@@ -1034,63 +1015,63 @@
                                                        $sign_field = 
'oppsynsmannid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'oppsynsigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_janitor' && 
$values['sign_orig'][$n]=='sign_supervisor'):
                                                        $blank_date = 
'saksigndato= NULL';
                                                        $sign_field = 
'oppsynsmannid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'oppsynsigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_janitor' && 
$values['sign_orig'][$n]=='sign_budget_responsible'):
                                                        $blank_date = 
'budsjettsigndato= NULL';
                                                        $sign_field = 
'oppsynsmannid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'oppsynsigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_supervisor' && !$values['sign_orig'][$n]):
                                                        $blank_date = '';
                                                        $sign_field = 
'saksbehandlerid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'saksigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_supervisor' && 
$values['sign_orig'][$n]=='sign_janitor'):
                                                        $blank_date = 
'oppsynsigndato= NULL';
                                                        $sign_field = 
'saksbehandlerid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'saksigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_supervisor' && 
$values['sign_orig'][$n]=='sign_budget_responsible'):
                                                        $blank_date = 
'budsjettsigndato= NULL';
                                                        $sign_field = 
'saksbehandlerid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'saksigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_budget_responsible' && 
$values['sign_orig'][$n]=='sign_janitor'):
                                                        $blank_date = 
'oppsynsigndato= NULL';
                                                        $sign_field = 
'budsjettansvarligid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'budsjettsigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_budget_responsible' && 
$values['sign_orig'][$n]=='sign_supervisor'):
                                                        $blank_date = 
'saksigndato= NULL';
                                                        $sign_field = 
'budsjettansvarligid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'budsjettsigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                elseif 
($values['sign'][$n]=='sign_budget_responsible' && !$values['sign_orig'][$n]):
                                                        $blank_date = '';
                                                        $sign_field = 
'budsjettansvarligid=';
                                                        $sign_id = 
"'$user_lid'";
                                                        $sign_date_field = 
'budsjettsigndato=';
-                                                       $sign_date="'" . 
date($this->bocommon->datetimeformat) . "'";
+                                                       $sign_date="'" . 
date($this->db->datetime_format()) . "'";
                                                        $kommma=",";
                                                endif;
 
@@ -1109,7 +1090,7 @@
 
                                                if 
(!($values['num_days_orig'][$n]==$values['num_days'][$n]))
                                                {
-                                                       $payment_date = 
date($this->bocommon->dateformat,$values['timestamp_voucher_date'][$n]+(24*3600*$values['num_days'][$n]));
+                                                       $payment_date = 
date($this->db->date_format(),$values['timestamp_voucher_date'][$n]+(24*3600*$values['num_days'][$n]));
                                                        
$GLOBALS['phpgw']->db->query("UPDATE fm_ecobilag set forfallsdato= 
'$payment_date' where bilagsnr='$voucher_id'");
                                                }
 
@@ -1121,7 +1102,7 @@
                                                        if 
($this->check_for_transfer($voucher_id))
                                                        {
                                                                
$transfer_id="'$user_lid',";
-                                                               
$transfer_date="'" . date($this->bocommon->datetimeformat) . "'";
+                                                               
$transfer_date="'" . date($this->db->datetime_format()) . "'";
                                                        }
                                                        else
                                                        {

Modified: people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.solocation.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,41 +35,70 @@
        class property_solocation
        {
 
-               function property_solocation()
+               var $bocommon;
+               var $total_records;
+
+               function __construct($bocommon = '')
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-
                        $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->soadmin_location = 
CreateObject('property.soadmin_location');
+                       if(!$bocommon || !is_object($bocommon))
+                       {
                        $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->socommon                 = 
CreateObject('property.socommon');
+                       }
+                       else
+                       {
+                               $this->bocommon = $bocommon;
+                       }
+                       $this->custom           = 
createObject('property.custom_fields');
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->socommon         = & $this->bocommon->socommon;
+
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read_entity_to_link($location_code)
                {
+                       $entity = array();
+
                        $sql = "SELECT * FROM fm_entity_category where 
loc_link=1";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $category = array();
                        while ($this->db->next_record())
                        {
-                               $sql = "SELECT count(*) as hits FROM 
fm_entity_" . $this->db->f('entity_id') . "_" . $this->db->f('id') . " WHERE 
location_code $this->like '$location_code%'";
+                               $category[] = array
+                               (
+                                       'entity_id'     => 
$this->db->f('entity_id'),
+                                       'cat_id'        => $this->db->f('id'),
+                                       'name'          => $this->db->f('name'),
+                                       'descr'         => $this->db->f('descr')
+                               );
+                       }
+
+                       foreach($category as $entry)
+                       {
+                               $sql = "SELECT count(*) as hits FROM 
fm_entity_{$entry['entity_id']}_{$entry['cat_id']} WHERE location_code 
$this->like '$location_code%'";
                                $this->db->query($sql,__LINE__,__FILE__);
                                $this->db->next_record();
                                if($this->db->f('hits'))
                                {
-                                       $entity[] = array
+                                       $entity['related'][] = array
                                        (
-                                               'entity_id'     => 
$this->db->f('entity_id'),
-                                               'cat_id'        => 
$this->db->f('id'),
-                                               'name'          => 
$this->db->f('name') . ' [' . $this->db->f('hits') . ']',
-                                               'descr'         => 
$this->db->f('descr')
+                                               'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                                (
+                                                                               
                                        'menuaction'    => 
'property.uientity.index',
+                                                                               
                                        'entity_id'             => 
$entry['entity_id'],
+                                                                               
                                        'cat_id'                => 
$entry['cat_id'],
+                                                                               
                                        'location_code' => $location_code
+                                                                               
                                )
+                                                                               
                        ),
+                                               'name'                  => 
$entry['name'] . ' [' . $this->db->f('hits') . ']',
+                                               'descr'                 => 
$entry['descr']
                                        );
                                }
                        }
@@ -79,44 +108,58 @@
                        $this->db->next_record();
                        if($this->db->f('hits'))
                        {
-                               $entity[] = array
+                               $hits = $this->db->f('hits');
+                               $entity['related'][] = array
                                (
                                        'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.index', 'query'=> $location_code)),
-                                       'name'          => lang('Helpdesk') . ' 
[' . $this->db->f('hits') . ']',
+                                       'name'          => lang('Helpdesk') . " 
[{$hits}]",
                                        'descr'         => lang('Helpdesk')
                                );
                        }
 
-                       $sql = "SELECT count(*) as hits FROM fm_document WHERE 
location_code $this->like '$location_code%'";
+                       $sql = "SELECT count(*) as hits FROM fm_request WHERE 
location_code $this->like '$location_code%'";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        if($this->db->f('hits'))
                        {
-                               $entity[] = array
+                               $hits = $this->db->f('hits');
+                               $entity['related'][] = array
                                (
-                                       'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.index','query'=> $location_code)),
-                                       'name'          => 
lang('Documentation') . ' [' . $this->db->f('hits') . ']',
-                                       'descr'         => lang('Documentation')
+                                       'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uirequest.index','query'=> $location_code)),
+                                       'name'          => lang('request') . " 
[{$hits}]",
+                                       'descr'         => lang('request')
                                );
                        }
 
-                       $sql = "SELECT count(*) as hits FROM fm_request WHERE 
location_code $this->like '$location_code%'";
+                       $sql = "SELECT count(*) as hits FROM fm_project WHERE 
location_code $this->like '$location_code%'";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        if($this->db->f('hits'))
                        {
-                               $entity[] = array
+                               $hits = $this->db->f('hits');
+                               $entity['related'][] = array
                                (
-                                       'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uirequest.index','query'=> $location_code)),
-                                       'name'          => lang('request') . ' 
[' . $this->db->f('hits') . ']',
-                                       'descr'         => lang('request')
+                                       'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiproject.index','query'=> $location_code, 'criteria_id' => 4)), 
//criteria 4 is for location_code
+                                       'name'          => lang('project') . " 
[{$hits}]",
+                                       'descr'         => lang('project')
                                );
                        }
 
-                       if (isset($entity))
+                       $sql = "SELECT count(*) as hits FROM fm_gab_location 
WHERE location_code $this->like '$location_code%'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       if($this->db->f('hits'))
                        {
-                               return $entity;
+                               $hits = $this->db->f('hits');
+                               $entity['gab'][] = array
+                               (
+                                       'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uigab.index','location_code'=> $location_code)),
+                                       'name'          => lang('gabnr') . " 
[{$hits}]",
+                                       'descr'         => lang('gab info')
+                               );
                        }
+
+                       return $entity;
                }
 
                function select_status_list($type_id)
@@ -206,6 +249,8 @@
                                $lookup                         = 
isset($data['lookup']) ? $data['lookup'] : '';
                                $status                         = 
isset($data['status']) ? $data['status'] : '';
                                $part_of_town_id        = 
isset($data['part_of_town_id']) ? $data['part_of_town_id'] : '';
+                               $dry_run                        = 
isset($data['dry_run']) ? $data['dry_run'] : '';
+                               $location_code          = 
isset($data['location_code']) ? $data['location_code'] : '';
                        }
 
                        if (!$type_id)
@@ -215,10 +260,11 @@
 
                        $sql = $this->socommon->fm_cache('sql_'. $type_id . '_' 
. $lookup_tenant . '_' . $lookup);
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$type_id}");
-                       $choice_table = 'phpgw_cust_choice';
+
+//                     $choice_table = 'phpgw_cust_choice';
                        $attribute_table = 'phpgw_cust_attribute';
                        $attribute_filter = " custom = 1 AND location_id = 
{$location_id}";
-                       $attribute_choice_filter = " location_id = 
{$location_id}";
+//                     $attribute_choice_filter = " location_id = 
{$location_id}";
 
                        if(!$sql)
                        {
@@ -232,6 +278,7 @@
                                $uicols['statustext'][]         = 'dummy';
                                $uicols['exchange'][]           = false;
                                $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
 
                                for ($i=0; $i<($type_id); $i++)
                                {
@@ -241,10 +288,13 @@
                                        $uicols['statustext'][]         = 
$location_types[$i]['descr'];
                                        $uicols['exchange'][]           = true;
                                        $uicols['align'][]                      
= 'center';
+                                       $uicols['datatype'][]           = 
'link';
                                        $cols                                   
        .= ",fm_location" . ($type_id) .".loc" . $location_types[$i]['id'];
                                        $cols_return[]                          
= 'loc' . $location_types[$i]['id'];
                                }
 
+                               $uicols['datatype'][$type_id] = 'I'; // correct 
the last one
+
                                $list_info = 
$location_types[($type_id-1)]['list_info'];
 
                                for ($i=1; $i<($type_id+1); $i++)
@@ -259,6 +309,7 @@
                                                $uicols['statustext'][]         
= $location_types[($i-1)]['name'] . ' ' . lang('name');
                                                $uicols['exchange'][]           
= true;
                                                $uicols['align'][]              
        = 'left';
+                                               $uicols['datatype'][]           
= 'V';
                                        }
                                }
 
@@ -296,33 +347,40 @@
                                        $uicols['statustext'][]         = 
'dummy';
                                        $uicols['exchange'][]           = true;
                                        $uicols['align'][]                      
= '';
+                                       $uicols['datatype'][]           = '';
 
                                        $cols.= ',fm_tenant.last_name';
                                        $cols_return[]                          
= 'last_name';
                                        $uicols['input_type'][]         = 
'text';
                                        $uicols['name'][]                       
= 'last_name';
+                                       $uicols['datatype'][]           = 'V';
                                        $uicols['descr'][]                      
= lang('last name');
                                        $uicols['statustext'][]         = 
lang('last name');
                                        $uicols['exchange'][]           = true;
                                        $uicols['align'][]                      
= 'left';
+                                       $uicols['datatype'][]           = 'V';
 
                                        $cols.= ',fm_tenant.first_name';
                                        $cols_return[]                          
= 'first_name';
                                        $uicols['input_type'][]         = 
'text';
                                        $uicols['name'][]                       
= 'first_name';
+                                       $uicols['datatype'][]           = 'V';
                                        $uicols['descr'][]                      
= lang('first name');
                                        $uicols['statustext'][]         = 
lang('first name');
                                        $uicols['exchange'][]           = true;
                                        $uicols['align'][]                      
= 'left';
+                                       $uicols['datatype'][]           = 'V';
 
                                        $cols.= ',fm_tenant.contact_phone';
                                        $cols_return[]                          
= 'contact_phone';
                                        $uicols['input_type'][]         = 
'text';
                                        $uicols['name'][]                       
= 'contact_phone';
+                                       $uicols['datatype'][]           = 'V';
                                        $uicols['descr'][]                      
= lang('contact phone');
                                        $uicols['statustext'][]         = 
lang('contact phone');
                                        $uicols['exchange'][]           = true;
                                        $uicols['align'][]                      
= 'left';
+                                       $uicols['datatype'][]           = 'V';
 
                                        $sub_query_tenant=1;
                                        
$this->socommon->fm_cache('sub_query_tenant_'. $type_id  . '_' . $lookup_tenant 
. '_' . $lookup,$sub_query_tenant);
@@ -363,6 +421,7 @@
                                                                
$uicols['statustext'][]         = lang('street name');
                                                                
$uicols['exchange'][]           = true;
                                                                
$uicols['align'][]                      = 'left';
+                                                               
$uicols['datatype'][]           = 'V';
 
                                                                $cols.= 
',street_number';
                                                                $cols_return[]  
                        = 'street_number';
@@ -372,6 +431,7 @@
                                                                
$uicols['statustext'][]         = lang('street number');
                                                                
$uicols['exchange'][]           = true;
                                                                
$uicols['align'][]                      = 'left';
+                                                               
$uicols['datatype'][]           = 'V';
 
                                                                $cols.= 
',fm_location' . $config[$i]['location_type'] . '.' . 
$config[$i]['column_name'];
                                                                $cols_return[]  
                        = $config[$i]['column_name'];
@@ -381,6 +441,7 @@
                                                                
$uicols['statustext'][]         = lang($config[$i]['input_text']);
                                                                
$uicols['exchange'][]           = true;
                                                                
$uicols['align'][]                      = '';
+                                                               
$uicols['datatype'][]           = '';
                                                        }
                                                }
                                                else
@@ -397,7 +458,7 @@
                                        }
                                }
 
-                               $this->db->query("SELECT * FROM 
$attribute_table WHERE list=1 AND $attribute_filter");
+                               $this->db->query("SELECT * FROM 
$attribute_table WHERE (list=1 OR lookup_form=1) AND $attribute_filter");
                                while ($this->db->next_record())
                                {
                                        $cols .= ",fm_location" . ($type_id) 
.'.' . $this->db->f('column_name');
@@ -430,17 +491,34 @@
                                        $user_column_filter = " OR 
($attribute_filter AND id IN (" . implode(',',$user_columns) .'))';
                                }
 
-                               $this->db->query("SELECT * FROM 
$attribute_table WHERE list=1 AND $attribute_filter $user_column_filter ORDER 
BY attrib_sort ASC");
-
+                               $this->db->query("SELECT DISTINCT * FROM 
$attribute_table WHERE (list=1 OR lookup_form=1) AND $attribute_filter 
$user_column_filter ORDER BY attrib_sort ASC");
                                $i      = count($uicols['name']);
                                while ($this->db->next_record())
                                {
-                                       $uicols['input_type'][]         = 
'text';
+                                       $input_type = 'text';
+                                       if($this->db->f('lookup_form') == 1 && 
$this->db->f('list') != 1)
+                                       {
+                                               $input_type = 'hidden';
+                                               $exchange       = true;
+                                       }
+                                       else if($this->db->f('lookup_form') == 
1)
+                                       {
+                                               $exchange       = true;
+                                       }
+                                       else
+                                       {
+                                               $input_type = 'text';
+                                               $exchange       = false;
+                                       }
+
+                                       $uicols['input_type'][]         = 
$input_type;
                                        $uicols['name'][]                       
= $this->db->f('column_name');
                                        $uicols['descr'][]                      
= $this->db->f('input_text');
                                        $uicols['statustext'][]         = 
$this->db->f('statustext');
                                        $uicols['datatype'][$i]         = 
$this->db->f('datatype');
-                                       $cols_return_extra[]= array(
+                                       $uicols['exchange'][]           = 
$exchange;
+                                       $uicols['cols_return_extra'][$i] = array
+                                       (
                                                'name'  => 
$this->db->f('column_name'),
                                                'datatype'      => 
$this->db->f('datatype'),
                                                'attrib_id'     => 
$this->db->f('id')
@@ -488,7 +566,7 @@
                        $where= 'WHERE';
 
                        $filtermethod = '';
-                       $GLOBALS['phpgw']->config->read_repository();
+                       $GLOBALS['phpgw']->config->read();
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
                        {
                                $access_location = 
$this->bocommon->get_location_list(PHPGW_ACL_READ);
@@ -509,7 +587,9 @@
 
                        if ($filter > 0)
                        {
-                               
if($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] 
== 'owner')
+                               //address@hidden 16/09/08       validacion is 
added to avoid notice
+                               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
+                               
//if($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter']
 == 'owner')
                                {
                                        $filtermethod .= " $where 
fm_owner.id='$filter' ";
                                }
@@ -546,6 +626,12 @@
                                $where= 'AND';
                        }
 
+                       if ($location_code)
+                       {
+                               $filtermethod .= "  {$where} 
fm_location{$type_id}.location_code $this->like '{$location_code}%'";
+                               $where= 'AND';                  
+                       }
+
                        $querymethod = '';
 
                        if($query)
@@ -585,6 +671,10 @@
                        $sql .= "$filtermethod $querymethod";
 
 //echo $sql; die();
+                       //address@hidden 23/07/08 avoid retrieve data in first 
time, only render definition for headers (var myColumnDefs)
+                       $values = array();
+                       if(!$dry_run)
+                       {
                        $this->db->query('SELECT count(*)' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
                        $this->db->next_record();
                        $this->total_records = $this->db->f(0);
@@ -599,98 +689,28 @@
                        }
 
                        $j=0;
-                       $cols_return_count      = count($cols_return);
+
                        $location_count         = $type_id-1;
-                       $contacts               = 
CreateObject('phpgwapi.contacts');
-                       $location_list          = array();
 
+                               $cols_return = $uicols['name'];
+                               $dataset = array();
                        while ($this->db->next_record())
                        {
-                               for ($i=0;$i<$cols_return_count;$i++)
-                               {
-                                       $location_list[$j][$cols_return[$i]] = 
stripslashes($this->db->f($cols_return[$i]));
-
-                                       $value = $this->db->f($cols_return[$i]);
-                               }
-
-                               if(isset($cols_return_extra) && 
is_array($cols_return_extra))
-                               {
-                                       for 
($i=0;$i<count($cols_return_extra);$i++)
-                                       {
-                                               $value = 
$this->db->f($cols_return_extra[$i]['name'], true);
-
-                                               
if(($cols_return_extra[$i]['datatype']=='R' || 
$cols_return_extra[$i]['datatype']=='LB') && $value)
+                                       foreach($cols_return as $key => $field)
                                                {
-                                       //              $sql="SELECT value FROM 
fm_location_choice where type_id=$type_id AND attrib_id=" 
.$cols_return_extra[$i]['attrib_id']. "  AND id=" . $value;
-                                                       $sql="SELECT value FROM 
$choice_table WHERE $attribute_choice_filter AND attrib_id=" 
.$cols_return_extra[$i]['attrib_id']. "  AND id=" . $value;
-                                                       $this->db2->query($sql);
-                                                       
$this->db2->next_record();
-                                                       
$location_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('value');
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='AB' && $value)
-                                               {
-                                                       $contact_data   = 
$contacts->read_single_entry($value,array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-                                                       
$location_list[$j][$cols_return_extra[$i]['name']]      = 
$contact_data[0]['n_family'] . ', ' . $contact_data[0]['n_given'];
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='VENDOR' && $value)
-                                               {
-                                                       $sql="SELECT org_name 
FROM fm_vendor where id=$value";
-                                                       $this->db2->query($sql);
-                                                       
$this->db2->next_record();
-                                                       
$location_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('org_name');
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='CH' && $value)
-                                               {
-                                                       $ch= 
unserialize($value);
-
-                                                       if (isset($ch) AND 
is_array($ch))
-                                                       {
-                                                               for 
($k=0;$k<count($ch);$k++)
-                                                               {
-                       //                                              
$sql="SELECT value FROM fm_location_choice where type_id=$type_id AND 
attrib_id=" .$cols_return_extra[$i]['attrib_id']. "  AND id=" . $ch[$k];
-                                                                       
$sql="SELECT value FROM $choice_table WHERE $attribute_choice_filter AND 
attrib_id=" .$cols_return_extra[$i]['attrib_id']. "  AND id=" . $ch[$k];
-                                                                       
$this->db2->query($sql);
-                                                                       while 
($this->db2->next_record())
-                                                                       {
-                                                                               
$ch_value[]=$this->db2->f('value');
-                                                                       }
-                                                               }
-                                                               
$location_list[$j][$cols_return_extra[$i]['name']] = @implode(",", $ch_value);
-                                                               
unset($ch_value);
-                                                       }
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='D' && $value)
-                                               {
-                                                       
$location_list[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($value));
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='timestamp' && $value)
-                                               {
-                                                       
$location_list[$j][$cols_return_extra[$i]['name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$value);
-                                               }
-                                               else 
if($cols_return_extra[$i]['datatype']=='link' && $value)
-                                               {
-                                                       
$location_list[$j][$cols_return_extra[$i]['name']]= 
phpgw::safe_redirect($value);
-                                               }
-                                               else
-                                               {
-                                                       
$location_list[$j][$cols_return_extra[$i]['name']] = $value;
-                                               }
-                                       }
-                                       unset($value);
+                                               $dataset[$j][$field] = array
+                                               (
+                                                       'value'         => 
$this->db->f($field),
+                                                       'datatype'      => 
$uicols['datatype'][$key],
+                                                       'attrib_id'     => 
isset($uicols['cols_return_extra'][$key]['attrib_id']) ? 
$uicols['cols_return_extra'][$key]['attrib_id']:''
+                                               );
                                }
-
-                               $location_code= $this->db->f('location_code');
-                               $location = split('-',$location_code);
-                               for ($m=0;$m<$location_count;$m++)
-                               {
-                                       $location_list[$j]['loc' . ($m+1)] = 
$location[$m];
-                                       
$location_list[$j]['query_location']['loc' . ($m+1)]=implode("-", 
array_slice($location, 0, ($m+1)));
-                               }
-
                                $j++;
                        }
 
-                       return $location_list;
+                               $values = 
$this->custom->translate_value($dataset, $location_id, $location_count);
+                       }
+                       return $values;
                }
 
                function 
generate_sql($type_id='',$cols='',$cols_return='',$uicols='',$read_single='')
@@ -838,24 +858,29 @@
                        $fm_location_cols = $custom->find('property', 
'.location.' . $type_id, 0, '', '', '', true);
 //_debug_array($fm_location_cols);
 
-                       $location_cols_count    = count($fm_location_cols);
-
                        if($read_single)
                        {
                                $cols .= ",fm_location{$type_id}.*";
+                               foreach ($fm_location_cols as $location_col)
+                               {
+                                       if($location_col['lookup_form'] == 1)
+                                       {
+                                               $cols_return[]                  
= $location_col['column_name'];
+                                       }
+                               }
                        }
                        else
                        {
-                               for ($i=0;$i<$location_cols_count;$i++)
+                               foreach ($fm_location_cols as $location_col)
                                {
-                                       if($fm_location_cols[$i]['list']==1)
+                                       if($location_col['list'] == 1)
                                        {
-                                               $cols .= ",fm_location" . 
($type_id) .".".$fm_location_cols[$i]['column_name'];
-                                               $cols_return[]                  
= $fm_location_cols[$i]['column_name'];
+                                               $cols .= ",fm_location" . 
($type_id) .".".$location_col['column_name'];
+                                               $cols_return[]                  
= $location_col['column_name'];
                                                $uicols['input_type'][]         
= 'text';
-                                               $uicols['name'][]               
= $fm_location_cols[$i]['column_name'];
-                                               $uicols['descr'][]              
= $fm_location_cols[$i]['input_text'];
-                                               $uicols['statustext'][]         
= $fm_location_cols[$i]['statustext'];
+                                               $uicols['name'][]               
= $location_col['column_name'];
+                                               $uicols['descr'][]              
= $location_col['input_text'];
+                                               $uicols['statustext'][]         
= $location_col['statustext'];
                                        }
                                }
                        }
@@ -932,12 +957,11 @@
 //echo $sql;
                        $cols_return    = $this->cols_return;
 
-                       $cols_return_count      = count($cols_return);
+                       $this->db->next_record();
 
-                       $this->db->next_record();
-                       for ($i=0;$i<$cols_return_count;$i++)
+                       foreach ($cols_return as $col)
                        {
-                               $values[$cols_return[$i]] = 
stripslashes($this->db->f($cols_return[$i]));
+                               $values[$col] = $this->db->f($col,true);
                        }
 
                        if ( isset($values['attributes']) && 
is_array($values['attributes']) )
@@ -953,9 +977,9 @@
                        return $values;
                }
 
-               function add($location='',$values_attribute='',$type_id='')
+               function add($location,$values_attribute = array(),$type_id='')
                {
-                       while (is_array($location) && list($input_name,$value) 
= each($location))
+                       foreach ($location as $input_name => $value)
                        {
                                if($value)
                                {
@@ -999,6 +1023,18 @@
 
                        $this->db->transaction_commit();
                        $receipt['message'][] = array('msg'=>lang('Location %1 
has been saved',$location['location_code']));
+
+                       $GLOBALS['phpgw']->config->read();
+                       // Keep it at level 1 for the moment
+                       
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'] && $type_id == 1)
+                       {
+                               $acl_location = ".location.{$type_id}." . 
str_replace("-",'.',$location['location_code']);
+                               
if(!$GLOBALS['phpgw']->locations->get_id('property', $acl_location))
+                               {
+                                       
$GLOBALS['phpgw']->locations->add($acl_location, 
$location["loc{$type_id}_name"], 'property');
+                               }
+                       }
+
                        return $receipt;
                }
 
@@ -1168,6 +1204,108 @@
                        return $receipt;
                }
 
+
+               function update_location()
+               {
+                       $this->db->transaction_begin();
+
+                       $this->db->query('SELECT max(id) as levels FROM 
fm_location_type');
+                       $this->db->next_record();
+                       $levels =  $this->db->f('levels');
+
+                       //perform an update on all location_codes on all levels 
to make sure they are consistent and unique
+                       $locations = array();
+                       for ($level=1;$level<($levels+1);$level++)
+                       {
+                               $sql = "SELECT * from fm_location{$level}";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $i = 0;
+                               while($this->db->next_record())
+                               {
+                                       $location_code = array();
+                                       $where = 'WHERE';
+                                       $locations[$level][$i]['condition'] = 
'';
+                                       for ($j=1;$j<($level+1);$j++)
+                                       {
+                                               $loc = $this->db->f("loc{$j}");
+                                               $location_code[] = $loc;
+                                               
$locations[$level][$i]['condition'] .= "$where loc{$j}='{$loc}'";
+                                               $where = 'AND';
+                                       }
+                                       
$locations[$level][$i]['new_values']['location_code'] = implode('-', 
$location_code);
+                                       $i++;
+                               }
+
+                       }
+
+                       foreach($locations as $level => $location_at_leve)
+                       {
+                               foreach($location_at_leve as $location )
+                               {
+                                       $sql = "UPDATE fm_location{$level} SET 
location_code = '{$location['new_values']['location_code']}' 
{$location['condition']}";
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                               }
+                       }
+
+                       $locations = array();
+                       for ($i=1;$i<($levels+1);$i++)
+                       {
+                               $this->db->query("SELECT 
fm_location{$i}.location_code from fm_location{$i} $this->left_join 
fm_locations ON fm_location{$i}.location_code = fm_locations.location_code 
WHERE fm_locations.location_code IS NULL");
+                               while($this->db->next_record())
+                               {
+                                       $locations[] = array
+                                       (
+                                               'level'                 => $i,
+                                               'location_code' => 
$this->db->f('location_code')
+                                       );
+                               }
+                       }
+
+                       $receipt = array();
+                       foreach ($locations as $location)
+                       {
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES ({$location['level']}, 
'{$location['location_code']}')");
+
+                               
$receipt['message'][]=array('msg'=>lang('location %1 added at level %2', 
$location['location_code'], $location['level']));
+                       }
+
+// Check ACL-location - currently only level 1
+                       $GLOBALS['phpgw']->config->read();
+                       
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
+                       {
+                               $level = 1;
+                               $acl_locations = array();
+                               $this->db->query("SELECT location_code, 
loc{$level}_name FROM fm_location{$level}");
+                               while($this->db->next_record())
+                               {
+                                       $acl_locations[] = array
+                                       (
+                                               'id'    => 
".location.{$level}." . str_replace("-",'.',$this->db->f('location_code')),
+                                               'name'  => 
$this->db->f("loc{$level}_name", true)
+                                       );
+                               }
+
+                               foreach($acl_locations as $acl_location)
+                               {
+                                       
if(!$GLOBALS['phpgw']->locations->get_id('property', $acl_location['id']))
+                                       {
+                                               
$GLOBALS['phpgw']->locations->add($acl_location['id'], $acl_location['name'], 
'property');
+                                               
$receipt['message'][]=array('msg'=>lang('%1 added as ACL-location %2', 
$acl_location['name'], $acl_location['id']));
+                                       }
+                               }
+                       }
+
+                       if( $this->db->transaction_commit() )
+                       {
+                               return $receipt;
+                       }
+                       else
+                       {
+                               return 
$receipt['error'][]=array('msg'=>lang('update failed'));
+                       }
+               }
+
+
                function read_summary($data='')
                {
                        if(is_array($data))
@@ -1328,84 +1466,37 @@
                        $this->uicols['descr'][] = lang('exp date');
 
 
-                       $attrib[] = array(
+                       $attrib[] = array
+                       (
                                'column_name' => 'exp_date',
                                'input_text' => 'exp date',
-                               'datatype' => 'D'
+                               'datatype'              => 'D',
+                               'attrib_id'             => 0
                        );
 
                        $sql = "SELECT $table.*, $table_category.descr as 
category FROM $table $this->left_join $table_category ON $table.category 
=$table_category.id WHERE location_code='$location_code' ORDER BY exp_date 
DESC";
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        $j=0;
+                       $cols_return = $uicols['name'];
+                       $dataset = array();
                        while ($this->db->next_record())
                        {
-                               for ($i=0; $i<count($attrib); $i++)
-                               {
-                                       
$location[$j][$attrib[$i]['column_name']]=$this->db->f($attrib[$i]['column_name']);
-
-                                       $value = 
$this->db->f($attrib[$i]['column_name']);
-                                       if(($attrib[$i]['datatype']=='R' || 
$attrib[$i]['datatype']=='LB') && $value)
+                               foreach($attrib as $key => $field)
                                        {
-
-                                               $sql="SELECT value FROM 
$choice_table WHERE $attribute_filter AND attrib_id=" 
.$attrib[$i]['attrib_id']. "  AND id=" . $value;
-                                               $this->db2->query($sql);
-                                               $this->db2->next_record();
-                                               
$location[$j][$attrib[$i]['column_name']] = $this->db2->f('value');
-                                       }
-                                       else if($attrib[$i]['datatype']=='AB' 
&& $value)
-                                       {
-                                               $contact_data   = 
$contacts->read_single_entry($value,array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-                                               
$location[$j][$attrib[$i]['column_name']]       = $contact_data[0]['n_family'] 
. ', ' . $contact_data[0]['n_given'];
-                                       }
-                                       else 
if($attrib[$i]['datatype']=='VENDOR' && $value)
-                                       {
-                                               $sql="SELECT org_name FROM 
fm_vendor where id=$value";
-                                               $this->db2->query($sql);
-                                               $this->db2->next_record();
-                                               
$location[$j][$attrib[$i]['column_name']] = $this->db2->f('org_name');
-                                       }
-                                       else if($attrib[$i]['datatype']=='CH' 
&& $value)
-                                       {
-                                               $ch= unserialize($value);
-                                               if (isset($ch) AND 
is_array($ch))
-                                               {
-                                                       for 
($k=0;$k<count($ch);$k++)
-                                                       {
-                                                               $sql="SELECT 
value FROM $choice_table WHERE $attribute_filter AND attrib_id=" 
.$attrib[$i]['attrib_id']. "  AND id=" . $ch[$k];
-                                                               
$this->db2->query($sql);
-                                                               while 
($this->db2->next_record())
-                                                               {
-                                                                       
$ch_value[]=$this->db2->f('value');
-                                                               }
-                                                       }
-                                                       
$location[$j][$attrib[$i]['column_name']] = @implode(",", $ch_value);
-                                                       unset($ch_value);
-                                               }
-                                       }
-                                       else if($attrib[$i]['datatype']=='D' && 
$value)
-                                       {
-                                               
$location[$j][$attrib[$i]['column_name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($value));
-                                       }
-                                       else 
if($cols_return_extra[$i]['datatype']=='link' && $value)
-                                       {
-                                               
$location_list[$j][$cols_return_extra[$i]['name']]= 
phpgw::safe_redirect($value);
-                                       }
-                                       else 
if($attrib[$i]['column_name']=='entry_date' && $value)
-                                       {
-                                               
$location[$j][$attrib[$i]['column_name']]=date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$value);
-                                       }
-                                       else
-                                       {
-                                               
$location_list[$j][$cols_return_extra[$i]['name']] = $value;
-                                       }
-
-                                       unset($value);
+                                       $dataset[$j][$field['column_name']] = 
array
+                                       (
+                                               'value'         => 
$this->db->f($field['column_name']),
+                                               'datatype'      => 
$field['datatype'],
+                                               'attrib_id'     => 
$field['attib_id']
+                                       );
                                }
                                $j++;
                        }
 
-                       return $location;
+                       $values = $this->custom->translate_value($dataset, 
$location_id);
+
+                       return $values;
                }
 
                function get_tenant_location($tenant_id='')
@@ -1429,5 +1520,10 @@
                        }
                }
 
+               function get_item_id($location_code )
+               {
+                       $this->db->query("SELECT id FROM fm_locations WHERE 
location_code='{$location_code}'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f('id');
+               }
        }
-

Modified: people/sigurdne/modules/property/trunk/inc/class.solookup.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.solookup.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.solookup.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -36,14 +36,12 @@
        {
                var $grants;
 
-               function property_solookup()
+               function __construct()
                {
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read_addressbook($data)
@@ -56,9 +54,9 @@
                                $sort   = isset($data['sort']) && $data['sort'] 
? $data['sort']:'DESC';
                                $order  = 
isset($data['order'])?$data['order']:'';
                                $cat_id = 
isset($data['cat_id'])?$data['cat_id']:0;
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                        }
 
-
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
@@ -88,7 +86,15 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
+
+                       if(!$allrows)
+                       {
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);                        
+                       }
 
                        $contact = array();
                        while ($this->db->next_record())
@@ -111,18 +117,19 @@
                                $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
                                $filter         = 
isset($data['filter'])?$data['filter']:'none';
                                $query          = 
isset($data['query'])?$data['query']:'';
-                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'ASC';
                                $order          = 
isset($data['order'])?$data['order']:'';
                                $cat_id         = 
isset($data['cat_id'])?$data['cat_id']:0;
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                        }
 
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
+                               $ordermethod = " ORDER BY $order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by org_name DESC';
+                               $ordermethod = ' ORDER BY org_name ASC';
                        }
 
 
@@ -145,7 +152,14 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
+                       if(!$allrows)
+                       {
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);                        
+                       }
 
                        $vendor = array();
                        while ($this->db->next_record())
@@ -172,6 +186,7 @@
                                $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
                                $order          = 
isset($data['order'])?$data['order']:'';
                                $cat_id         = 
isset($data['cat_id'])?$data['cat_id']:0;
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                        }
 
                        if ($order)
@@ -194,7 +209,15 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
+
+                       if(!$allrows)
+                       {
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);                        
+                       }
 
                        $b_account = array();
                        while ($this->db->next_record())
@@ -220,6 +243,7 @@
                                $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
                                $order          = 
isset($data['order'])?$data['order']:'';
                                $cat_id         = 
isset($data['cat_id'])?$data['cat_id']:0;
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                        }
 
                        if ($order)
@@ -242,7 +266,14 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
+                       if(!$allrows)
+                       {
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
 
                        $street = array();
                        while ($this->db->next_record())
@@ -267,6 +298,7 @@
                                $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
                                $order          = 
isset($data['order'])?$data['order']:'';
                                $cat_id         = 
isset($data['cat_id'])?$data['cat_id']:0;
+                               $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
                        }
 
                        if ($order)
@@ -289,7 +321,15 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
+
+                       if(!$allrows)
+                       {
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
 
                        $tenant = array();
                        while ($this->db->next_record())

Modified: people/sigurdne/modules/property/trunk/inc/class.sop_of_town.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sop_of_town.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sop_of_town.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,16 +35,13 @@
        class property_sop_of_town
        {
 
-               function property_sop_of_town()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function read_district_name($id)
@@ -95,8 +92,8 @@
 
                        $sql = "SELECT fm_part_of_town.*, descr as category 
FROM fm_part_of_town $this->join fm_district on 
fm_part_of_town.district_id=fm_district.id $filtermethod $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {

Added: people/sigurdne/modules/property/trunk/inc/class.sopending_action.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sopending_action.inc.php   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.sopending_action.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,332 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage core
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       phpgw::import_class('phpgwapi.datetime');
+
+       class property_sopending_action
+       {
+               public $total_records;
+
+               /**
+                * @var array valid responsible types
+                */
+               protected $valid_responsible_types = array(
+                                                               'user',
+                                                               'vendor',
+                                                               'tenant'
+                                                       );
+
+               //To avoid conflicting transactions
+               protected $global_transaction  = false;
+
+               function __construct()
+               {
+                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
+               }
+
+               /**
+               * Set pending action for items across the system.
+               *
+               * @param array   $data array containing string  'appname'       
                - the name of the module being looked up
+               *                                                               
                string  'location'                      - the location within 
the module to look up
+               *                                                               
                integer 'id'                            - id of the referenced 
item - could possibly be a bigint
+               *                                                               
                integer 'responsible'           - the user_id asked for approval
+               *                                                               
                string  'responsible_type'  - what type of responsible is asked 
for action (user,vendor or tenant)
+               *                                                               
                string  'action'                        - what type of action 
is pending
+               *                                                               
                string  'remark'                        - a general remark - if 
any
+               *                                                               
                integer 'deadline'                      - unix timestamp if any 
deadline is given.
+               *
+               * @return integer $reminder  number of request for this action
+               */
+
+               public function set_pending_action($data = array())
+               {
+                       $appname                = $data['appname'];
+                       $location               = $data['location'];
+                       $item_id                = $data['id']; //possible bigint
+                       $responsible    = (int) $data['responsible'];
+                       $action                 = 
$this->db->db_addslashes($data['action']);
+                       $remark                 = 
$this->db->db_addslashes($data['remark']);
+                       $deadline               = (int) $data['deadline'];
+
+                       if( !$item_id)
+                       {
+                               throw new Exception("No item_id given");
+                       }
+
+                       $responsible_type = isset($data['responsible_type']) && 
$data['responsible_type'] ? $data['responsible_type'] : 'user';
+
+                       if( !in_array($responsible_type, 
$this->valid_responsible_types))
+                       {
+                               throw new Exception("'{$responsible_type}' is 
not a valid responsible_type");
+                       }
+
+                       $sql = "SELECT id FROM fm_action_pending_category WHERE 
num = '{$action}'";
+                       $this->db->query($sql, __LINE__,__FILE__);
+                       $this->db->next_record();
+                       $action_category = $this->db->f('id');
+                       if ( !$action_category )
+                       {
+                               throw new Exception("'{$action}' is not a valid 
action_type");
+                       }
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
+
+                       if ( !$location_id )
+                       {
+                               throw new Exception("phpgwapi_locations::get_id 
({$appname}, {$location}) returned 0");
+                       }
+
+                       $reminder = 1;
+
+                       if( $this->db->Transaction )
+                       {
+                               $this->global_transaction = true;
+                       }
+                       else
+                       {
+                               $this->db->transaction_begin();
+                       }
+
+                       $condition = " WHERE location_id = {$location_id}"
+                               . " AND item_id = {$item_id}"
+                               . " AND responsible = {$responsible}"
+                               . " AND action_category = {$action_category}"
+                               . " AND action_performed IS NULL"
+                               . " AND expired_on IS NULL";
+
+                       $sql = "SELECT id, reminder FROM fm_action_pending 
{$condition}";
+
+                       $this->db->query($sql, __LINE__,__FILE__);
+                       $this->db->next_record();
+                       if($this->db->f('reminder'))
+                       {
+                               $reminder       = $this->db->f('reminder') + 1;
+                               $id                     = $this->db->f('id');
+
+                               $value_set = array
+                               (
+                                       'expired_on'            => 
phpgwapi_datetime::user_localtime(),
+                                       'expired_by'            => 
$this->account,
+                               );
+
+                               if ( $deadline > 0 )
+                               {
+                                       $value_set['deadline'] = $deadline;
+                               }
+
+                               if( isset($data['close']) && $data['close'] )
+                               {
+                                       $value_set['action_performed'] = 
phpgwapi_datetime::user_localtime();
+                               }
+
+                               $value_set      = 
$this->db->validate_update($value_set);
+                               $sql = "UPDATE fm_action_pending SET 
{$value_set} WHERE id = $id";
+                               $ok = !!$this->db->query($sql, 
__LINE__,__FILE__);
+
+                               if( isset($data['close']) && $data['close'] )
+                               {
+                                       if( !$this->global_transaction )
+                                       {
+                                               $this->db->transaction_commit();
+                                       }
+                                       return $ok;
+                               }
+                       }
+
+                       //if nothing found - and you want to close
+                       if( isset($data['close']) && $data['close'] )
+                       {
+                               return 0;
+                       }
+
+
+                       $values= array
+                       (
+                               $item_id,                                       
                        //item_id
+                               $location_id,
+                               $responsible,                                   
                // responsible
+                               $responsible_type,                              
                // responsible_type
+                               $action_category,                               
                //action_category
+                               phpgwapi_datetime::user_localtime(),    // 
action_requested
+                               $reminder,
+                               $deadline,                                      
                        //action_deadline
+                               phpgwapi_datetime::user_localtime(),    
//created_on
+                               $this->account,                                 
                //created_by
+                               $remark                                         
                        //remark
+                       );
+
+                       $values = $this->db->validate_insert($values);
+                       $sql = "INSERT INTO fm_action_pending ("
+                               . "item_id, location_id, responsible, 
responsible_type,"
+                               . "action_category, action_requested, reminder, 
action_deadline,"
+                               . "created_on, created_by, remark) VALUES ( 
$values $vals)";
+                       $this->db->query($sql, __LINE__,__FILE__);
+
+                       if( !$this->global_transaction )
+                       {
+                               $this->db->transaction_commit();
+                       }
+
+                       return $reminder;
+               }
+
+               /**
+               * Get pending action for items across the system.
+               *
+               * @param array   $data array containing string  'appname'       
                - the name of the module being looked up
+               *                                                               
                string  'location'                      - the location within 
the module to look up
+               *                                                               
                integer 'id'                            - id of the referenced 
item - could possibly be a bigint
+               *                                                               
                integer 'responsible'           - the user_id asked for approval
+               *                                                               
                string  'responsible_type'  - what type of responsible is asked 
for action (user,vendor or tenant)
+               *                                                               
                string  'action'                        - what type of action 
is pending
+               *                                                               
                integer 'created_by'            - The user that owns the record
+               *                                                               
                integer 'deadline'                      - unix timestamp if any 
deadline is given.
+               *
+               * @return array $ret  dataset also containing an url to the 
item in question
+               */
+
+               public function get_pending_action($data = array())
+               {
+                       $start                          = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
+                       $appname                        = 
isset($data['appname']) && $data['appname'] ? $data['appname'] : '';
+                       $location                       = 
isset($data['location']) && $data['location'] ? $data['location'] : '';
+                       $item_id                        = isset($data['id']) && 
$data['id'] ? $data['id'] : '';$data['id']; //possible bigint
+                       $responsible            = (int) $data['responsible'];
+                       $responsible_type       = 
isset($data['responsible_type']) && $data['responsible_type'] ? 
$data['responsible_type'] : 'user';
+                       $action                         = 
isset($data['action']) && $data['action'] ? 
$this->db->db_addslashes($data['action']) : '';
+                       $deadline                       = 
isset($data['deadline']) && $data['deadline'] ? (int) $data['deadline'] : 0;
+                       $created_by                     = 
isset($data['created_by']) && $data['created_by'] ? (int) $data['created_by'] : 
0;
+                       $sort                           = isset($data['sort']) 
&& $data['sort'] ? $data['sort'] : 'DESC';
+                       $order                          = isset($data['order']) 
? $data['order'] : '';
+                       $allrows                        = 
isset($data['allrows']) ? $data['allrows'] : '';
+
+                       if( !in_array($responsible_type, 
$this->valid_responsible_types))
+                       {
+                               throw new Exception("'{$responsible_type}' is 
not a valid responsible_type");
+                       }
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
+
+                       if ( !$location_id )
+                       {
+                               throw new Exception("phpgwapi_locations::get_id 
({$appname}, {$location}) returned 0");
+                       }
+
+                       $ret = array();
+                       $condition = " WHERE action_performed IS NULL AND 
expired_on IS NULL AND num = '{$action}' AND location_id = {$location_id}";
+
+                       if( $responsible )
+                       {
+                               $condition .= " AND responsible = 
{$responsible}";
+                       }
+
+                       if( $item_id )
+                       {
+                               $condition .= " AND item_id = {$item_id}";
+                       }
+
+                       if( $deadline )
+                       {
+                               $condition .= " AND deadline < {$deadline}";
+                       }
+
+                       if( $created_by )
+                       {
+                               $condition .= " AND created_by = {$created_by}";
+                       }
+
+                       if ($order)
+                       {
+                               $ordermethod = " ORDER BY $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = ' ORDER BY created_on DESC';
+                       }
+
+                       $sql = "SELECT fm_action_pending.* FROM 
fm_action_pending {$this->join} fm_action_pending_category"
+                       . " ON fm_action_pending.action_category = 
fm_action_pending_category.id {$condition}";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
+
+                       if(!$allrows)
+                       {
+                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+
+                       $ret = $this->db->resultSet;
+
+                       $interlink = CreateObject('property.interlink');
+
+                       foreach ($ret as &$entry)
+                       {
+                               if( !$location )
+                               {
+                                       $location = 
$GLOBALS['phpgw']->locations->get_name($entry['location_id']);
+                               }
+                               $entry['url'] = 
$interlink->get_relation_link($location, $entry['item_id'], 'edit');
+                       }
+                       return $ret;
+               }
+
+               /**
+               * Close pending action for items across the system.
+               *
+               * @param array   $data array containing string  'appname'       
                - the name of the module being looked up
+               *                                                               
                string  'location'                      - the location within 
the module to look up
+               *                                                               
                integer 'id'                            - id of the referenced 
item - could possibly be a bigint
+               *                                                               
                integer 'responsible'           - the user_id asked for approval
+               *                                                               
                string  'responsible_type'  - what type of responsible is asked 
for action (user,vendor or tenant)
+               *                                                               
                string  'action'                        - what type of action 
is pending
+               *                                                               
                string  'remark'                        - a general remark - if 
any
+               *                                                               
                integer 'deadline'                      - unix timestamp if any 
deadline is given.
+               *
+               * @return integer $reminder  number of request for this action
+               */
+               public function close_pending_action($data = array())
+               {
+                       $data['close'] = true;
+                       return !!$this->set_pending_action($data);
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.sopending_action.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sopricebook.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,16 +35,12 @@
        class property_sopricebook
        {
 
-               function property_sopricebook()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                }
 
                function 
add_activity_first_prize($m_cost,$w_cost,$total_cost,$activity_id,$agreement_id,$date)
@@ -251,8 +247,8 @@
 //echo $sql;
 
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -335,8 +331,8 @@
 
                        $sql = "SELECT * FROM  fm_agreement_group $filtermethod 
$querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -417,8 +413,8 @@
                                . " FROM fm_activity_price_index $this->join 
fm_agreement on fm_activity_price_index.agreement_id = fm_agreement.id "
                                . " Where activity_id= '$activity_id' and 
fm_activity_price_index.agreement_id= '$agreement_id'";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -497,8 +493,8 @@
                                . " $filtermethod $querymethod ";
 
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -574,8 +570,8 @@
                                . " Where fm_activity_price_index.activity_id= 
'$activity_id' $querymethod group by fm_activities.id,fm_activities.num,"
                                . " fm_branch.descr,org_name , fm_agreement.id 
";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -658,7 +654,7 @@
                                $values['base_descr']
                                );
 
-                       $vals   = $this->bocommon->validate_db_insert($vals);
+                       $vals   = $this->db->validate_insert($vals);
 
                        $this->db->transaction_begin();
                        $this->db->query("INSERT INTO fm_activities (id, 
num,unit,agreement_group_id,ns3420,dim_d,branch_id,descr,base_descr) "
@@ -686,7 +682,7 @@
                                'base_descr'                    => 
$values['base_descr']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
                        $this->db->transaction_begin();
                        $this->db->query("UPDATE fm_activities set $value_set 
WHERE id= '" . $values['activity_id'] . "'",__LINE__,__FILE__);
                        $this->db->transaction_commit();
@@ -707,7 +703,7 @@
                                $values['descr']
                                );
 
-                       $vals   = $this->bocommon->validate_db_insert($vals);
+                       $vals   = $this->db->validate_insert($vals);
 
                        $this->db->query("INSERT INTO fm_agreement_group 
(id,num,status,descr) "
                                . "VALUES ($vals)",__LINE__,__FILE__);
@@ -727,7 +723,7 @@
                                'descr' => $values['descr']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
                        $this->db->transaction_begin();
 
                        $this->db->query("UPDATE fm_agreement_group set 
$value_set WHERE id= '" . $values['agreement_group_id'] . 
"'",__LINE__,__FILE__);

Modified: people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soproject.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,18 +34,19 @@
 
        class property_soproject
        {
+               var $total_records = 0;
 
-               function property_soproject()
+               function __construct()
                {
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
                        $this->interlink        = 
CreateObject('property.interlink');
+                       $this->custom           = 
createObject('property.custom_fields');
 
-                       $this->like =& $this->db->like;
-                       $this->join =& $this->db->join;
-                       $this->left_join = " LEFT JOIN ";
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
 
                        $this->acl              = & $GLOBALS['phpgw']->acl;
                        $this->grants   = 
$this->acl->get_grants('property','.project');
@@ -53,7 +54,7 @@
 
                function select_status_list()
                {
-                       $this->db->query("SELECT id, descr FROM 
fm_workorder_status ORDER BY id ");
+                       $this->db->query("SELECT id, descr FROM 
fm_project_status ORDER BY id ");
 
                        $i = 0;
                        while ($this->db->next_record())
@@ -99,7 +100,7 @@
                        if(is_array($data))
                        {
                                $start  = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
-                               $filter = $data['filter']?$data['filter']:'all';
+                               $filter = 
$data['filter']?(int)$data['filter']:0;
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
@@ -109,6 +110,9 @@
                                $end_date = 
(isset($data['end_date'])?$data['end_date']:'');
                                $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
                                $wo_hour_cat_id = 
(isset($data['wo_hour_cat_id'])?$data['wo_hour_cat_id']:'');
+                               $district_id    = 
(isset($data['district_id'])?$data['district_id']:'');
+                               $dry_run                = 
isset($data['dry_run']) ? $data['dry_run'] : '';
+                               $criteria       = isset($data['criteria']) && 
$data['criteria'] ? $data['criteria'] : array();                          
                        }
 
                        $sql = $this->bocommon->fm_cache('sql_project_' . 
!!$wo_hour_cat_id);
@@ -126,13 +130,47 @@
                                $uicols['name'][]                       = 
'project_id';
                                $uicols['descr'][]                      = 
lang('Project');
                                $uicols['statustext'][]         = lang('Project 
ID');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
+                               $cols .= ", project_group";
+                               $cols_return[]                          = 
'project_group';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'project_group';
+                               $uicols['descr'][]                      = 
lang('group');
+                               $uicols['statustext'][]         = lang('Project 
group');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = 'rightClasss';
+
+                               $cols .= ", fm_project_status.descr as status";
+                               $cols_return[]                          = 
'status';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'status';
+                               $uicols['descr'][]                      = 
lang('status');
+                               $uicols['statustext'][]         = 
lang('status');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
+
                                $cols.= ",$entity_table.start_date";
                                $cols_return[]                          = 
'start_date';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'start_date';
                                $uicols['descr'][]                      = 
lang('start date');
                                $uicols['statustext'][]         = lang('Project 
start date');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols.= ",$entity_table.name as name";
                                $cols_return[]                          = 
'name';
@@ -140,13 +178,35 @@
                                $uicols['name'][]                       = 
'name';
                                $uicols['descr'][]                      = 
lang('name');
                                $uicols['statustext'][]         = lang('Project 
name');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
+                               $cols.= ",loc1_name";
+                               $cols_return[]                          = 
'loc1_name';
+                               $uicols['input_type'][]         = 'hidden';
+                               $uicols['name'][]                       = 
'loc1_name';
+                               $uicols['descr'][]                      = 
lang('loc1_name');
+                               $uicols['statustext'][]         = 
lang('loc1_name');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
+
                                $cols.= ",account_lid as coordinator";
                                $cols_return[]                          = 
'coordinator';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'coordinator';
                                $uicols['descr'][]                      = 
lang('Coordinator');
                                $uicols['statustext'][]         = lang('Project 
coordinator');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols.= ",(fm_project.budget + 
fm_project.reserve) as budget";
                                $cols_return[]                          = 
'budget';
@@ -154,6 +214,11 @@
                                $uicols['name'][]                       = 
'budget';
                                $uicols['descr'][]                      = 
lang('Project budget');
                                $uicols['statustext'][]         = lang('Project 
budget');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = 
'myFormatCount2';
+                               $uicols['classname'][]          = 'rightClasss';
 
                                $cols .= ',sum(fm_workorder.combined_cost) as 
combined_cost';
                                $cols_return[] = 'combined_cost';
@@ -161,6 +226,11 @@
                                $uicols['name'][]                       = 
'combined_cost';
                                $uicols['descr'][]                      = 
lang('Sum     workorder');
                                $uicols['statustext'][]         = lang('Cost - 
either budget or calculation');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = 
'myFormatCount2';
+                               $uicols['classname'][]          = 'rightClasss';
 
                                $cols .= ',(sum(fm_workorder.act_mtrl_cost) + 
sum(fm_workorder.act_vendor_cost)) as actual_cost';
                                $cols_return[] = 'actual_cost';
@@ -168,13 +238,32 @@
                                $uicols['name'][]                       = 
'actual_cost';
                                $uicols['descr'][]                      = 
lang('Actual cost');
                                $uicols['statustext'][]         = lang('Actual 
cost - paid so far');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = 
'myFormatCount2';
+                               $uicols['classname'][]          = 'rightClasss';
 
+                               $cols .= ',planned_cost';
+                               $cols_return[] = 'planned_cost';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'planned_cost';
+                               $uicols['descr'][]                      = 
lang('planned cost');
+                               $uicols['statustext'][]         = lang('ordered 
minus paid');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = 
'myFormatCount2';
+                               $uicols['classname'][]          = 'rightClasss';
 
                                $cols.= ",$entity_table.user_id";
 
                                $joinmethod = " $this->join  phpgw_accounts ON 
($entity_table.coordinator = phpgw_accounts.account_id))";
                                $paranthesis ='(';
 
+                               $joinmethod .= " $this->join fm_project_status 
ON ($entity_table.status = fm_project_status.id))";
+                               $paranthesis .='(';
+
                                $joinmethod .= " $this->left_join fm_workorder 
ON ($entity_table.id = fm_workorder.project_id))";
                                $paranthesis .='(';
 
@@ -215,6 +304,11 @@
                                $this->cols_extra       = 
$this->bocommon->fm_cache('cols_extra_project_' . !!$wo_hour_cat_id);
                        }
 
+                       if($dry_run)
+                       {
+                               return array();
+                       }
+
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
@@ -228,7 +322,7 @@
 
                        $filtermethod = '';
 
-                       $GLOBALS['phpgw']->config->read_repository();
+                       $GLOBALS['phpgw']->config->read();
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
                        {
                                $access_location = 
$this->bocommon->get_location_list(PHPGW_ACL_READ);
@@ -254,10 +348,17 @@
                                $where= 'AND';
                        }
 
-                       $group_method = ' GROUP BY 
fm_project.location_code,fm_project.id,fm_project.start_date,fm_project.name,phpgw_accounts.account_lid,fm_project.user_id,fm_project.address,fm_project.budget,fm_project.reserve';
+                       if($district_id)
+                       {
+                               $filtermethod .= " {$where} 
fm_part_of_town.district_id = {$district_id}";
+                               $where= 'AND';
+                       }
 
-                       if ($filter=='all')
-                       {
+                       $group_method = ' GROUP BY 
fm_project_status.descr,loc1_name,fm_project.location_code,fm_project.id,fm_project.start_date,'
+                               . 
'fm_project.name,phpgw_accounts.account_lid,fm_project.user_id,fm_project.address,'
+                               . 
'fm_project.budget,fm_project.reserve,planned_cost,project_group';
+
+
                                if (is_array($this->grants))
                                {
                                        $grants = $this->grants;
@@ -266,14 +367,14 @@
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
-                                       $filtermethod .= " $where 
(fm_project.user_id IN(" . implode(',',$public_user_list) . "))";
+                               $filtermethod .= " $where (fm_project.user_id 
IN(" . implode(',',$public_user_list) . ")";
 
                                        $where= 'AND';
                                }
-                       }
-                       else
+
+                       if ($filter)
                        {
-                               $filtermethod .= " $where 
fm_project.user_id=$filter ";
+                               $filtermethod .= " $where 
fm_project.user_id={$filter}";
                                $where= 'AND';
                        }
 
@@ -283,7 +384,7 @@
                                $where= 'AND';
                        }
 
-
+                       $querymethod = '';
                        if($query)
                        {
                                $query = $this->db->db_addslashes($query);
@@ -295,15 +396,53 @@
                                }
                                else
                                {
-                                       $querymethod = " $where 
(fm_project.name $this->like '%$query%' or fm_project.address $this->like 
'%$query%' or fm_project.location_code $this->like '%$query%' or fm_project.id 
=" . (int)$query .')';
+
+                                       $matchtypes = array
+                                       (
+                                               'exact' => '=',
+                                               'like'  => $this->like          
                                
+                                       );
+                                       
+                                       if(count($criteria) > 1)
+                                       {
+                                               $_querymethod = array();
+                                               foreach($criteria as 
$field_info)
+                                               {
+                                                       if($field_info['type'] 
== int)
+                                                       {
+                                                               $_query = (int) 
$query;
+                                                       }
+                                                       else
+                                                       {
+                                                               $_query = 
$query;
+                                                       }
+
+                                                       $_querymethod[] = 
"{$field_info['field']} {$matchtypes[$field_info['matchtype']]} 
{$field_info['front']}{$_query}{$field_info['back']}";
                                }
+
+                                               $querymethod = $where . ' ' . 
implode(' OR ', $_querymethod);
+                                               unset($_querymethod);
                        }
                        else
                        {
-                               $querymethod = '';
+                                               if($criteria[0]['type'] == int)
+                                               {
+                                                       $_query = (int) $query;
+                                               }
+                                               else
+                                               {
+                                                       $_query = $query;
+                                               }
+
+                                               $querymethod = "{$where} 
{$criteria[0]['field']} {$matchtypes[$criteria[0]['matchtype']]} 
{$criteria[0]['front']}{$_query}{$criteria[0]['back']}";
+                                       }
                        }
+                       }
 
+                       $querymethod .= ')';
+
                        $sql .= " $filtermethod $querymethod";
+
 //echo substr($sql,strripos($sql,'from'));
                        
if($GLOBALS['phpgw_info']['server']['db_type']=='postgres')
                        {
@@ -359,46 +498,66 @@
                function get_meter_table()
                {
                        $config = CreateObject('phpgwapi.config','property');
-                       $config->read_repository();
+                       $config->read();
                        return 
isset($config->config_data['meter_table'])?$config->config_data['meter_table']:'';
                }
 
-               function read_single($project_id)
+               function read_single($project_id, $values = array())
                {
-                       $sql = "SELECT * from fm_project where 
id='$project_id'";
+                       $project_id = (int) $project_id;
+                       $sql = "SELECT * from fm_project WHERE 
id={$project_id}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+
                        if ($this->db->next_record())
                        {
-                               $project['project_id']                  = 
$this->db->f('id');
-                               $project['title']                       = 
$this->db->f('title');
-                               $project['name']                        = 
$this->db->f('name');
-                               $project['location_code']               = 
$this->db->f('location_code');
-                               $project['key_fetch']                   = 
$this->db->f('key_fetch');
-                               $project['key_deliver']                 = 
$this->db->f('key_deliver');
-                               $project['other_branch']                = 
$this->db->f('other_branch');
-                               $project['key_responsible']             = 
$this->db->f('key_responsible');
-                               $project['descr']                       = 
stripslashes($this->db->f('descr'));
-                               $project['status']                      = 
$this->db->f('status');
-                               $project['budget']                      = 
(int)$this->db->f('budget');
-                               $project['reserve']                     = 
(int)$this->db->f('reserve');
-                               $project['tenant_id']                   = 
$this->db->f('tenant_id');
-                               $project['user_id']                     = 
$this->db->f('user_id');
-                               $project['coordinator']                 = 
$this->db->f('coordinator');
-                               $project['access']                      = 
$this->db->f('access');
-                               $project['start_date']                  = 
$this->db->f('start_date');
-                               $project['end_date']                    = 
$this->db->f('end_date');
-                               $project['cat_id']                      = 
$this->db->f('category');
-                               $project['grants']                      = 
(int)$this->grants[$this->db->f('user_id')];
-                               $project['p_num']                       = 
$this->db->f('p_num');
-                               $project['p_entity_id']                 = 
$this->db->f('p_entity_id');
-                               $project['p_cat_id']                    = 
$this->db->f('p_cat_id');
-                               $project['contact_phone']               = 
$this->db->f('contact_phone');
+                               $project = array
+                               (
+                                       'project_id'                    => 
$this->db->f('id'),
+                                       'title'                                 
=> $this->db->f('title'),
+                                       'name'                                  
=> $this->db->f('name'),
+                                       'location_code'                 => 
$this->db->f('location_code'),
+                                       'key_fetch'                             
=> $this->db->f('key_fetch'),
+                                       'key_deliver'                   => 
$this->db->f('key_deliver'),
+                                       'other_branch'                  => 
$this->db->f('other_branch'),
+                                       'key_responsible'               => 
$this->db->f('key_responsible'),
+                                       'descr'                                 
=> $this->db->f('descr', true),
+                                       'status'                                
=> $this->db->f('status'),
+                                       'budget'                                
=> (int)$this->db->f('budget'),
+                                       'planned_cost'                  => 
(int)$this->db->f('planned_cost'),
+                                       'reserve'                               
=> (int)$this->db->f('reserve'),
+                                       'tenant_id'                             
=> $this->db->f('tenant_id'),
+                                       'user_id'                               
=> $this->db->f('user_id'),
+                                       'coordinator'                   => 
$this->db->f('coordinator'),
+                                       'access'                                
=> $this->db->f('access'),
+                                       'start_date'                    => 
$this->db->f('start_date'),
+                                       'end_date'                              
=> $this->db->f('end_date'),
+                                       'cat_id'                                
=> $this->db->f('category'),
+                                       'grants'                                
=> (int)$this->grants[$this->db->f('user_id')],
+                                       'p_num'                                 
=> $this->db->f('p_num'),
+                                       'p_entity_id'                   => 
$this->db->f('p_entity_id'),
+                                       'p_cat_id'                              
=> $this->db->f('p_cat_id'),
+                                       'contact_phone'                 => 
$this->db->f('contact_phone'),
+                                       'project_group'                 => 
$this->db->f('project_group'),
+                                       'ecodimb'                               
=> $this->db->f('ecodimb'),
+                                       'b_account_id'                  => 
$this->db->f('account_id'),
+                                       'contact_id'                    => 
$this->db->f('contact_id'),
+                               );
 
-                               $project['power_meter'] = 
$this->get_power_meter($this->db->f('location_code'));
+                               if ( isset($values['attributes']) && 
is_array($values['attributes']) )
+                               {
+                                       $project['attributes'] = 
$values['attributes'];
+                                       foreach ( $project['attributes'] as 
&$attr )
+                                       {
+                                               $attr['value']  = 
$this->db->f($attr['column_name']);
                        }
+                               }
 
+
+                               $location_code = $this->db->f('location_code');
+                               $project['power_meter']         = 
$this->get_power_meter($location_code);
+                       }
 //_debug_array($project);
                                return $project;
                }
@@ -410,25 +569,26 @@
                                return false;
                        }
 
-                       $this->db2->query("SELECT ext_meter_id as power_meter 
FROM $meter_table where location_code='$location_code' and 
category='1'",__LINE__,__FILE__);
+                       $this->db->query("SELECT ext_meter_id as power_meter 
FROM $meter_table where location_code='$location_code' and 
category='1'",__LINE__,__FILE__);
 
-                       $this->db2->next_record();
+                       $this->db->next_record();
 
-                       return $this->db2->f('power_meter');
+                       return $this->db->f('power_meter');
                }
 
                function project_workorder_data($project_id = '')
                {
+                       $project_id = (int) $project_id;
                        $budget = array();
                        $this->db->query("SELECT act_mtrl_cost, 
act_vendor_cost, budget, fm_workorder.id as workorder_id, vendor_id, 
calculation,rig_addition,addition,deviation,charge_tenant,fm_workorder_status.descr
 as status"
-                       ." FROM fm_workorder $this->join fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id WHERE project_id='$project_id'");
+                       ." FROM fm_workorder $this->join fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id WHERE project_id={$project_id}");
                        while ($this->db->next_record())
                        {
                                $budget[] = array(
                                        'workorder_id'          => 
$this->db->f('workorder_id'),
-                                       'budget'                        => 
$this->db->f('budget'),
+                                       'budget'                        => 
(int)$this->db->f('budget'),
                                        'deviation'                     => 
$this->db->f('deviation'),
-                                       'calculation'           => 
($this->db->f('calculation')*(1+$this->db->f('addition')/100))+$this->db->f('rig_addition'),
+                                       'calculation'           => 
$this->db->f('calculation'),
                                        'vendor_id'                     => 
$this->db->f('vendor_id'),
                                        'act_mtrl_cost'         => 
$this->db->f('act_mtrl_cost'),
                                        'act_vendor_cost'       => 
$this->db->f('act_vendor_cost'),
@@ -442,10 +602,10 @@
                function branch_p_list($project_id = '')
                {
                        $selected = array();
-                       $this->db2->query("SELECT branch_id from 
fm_projectbranch WHERE project_id=" .  (int)$project_id ,__LINE__,__FILE__);
-                       while ($this->db2->next_record())
+                       $this->db->query("SELECT branch_id from 
fm_projectbranch WHERE project_id=" .  (int)$project_id ,__LINE__,__FILE__);
+                       while ($this->db->next_record())
                        {
-                               $selected[] = array('branch_id' => 
$this->db2->f('branch_id'));
+                               $selected[] = array('branch_id' => 
$this->db->f('branch_id'));
                        }
                        return $selected;
                }
@@ -463,8 +623,9 @@
                        return $project_id;
                }
 
-               function add($project)
+               function add($project, $values_attribute = array())
                {
+                       $receipt = array();
                        $historylog     = 
CreateObject('property.historylog','project');
 
                        while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
@@ -485,6 +646,19 @@
                                }
                        }
 
+                       $data_attribute = 
$this->custom->prepare_for_db('fm_project', $values_attribute);
+                       if(isset($data_attribute['value_set']))
+                       {
+                               foreach($data_attribute['value_set'] as 
$input_name => $value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $cols[] = $input_name;
+                                               $vals[] = $value;
+                                       }
+                               }
+                       }
+
                        if($cols)
                        {
                                $cols   = "," . implode(",", $cols);
@@ -506,8 +680,12 @@
                        $project['descr'] = 
$this->db->db_addslashes($project['descr']);
                        $project['name'] = 
$this->db->db_addslashes($project['name']);
 
-                       $values= array(
-                               $project['project_id'],
+                       $this->db->transaction_begin();
+                       $id = $this->next_project_id();
+                       $values= array
+                       (
+                               $id,
+                               $project['project_group'],
                                $project['name'],
                                'public',
                                $project['cat_id'],
@@ -517,22 +695,24 @@
                                $project['coordinator'],
                                $project['status'],
                                $project['descr'],
-                               $project['budget'],
-                               $project['reserve'],
+                               (int) $project['budget'],
+                               (int) $project['reserve'],
                                $project['location_code'],
                                $address,
                                $project['key_deliver'],
                                $project['key_fetch'],
                                $project['other_branch'],
                                $project['key_responsible'],
-                               $this->account);
+                               $this->account,
+                               $project['ecodimb'],
+                               $project['b_account_id'],
+                               $project['contact_id']
+                       );
 
                        $values = $this->bocommon->validate_db_insert($values);
 
-                       $this->db->transaction_begin();
-
-                       $this->db->query("INSERT INTO fm_project 
(id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
-                               . 
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id
 $cols) "
+                       $this->db->query("INSERT INTO fm_project 
(id,project_group,name,access,category,entry_date,start_date,end_date,coordinator,status,"
+                               . 
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_id,contact_id
 $cols) "
                                . "VALUES ($values $vals )",__LINE__,__FILE__);
 
                        if($project['extra']['contact_phone'] && 
$project['extra']['tenant_id'])
@@ -549,7 +729,7 @@
                        {
                                while($branch=each($project['branch']))
                                {
-                                       $this->db->query("insert into 
fm_projectbranch (project_id,branch_id) values ('" . $project['project_id']. 
"','$branch[1]')",__LINE__,__FILE__);
+                                       $this->db->query("insert into 
fm_projectbranch (project_id,branch_id) values 
({$id},{$branch[1]})",__LINE__,__FILE__);
                                }
                        }
 
@@ -562,7 +742,7 @@
                                                'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$project['origin'][0]['location']),
                                                'location1_item_id' => 
$project['origin'][0]['data'][0]['id'],
                                                'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project'),                   
     
-                                               'location2_item_id' => 
$project['project_id'],
+                                               'location2_item_id' => $id,
                                                'account_id'            => 
$this->account
                                        );
                                        
@@ -573,20 +753,22 @@
                        if($this->db->transaction_commit())
                        {
                                $this->increment_project_id();
-                               
$historylog->add('SO',$project['project_id'],$project['status']);
-                               
$historylog->add('TO',$project['project_id'],$project['cat_id']);
-                               
$historylog->add('CO',$project['project_id'],$project['coordinator']);
+                               $historylog->add('SO', $id, $project['status']);
+                               $historylog->add('TO', $id, $project['cat_id']);
+                               $historylog->add('CO', $id, 
$project['coordinator']);
                                if ($project['remark'])
                                {
-                                       
$historylog->add('RM',$project['project_id'],$project['remark']);
+                                       $historylog->add('RM', $id, 
$project['remark']);
                                }
 
-                               $receipt['message'][] = 
array('msg'=>lang('project %1 has been saved',$project['project_id']));
+                               $receipt['message'][] = 
array('msg'=>lang('project %1 has been saved',$id));
                        }
                        else
                        {
                                $receipt['error'][] = array('msg'=>lang('the 
project has not been saved'));
                        }
+                       
+                       $receipt['id'] = $id;
                        return $receipt;
                }
 
@@ -657,25 +839,11 @@
                        return $meter_id;
                }
 
-               function edit($project)
+               function edit($project, $values_attribute = array())
                {
                        $historylog     = 
CreateObject('property.historylog','project');
+                       $receipt = array();
 
-                       while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
-                       {
-                               $vals[] = "$input_name = '$value'";
-                       }
-
-                       while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
-                       {
-                               $vals[] = "$input_name = '$value'";
-                       }
-
-                       if($vals)
-                       {
-                               $vals   = "," . implode(",",$vals);
-                       }
-
                        if($project['street_name'])
                        {
                                $address[]= $project['street_name'];
@@ -692,6 +860,7 @@
                        $project['name'] = 
$this->db->db_addslashes($project['name']);
 
                        $value_set=array(
+                               'project_group'         => 
$project['project_group'],
                                'name'                  => $project['name'],
                                'status'                => $project['status'],
                                'category'              => $project['cat_id'],
@@ -706,24 +875,46 @@
                                'other_branch'          => 
$project['other_branch'],
                                'key_responsible'       => 
$project['key_responsible'],
                                'location_code'         => 
$project['location_code'],
-                               'address'               => $address
+                               'address'                       => $address,
+                               'ecodimb'                       => 
$project['ecodimb'],
+                               'account_id'            => 
$project['b_account_id'],
+                               'contact_id'            => 
$project['contact_id']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $data_attribute = 
$this->custom->prepare_for_db('fm_project', $values_attribute, $data['id']);
 
+                       if(isset($data_attribute['value_set']))
+                       {
+                               $value_set = array_merge($value_set, 
$data_attribute['value_set']);
+                       }
+
+                       while (is_array($project['location']) && 
list($input_name,$value) = each($project['location']))
+                       {
+                               $value_set[$input_name] = $value;
+                       }
+
+                       while (is_array($project['extra']) && 
list($input_name,$value) = each($project['extra']))
+                       {
+                               $value_set[$input_name] = $value;
+                       }
+
+                       $value_set      = 
$this->db->validate_update($value_set);
+
                        $this->db->transaction_begin();
 
-                       $this->db->query("SELECT status,category,coordinator 
FROM fm_project where id='" .$project['project_id']."'",__LINE__,__FILE__);
+                       $this->db->query("SELECT 
status,category,coordinator,budget,reserve FROM fm_project WHERE id = 
{$project['id']}",__LINE__,__FILE__);
                        $this->db->next_record();
                        $old_status = $this->db->f('status');
                        $old_category = (int)$this->db->f('category');
                        $old_coordinator = (int)$this->db->f('coordinator');
+                       $old_budget = (int)$this->db->f('budget');
+                       $old_reserve = (int)$this->db->f('reserve');
 
-                       $this->db->query("UPDATE fm_project set $value_set 
$vals WHERE id= '" . $project['project_id'] ."'",__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_project SET $value_set 
WHERE id= {$project['id']}",__LINE__,__FILE__);
 
                        if($project['extra']['contact_phone'] && 
$project['extra']['tenant_id'])
                        {
-                               $this->db->query("update fm_tenant set 
contact_phone='". $project['extra']['contact_phone']. "' where id='". 
$project['extra']['tenant_id']. "'",__LINE__,__FILE__);
+                               $this->db->query("UPDATE fm_tenant SET 
contact_phone='". $project['extra']['contact_phone']. "' WHERE id='". 
$project['extra']['tenant_id']. "'",__LINE__,__FILE__);
                        }
 
                        if (isset($project['power_meter']) && 
$project['power_meter'])
@@ -731,92 +922,156 @@
                                
$this->update_power_meter($project['power_meter'],$project['location_code'],$address);
                        }
        // -----------------which branch is represented
-                       $this->db->query("delete from fm_projectbranch where 
project_id='" . $project['project_id'] ."'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_projectbranch WHERE 
project_id={$project['id']}",__LINE__,__FILE__);
 
                        if (count($project['branch']) != 0)
                        {
                                while($branch=each($project['branch']))
                                {
-                                       $this->db->query("insert into 
fm_projectbranch (project_id,branch_id) values ('" . $project['project_id']. 
"','$branch[1]')",__LINE__,__FILE__);
+                                       $this->db->query("INSERT INTO 
fm_projectbranch (project_id,branch_id) VALUES ({$project['id']}, 
{$branch[1]})",__LINE__,__FILE__);
                                }
                        }
 
                        if($project['delete_request'])
                        {
-                               $receipt = 
$this->delete_request_from_project($project['delete_request'],$project['project_id']);
+                               $receipt = 
$this->delete_request_from_project($project['delete_request'],$project['id']);
 
                        }
 
-                       
$this->update_request_status($project['project_id'],$project['status'],$project['cat_id'],$project['coordinator']);
+                       
$this->update_request_status($project['id'],$project['status'],$project['cat_id'],$project['coordinator']);
 
                        if (($old_status != $project['status']) || 
$project['confirm_status'])
                        {
-                               $this->db->query("SELECT id from fm_workorder 
WHERE project_id=" .  (int)$project['project_id'] ,__LINE__,__FILE__);
+                               $close_pending_action = false;
+                               $close_workorders = false;
+                               $this->db->query("SELECT * FROM 
fm_project_status WHERE id = '{$project['status']}'");
+                               $this->db->next_record();
+                               if ($this->db->f('closed') )
+                               {
+                                       $close_workorders = true;
+                               }
+
+
+                               if ($this->db->f('approved') )
+                               {
+                                       $close_pending_action = true;
+
+                                       $action_params = array
+                                       (
+                                               'appname'                       
=> 'property',
+                                               'location'                      
=> '.project',
+                                               'id'                            
=> (int)$project['id'],
+                                               'responsible'           => 
$this->account,
+                                               'responsible_type'  => 'user',
+                                               'action'                        
=> 'approval',
+                                               'remark'                        
=> '',
+                                               'deadline'                      
=> ''
+                                       );
+
+                                       
execMethod('property.sopending_action.close_pending_action', $action_params);
+                                       unset($action_params);
+                               }
+ 
+                               $this->db->query("SELECT id from fm_workorder 
WHERE project_id=" .  (int)$project['id'] ,__LINE__,__FILE__);
+                               $workorder = array();
                                while ($this->db->next_record())
                                {
                                        $workorder[] = $this->db->f('id');
                                }
 
-                               if (isset($workorder) AND is_array($workorder))
+                               if ($workorder)
                                {
                                        $historylog_workorder   = 
CreateObject('property.historylog','workorder');
                                }
 
-                               if($old_status != $project['status'])
+                               if($old_status != $project['status'] && 
$close_workorders)
                                {
-                                       
$historylog->add('S',$project['project_id'],$project['status']);
+                                       
$historylog->add('S',$project['id'],$project['status'], $old_status);
 
-                                       $this->db->query("UPDATE fm_workorder 
set status='". $project['status'] . "' WHERE project_id= '" . 
$project['project_id'] ."'",__LINE__,__FILE__);
+                                       $this->db->query("UPDATE fm_workorder 
SET status='closed' WHERE project_id = {$project['id']}",__LINE__,__FILE__);
 
                                        if (isset($workorder) AND 
is_array($workorder))
                                        {
                                                foreach($workorder as 
$workorder_id)
                                                {
-                                                       
$historylog_workorder->add('S',$workorder_id,$project['status']);
+                                                       
$historylog_workorder->add('S',$workorder_id,'closed');
                                                }
                                        }
                                        $receipt['notice_owner'][]=lang('Status 
changed') . ': ' . $project['status'];
                                }
                                elseif($project['confirm_status'])
                                {
-                                       
$historylog->add('SC',$project['project_id'],$project['status']);
+                                       
$historylog->add('SC',$project['id'],$project['status']);
 
-                                       if (isset($workorder) AND 
is_array($workorder))
+                                       if (isset($workorder) && 
is_array($workorder)  && $close_workorders)
                                        {
                                                foreach($workorder as 
$workorder_id)
                                                {
-                                                       
$historylog_workorder->add('SC',$workorder_id,$project['status']);
+                                                       
$historylog_workorder->add('SC',$workorder_id,'closed');
                                                }
                                        }
                                        $receipt['notice_owner'][]=lang('Status 
confirmed') . ': ' . $project['status'];
                                }
 
+                               if($close_pending_action)
+                               {
+                                       $action_params = array
+                                       (
+                                               'appname'                       
=> 'property',
+                                               'location'                      
=> '.project.workorder',
+                                               'id'                            
=> 0,
+                                               'responsible'           => 
$this->account,
+                                               'responsible_type'  => 'user',
+                                               'action'                        
=> 'approval',
+                                               'remark'                        
=> '',
+                                               'deadline'                      
=> ''
+                                       );
+
+
+                                       foreach($workorder as $workorder_id)
+                                       {
+                                               $action_params['id'] =  
$workorder_id;
+                                               
execMethod('property.sopending_action.close_pending_action', $action_params);
+                                       }
+                                       unset($action_params);
+                               }
                        }
 
                        if ($old_category != $project['cat_id'])
                        {
-                               
$historylog->add('T',$project['project_id'],$project['cat_id']);
+                               
$historylog->add('T',$project['id'],$project['cat_id'], $old_category);
                        }
                        if ($old_coordinator != $project['coordinator'])
                        {
-                               
$historylog->add('C',$project['project_id'],$project['coordinator']);
+                               
$historylog->add('C',$project['id'],$project['coordinator'], $old_coordinator);
                                $receipt['notice_owner'][]=lang('Coordinator 
changed') . ': ' . 
$GLOBALS['phpgw']->accounts->id2name($project['coordinator']);
                        }
 
+                       if ($old_budget != (int)$project['budget'])
+                       {
+                               
$historylog->add('B',$project['id'],$project['budget'], $old_budget);
+                       }
+
+                       if ($old_reserve != (int)$project['reserve'])
+                       {
+                               
$historylog->add('BR',$project['id'],$project['reserve'], $old_reserve);
+                       }
+
                        if ($project['remark'])
                        {
-                               
$historylog->add('RM',$project['project_id'],$project['remark']);
+                               
$historylog->add('RM',$project['id'],$project['remark']);
                        }
 
-                       $receipt['message'][] = array('msg'=>lang('project %1 
has been edited',$project['project_id']));
+                       execMethod('property.soworkorder.update_planned_cost', 
$project['id']);
+                       
+                       $receipt['id'] = $project['id'];
+                       $receipt['message'][] = array('msg'=>lang('project %1 
has been edited', $project['id']));
 
                        $this->db->transaction_commit();
 
                        return $receipt;
-
                }
 
-
                function delete_request_from_project($request,$project_id)
                {
                        foreach ($request as $request_id)
@@ -866,7 +1121,7 @@
 
                function check_request($request_id)
                {
-                       $target = 
$this->interlink->get_specific_targets('property', '.project.request', 
'.project', $request_id);
+                       $target = 
$this->interlink->get_specific_relation('property', '.project.request', 
'.project', $request_id);
 
                        if ( $target)
                        {
@@ -909,7 +1164,7 @@
 
                function delete($project_id )
                {
-                       $request = 
$this->interlink->get_specific_targets('property', '.project.request', 
'.project', $project_id);
+                       $request = 
$this->interlink->get_specific_relation('property', '.project.request', 
'.project', $project_id);
 
                        $sql = "SELECT id as workorder_id FROM fm_workorder 
WHERE project_id='$project_id'";
                        $this->db->query($sql,__LINE__,__FILE__);

Modified: people/sigurdne/modules/property/trunk/inc/class.sor_agreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sor_agreement.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sor_agreement.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -36,17 +36,15 @@
        {
                var $role;
 
-               function property_sor_agreement()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->db2          = clone($this->db);
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->join                     = $this->db->join;
+                       $this->left_join        = $this->db->left_join;
+                       $this->like                     = $this->db->like;
                }
 
                function select_vendor_list()
@@ -679,7 +677,7 @@
 
 
                        $this->db->transaction_begin();
-                       $id = $this->bocommon->next_id('fm_r_agreement');
+                       $id = $this->db->next_id('fm_r_agreement');
 
                        $vals[] = $id;
                        $vals[] = $r_agreement['name'];
@@ -724,7 +722,7 @@
                                $cols   = "," . implode(",", $cols);
                        }
 
-                       $vals   = $this->bocommon->validate_db_insert($vals);
+                       $vals   = $this->db->validate_insert($vals);
 
                        $this->db->query("INSERT INTO $table 
(id,name,descr,entry_date,category,member_of,start_date,end_date,termination_date,customer_id,customer_name,account_id,user_id
 $cols) "
                                . "VALUES ($vals)",__LINE__,__FILE__);
@@ -802,11 +800,11 @@
                        if($cols)
                        {
                                $cols   = "," . implode(",", $cols);
-                               $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
+                               $vals   = "," . 
$this->db->validate_insert($vals);
                        }
 
                        $this->db->transaction_begin();
-                       $id = 
$this->bocommon->next_id($table,array('agreement_id'=>$values['r_agreement_id']));
+                       $id = 
$this->db->next_id($table,array('agreement_id'=>$values['r_agreement_id']));
 
                        $this->db->query("INSERT INTO $table 
(id,agreement_id,entry_date,user_id $cols) "
                                . "VALUES ($id," . $values['r_agreement_id'] 
."," . time()
@@ -893,7 +891,7 @@
                        $value_set['customer_name']= $values['customer_name'];
                        if($value_set)
                        {
-                               $value_set      = ',' . 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = ',' . 
$this->db->validate_update($value_set);
                        }
 
                        $this->db->query("UPDATE $table set entry_date='" . 
time() . "', category='"
@@ -955,7 +953,7 @@
 
                        if($value_set)
                        {
-                               $value_set      = ',' . 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = ',' . 
$this->db->validate_update($value_set);
                        }
 
                        $this->db->query("UPDATE $table set entry_date=" . 
time() . "$value_set WHERE agreement_id=" . intval($values['r_agreement_id']) . 
' AND id=' . intval($values['id']));
@@ -1091,10 +1089,10 @@
                        $vals[] = $this->db->db_addslashes($values['remark']);
 
                        $cols   = "," . implode(",", $cols);
-                       $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
+                       $vals   = "," . $this->db->validate_insert($vals);
 
                        $this->db->transaction_begin();
-                       $c_id = 
$this->bocommon->next_id($table,array('agreement_id'=>$values['r_agreement_id']));
+                       $c_id = 
$this->db->next_id($table,array('agreement_id'=>$values['r_agreement_id']));
 
                        $this->db->query("INSERT INTO $table 
(id,agreement_id,entry_date,user_id $cols) "
                                . "VALUES ($c_id," . $values['r_agreement_id'] 
."," . time()
@@ -1143,7 +1141,7 @@
                        $table = 'fm_r_agreement_c_history';
 
                        $this->db->transaction_begin();
-                       $id = 
$this->bocommon->next_id($table,array('agreement_id'=>$values['r_agreement_id'],'c_id'
 =>$values['c_id']));
+                       $id = 
$this->db->next_id($table,array('agreement_id'=>$values['r_agreement_id'],'c_id'
 =>$values['c_id']));
 
                        $this->db->query("SELECT from_date, to_date FROM $table 
WHERE agreement_id=" . $values['r_agreement_id'] . " AND c_id=" . 
$values['c_id'] . " AND id =" .($id-1),__LINE__,__FILE__);
                        $this->db->next_record();

Modified: people/sigurdne/modules/property/trunk/inc/class.sorequest.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sorequest.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sorequest.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -36,15 +36,13 @@
        {
                function property_sorequest()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->soproject        = 
CreateObject('property.soproject');
                        $this->historylog       = 
CreateObject('property.historylog','request');
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                        $this->interlink        = 
CreateObject('property.interlink');
                }
 
@@ -177,9 +175,9 @@
                                $cat_id                 = 
isset($data['cat_id'])?$data['cat_id']:0;
                                $status_id              = 
isset($data['status_id']) && $data['status_id'] ? $data['status_id']:0;
                                $project_id             = 
isset($data['project_id'])?$data['project_id']:'';
-                               $project_id             = 
isset($data['project_id'])?$data['project_id']:'';
                                $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
                                $list_descr             = 
isset($data['list_descr'])?$data['list_descr']:'';
+                               $dry_run                = 
isset($data['dry_run']) ? $data['dry_run'] : '';
                        }
 
                        $entity_table = 'fm_request';
@@ -256,7 +254,7 @@
                        $where = 'WHERE';
                        $filtermethod = '';
 
-                       $GLOBALS['phpgw']->config->read_repository();
+                       $GLOBALS['phpgw']->config->read();
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
                        {
                                $access_location = 
$this->bocommon->get_location_list(PHPGW_ACL_READ);
@@ -301,9 +299,19 @@
                        $type_id                = $this->bocommon->type_id;
                        $this->cols_extra       = $this->bocommon->cols_extra;
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->fetchmode = 'ASSOC';
+                       $sql2 = 'SELECT count(*) as cnt ' . 
substr($sql,strripos($sql,'from'));
+                       $this->db->query($sql2,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $this->total_records = $this->db->f('cnt');
 
+                       //address@hidden 23/10/08 avoid retrieve data in first 
time, only render definition for headers (var myColumnDefs)
+                       if($dry_run)
+                       {
+                               return array();
+                       }
+                       else
+                       {
                        if(!$allrows)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -312,13 +320,15 @@
                        {
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
+                       }
 
                        $j=0;
+                       $request_list = array();
                        while ($this->db->next_record())
                        {
                                for ($i=0;$i<count($cols_return);$i++)
                                {
-                                       $request_list[$j][$cols_return[$i]] = 
stripslashes($this->db->f($cols_return[$i]));
+                                       $request_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i], true);
                                }
 
                                $location_code= $this->db->f('location_code');
@@ -337,34 +347,40 @@
 
                function read_single($request_id)
                {
-                       $sql = "SELECT * from fm_request where 
id='$request_id'";
+                       $request_id = (int) $request_id;
+                       $sql = "SELECT * FROM fm_request WHERE 
id={$request_id}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $request = array();
                        if ($this->db->next_record())
                        {
-                               $request['request_id']                  = 
$this->db->f('id');
-                               $request['title']                       = 
$this->db->f('title');
-                               $request['location_code']               = 
$this->db->f('location_code');
-                               $request['descr']                       = 
$this->db->f('descr');
-                               $request['status']                      = 
$this->db->f('status');
-                               $request['budget']                      = 
(int)$this->db->f('budget');
-                               $request['tenant_id']                   = 
$this->db->f('tenant_id');
-                               $request['owner']                       = 
$this->db->f('owner');
-                               $request['coordinator']                 = 
$this->db->f('coordinator');
-                               $request['access']                      = 
$this->db->f('access');
-                               $request['start_date']                  = 
$this->db->f('start_date');
-                               $request['end_date']                    = 
$this->db->f('end_date');
-                               $request['cat_id']                      = 
$this->db->f('category');
-                               $request['branch_id']                   = 
$this->db->f('branch_id');
-                               $request['authorities_demands']         = 
$this->db->f('authorities_demands');
-                               $request['score']                       = 
$this->db->f('score');
-                               $request['p_num']                       = 
$this->db->f('p_num');
-                               $request['p_entity_id']                 = 
$this->db->f('p_entity_id');
-                               $request['p_cat_id']                    = 
$this->db->f('p_cat_id');
-                               $request['contact_phone']               = 
$this->db->f('contact_phone');
-
-                               $request['power_meter'] = 
$this->soproject->get_power_meter($this->db->f('location_code'));
+                               $request = array
+                               (
+                                       'id'                                    
=> $this->db->f('id'),
+                                       'request_id'                    => 
$this->db->f('id'), // FIXME
+                                       'title'                                 
=> $this->db->f('title', true),
+                                       'location_code'                 => 
$this->db->f('location_code'),
+                                       'descr'                                 
=> $this->db->f('descr', true),
+                                       'status'                                
=> $this->db->f('status'),
+                                       'budget'                                
=> (int)$this->db->f('budget'),
+                                       'tenant_id'                             
=> $this->db->f('tenant_id'),
+                                       'owner'                                 
=> $this->db->f('owner'),
+                                       'coordinator'                   => 
$this->db->f('coordinator'),
+                                       'access'                                
=> $this->db->f('access'),
+                                       'start_date'                    => 
$this->db->f('start_date'),
+                                       'end_date'                              
=> $this->db->f('end_date'),
+                                       'cat_id'                                
=> $this->db->f('category'),
+                                       'branch_id'                             
=> $this->db->f('branch_id'),
+                                       'authorities_demands'   => 
$this->db->f('authorities_demands'),
+                                       'score'                                 
=> $this->db->f('score'),
+                                       'p_num'                                 
=> $this->db->f('p_num'),
+                                       'p_entity_id'                   => 
$this->db->f('p_entity_id'),
+                                       'p_cat_id'                              
=> $this->db->f('p_cat_id'),
+                                       'contact_phone'                 => 
$this->db->f('contact_phone', true)
+                               );
+                               $location_code = $this->db->f('location_code');
+                               $request['power_meter']         = 
$this->soproject->get_power_meter($location_code);
                        }
 
                        return $request;
@@ -372,6 +388,7 @@
 
                function request_workorder_data($request_id = '')
                {
+                       $request_id = (int)$request_id;
                        $this->db->query("select budget, id as workorder_id, 
vendor_id from fm_workorder where request_id='$request_id'");
                        while ($this->db->next_record())
                        {
@@ -401,6 +418,7 @@
                function add($request)
                {
 //_debug_array($request);
+                       $receipt = array();
                        while (is_array($request['location']) && 
list($input_name,$value) = each($request['location']))
                        {
                                if($value)
@@ -441,8 +459,10 @@
                        $request['name'] = 
$this->db->db_addslashes($request['name']);
                        $request['title'] = 
$this->db->db_addslashes($request['title']);
 
+                       $this->db->transaction_begin();
+                       $id = $this->next_id();
                        $values= array(
-                               $request['request_id'],
+                               $id,
                                $request['title'],
                                $this->account,
                                $request['cat_id'],
@@ -458,8 +478,6 @@
 
                        $values = $this->bocommon->validate_db_insert($values);
 
-                       $this->db->transaction_begin();
-
                        $this->db->query("insert into fm_request 
(id,title,owner,category,descr,location_code,"
                                . 
"address,entry_date,budget,status,branch_id,coordinator,"
                                . "authorities_demands  $cols) "
@@ -469,7 +487,7 @@
                        {
                                $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
                                        . "VALUES ('"
-                                       . $request['request_id']. "','"
+                                       . $id. "','"
                                        . $condition_type . "',"
                                        . $value_type['degree']. ","
                                        . $value_type['probability']. ","
@@ -478,7 +496,7 @@
                                        . time() . ")",__LINE__,__FILE__);
                        }
 
-                       $this->update_score($request['request_id']);
+                       $this->update_score($id);
 
 
                        if($request['extra']['contact_phone'] && 
$request['extra']['tenant_id'])
@@ -498,7 +516,7 @@
                                        'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$request['origin'][0]['location']),
                                        'location1_item_id' => 
$request['origin'][0]['data'][0]['id'],
                                        'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request'),           
             
-                                       'location2_item_id' => 
$request['request_id'],
+                                       'location2_item_id' => $id,
                                        'account_id'            => 
$this->account
                                );
                                        
@@ -508,35 +526,23 @@
                        if($this->db->transaction_commit())
                        {
                                $this->increment_request_id();
-                               
$this->historylog->add('SO',$request['request_id'],$request['status']);
-                               
$this->historylog->add('TO',$request['request_id'],$request['cat_id']);
-                               
$this->historylog->add('CO',$request['request_id'],$request['coordinator']);
-                               $receipt['message'][] = 
array('msg'=>lang('request %1 has been saved',$request['request_id']));
+                               
$this->historylog->add('SO',$id,$request['status']);
+                               
$this->historylog->add('TO',$id,$request['cat_id']);
+                               
$this->historylog->add('CO',$id,$request['coordinator']);
+                               $receipt['message'][] = 
array('msg'=>lang('request %1 has been saved',$id));
                        }
                        else
                        {
-                               $receipt['error'][] = 
array('msg'=>lang('request %1 has not been saved',$request['request_id']));
+                               $receipt['error'][] = 
array('msg'=>lang('request %1 has not been saved',$id));
                        }
+                       $receipt['id'] = $id;
                        return $receipt;
                }
 
                function edit($request)
                {
-                       while (is_array($request['location']) && 
list($input_name,$value) = each($request['location']))
-                       {
-                               $vals[] = "$input_name = '$value'";
-                       }
+                       $receipt = array();
 
-                       while (is_array($request['extra']) && 
list($input_name,$value) = each($request['extra']))
-                       {
-                               $vals[] = "$input_name = '$value'";
-                       }
-
-                       if($vals)
-                       {
-                               $vals   = "," . implode(",",$vals);
-                       }
-
                        if($request['street_name'])
                        {
                                $address[]= $request['street_name'];
@@ -549,11 +555,9 @@
                                $address = 
$this->db->db_addslashes($request['location_name']);
                        }
 
-
                        $request['descr'] = 
$this->db->db_addslashes($request['descr']);
                        $request['name'] = 
$this->db->db_addslashes($request['name']);
                        $request['title'] = 
$this->db->db_addslashes($request['title']);
-//_debug_array($request);
 
                        $value_set=array(
                                'status'                => $request['status'],
@@ -568,25 +572,35 @@
                                'authorities_demands' => 
$request['authorities_demands']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       while (is_array($request['location']) && 
list($input_name,$value) = each($request['location']))
+                       {
+                               $value_set[$input_name] = $value;
+                       }
 
+                       while (is_array($request['extra']) && 
list($input_name,$value) = each($request['extra']))
+                       {
+                               $value_set[$input_name] = $value;
+                       }
+
+                       $value_set      = 
$this->db->validate_update($value_set);
+
                        $this->db->transaction_begin();
 
-                       $this->db->query("SELECT status,category,coordinator 
FROM fm_request where id='" .$request['request_id']."'",__LINE__,__FILE__);
+                       $this->db->query("SELECT status,category,coordinator 
FROM fm_request where id='" .$request['id']."'",__LINE__,__FILE__);
                        $this->db->next_record();
 
                        $old_status = $this->db->f('status');
                        $old_category = $this->db->f('category');
                        $old_coordinator = $this->db->f('coordinator');
 
-                       $this->db->query("UPDATE fm_request set $value_set 
$vals WHERE id= '" . $request['request_id'] ."'",__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_request set $value_set 
WHERE id= '" . $request['id'] ."'",__LINE__,__FILE__);
 
-                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id='" . $request['request_id'] . "'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id='" . $request['id'] . "'",__LINE__,__FILE__);
                        while (is_array($request['condition']) && 
list($condition_type,$value_type) = each($request['condition']))
                        {
                                $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
                                        . "VALUES ('"
-                                       . $request['request_id']. "','"
+                                       . $request['id']. "','"
                                        . $condition_type . "',"
                                        . $value_type['degree']. ","
                                        . $value_type['probability']. ","
@@ -595,7 +609,7 @@
                                        . time() . ")",__LINE__,__FILE__);
                        }
 
-                       $this->update_score($request['request_id']);
+                       $this->update_score($request['id']);
 
                        if($request['extra']['contact_phone'] && 
$request['extra']['tenant_id'])
                        {
@@ -611,25 +625,26 @@
                        {
                                if ($old_status != $request['status'])
                                {
-                                       
$this->historylog->add('S',$request['request_id'],$request['status']);
+                                       
$this->historylog->add('S',$request['id'],$request['status']);
                                }
                                if ($old_category != $request['cat_id'])
                                {
-                                       
$this->historylog->add('T',$request['request_id'],$request['cat_id']);
+                                       
$this->historylog->add('T',$request['id'],$request['cat_id']);
                                }
                                if ($old_coordinator != $request['coordinator'])
                                {
-                                       
$this->historylog->add('C',$request['request_id'],$request['coordinator']);
+                                       
$this->historylog->add('C',$request['id'],$request['coordinator']);
                                }
 
-                               $receipt['message'][] = 
array('msg'=>lang('request %1 has been edited',$request['request_id']));
+                               $receipt['message'][] = 
array('msg'=>lang('request %1 has been edited',$request['id']));
                        }
                        else
                        {
-                               $receipt['message'][] = 
array('msg'=>lang('request %1 has not been edited',$request['request_id']));
+                               $receipt['message'][] = 
array('msg'=>lang('request %1 has not been edited',$request['id']));
                        }
+
+                       $receipt['id'] = $request['id'];
                        return $receipt;
-
                }
 
                function delete($request_id )

Modified: people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soresponsible.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -9,13 +9,13 @@
        * @package phpgroupware
        * @subpackage property
        * @category core
-       * @version $Id: class.uiresponsible.inc.php 732 2008-02-10 16:21:14Z 
sigurd $
+       * @version $Id: class.soresponsible.inc.php 3386 2009-08-20 13:29:37Z 
sigurd $
        */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -41,6 +41,7 @@
                var $db;
                var $account;
                var $acl_location;
+               var $appname = 'property';
 
                /**
                * @var the total number of records for a search
@@ -86,7 +87,7 @@
 
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
+                               $ordermethod = " order by 
fm_responsibility.$order $sort";
                        }
                        else
                        {
@@ -96,18 +97,26 @@
                        $where= 'WHERE';
                        $filtermethod = '';
 
+/*
                        if(is_array($filter) && $location)
                        {
                                $filtermethod .= " $where cat_id IN (" . 
implode(',', $filter) . ')';
                                $where = 'AND';
                        }
+*/
+                       if($location)
+                       {
+                               $filtermethod .= " $where 
fm_responsibility.location_id =" . 
$GLOBALS['phpgw']->locations->get_id($this->appname, $location);
+                               $where = 'AND';
+                       }
+
                        $querymethod = '';
                        if($query)
                        {
-                               $querymethod = "$where (name $this->like 
'%$query%' OR descr $this->like '%$query%')";
+                               $querymethod = "$where (fm_responsibility.name 
$this->like '%$query%' OR fm_responsibility.descr $this->like '%$query%')";
                        }
 
-                       $sql = "SELECT * FROM fm_responsibility $filtermethod 
$querymethod";
+                       $sql = "SELECT fm_responsibility.*, 
phpgw_locations.name as location FROM fm_responsibility $this->join 
phpgw_locations ON fm_responsibility.location_id = phpgw_locations.location_id 
$filtermethod $querymethod";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->total_records = $this->db->num_rows();
@@ -131,6 +140,7 @@
                                        'name'                  => 
$this->db->f('name', true),
                                        'descr'                 => 
$this->db->f('descr', true),
                                        'active'                => 
$this->db->f('active'),
+                                       'location'              => 
$this->db->f('location'),
                                        'cat_id'                => 
$this->db->f('cat_id'),
                                        'created_by'    => 
$this->db->f('created_by'),
                                        'created_on'    => 
$this->db->f('created_on'),
@@ -158,6 +168,7 @@
                        (
                                $values['name'],
                                $values['descr'],
+                               
$GLOBALS['phpgw']->locations->get_id($this->appname, $values['location']),
                                (int) $values['cat_id'],
                                isset($values['active']) ? !!$values['active'] 
: '',
                                $this->account,
@@ -168,7 +179,7 @@
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("INSERT INTO fm_responsibility (name, 
descr, cat_id, active, created_by, created_on) "
+                       $this->db->query("INSERT INTO fm_responsibility (name, 
descr,location_id, cat_id, active, created_by, created_on) "
                                . "VALUES ($insert_values)", __LINE__, 
__FILE__);
 
                        if($this->db->transaction_commit())
@@ -342,6 +353,7 @@
                                        'p_num'                         => 
$this->db->f('p_num', true),
                                        'p_entity_id'           => 
$this->db->f('p_entity_id'),
                                        'p_cat_id'                      => 
$this->db->f('p_cat_id'),
+                                       'ecodimb'                       => 
$this->db->f('ecodimb'),
                                        'remark'                        => 
$this->db->f('remark', true),
                                );
                        }
@@ -367,12 +379,13 @@
                        (
                                (int) $values['responsibility_id'],
                                (int) $values['contact_id'],
-                               implode('-', $values['location']),
+                               @implode('-', $values['location']),
                                $values['active_from'],
                                $values['active_to'],
                                isset($values['extra']['p_num']) ? 
$values['extra']['p_num'] : '',
                                isset($values['extra']['p_entity_id']) ? 
$values['extra']['p_entity_id'] : '',
                                isset($values['extra']['p_cat_id']) ? 
$values['extra']['p_cat_id'] : '',
+                               $values['ecodimb'],
                                $values['remark'],
                                $this->account,
                                time()
@@ -383,7 +396,7 @@
                        $this->db->transaction_begin();
 
                        $this->db->query("INSERT INTO fm_responsibility_contact 
(responsibility_id, contact_id,"
-                               ." location_code, active_from, active_to, 
p_num, p_entity_id, p_cat_id, remark, created_by, created_on)"
+                               ." location_code, active_from, active_to, 
p_num, p_entity_id, p_cat_id, ecodimb, remark, created_by, created_on)"
                                ." VALUES ($insert_values)", __LINE__, 
__FILE__);
 
                        if($this->db->transaction_commit())
@@ -413,11 +426,12 @@
 
                        $orig = $this->read_single_contact($values['id']);
 
-                       if(implode('-', $values['location']) != 
$orig['location_code']
+                       if(isset($values['location']) &&(@implode('-', 
$values['location']) != $orig['location_code'])
                                || $values['active_from'] != 
$orig['active_from']
                                || $values['active_to'] != $orig['active_to']
                                || $values['extra']['p_num'] != $orig['p_num']
-                               || $values['remark'] != $orig['remark'])
+                               || $values['remark'] != $orig['remark']
+                               || $values['ecodimb'] != $orig['ecodimb'])
                        {
                                $receipt = $this->add_contact($values);
                                
@@ -427,6 +441,7 @@
 
                                        $value_set['expired_by']        = 
$this->account;
                                        $value_set['expired_on']        = 
time();
+                                       $value_set['ecodimb']           = 
$values['ecodimb'];
                                }
 
                                $value_set      = 
$this->db->validate_update($value_set);
@@ -494,6 +509,7 @@
                                'expired_by'            => 
$this->db->f('expired_by'),
                                'expired_on'            => 
$this->db->f('expired_on'),
                                'priority'                      => 
$this->db->f('priority'), // FIXME - evaluate the need for this one
+                               'ecodimb'                       => 
$this->db->f('ecodimb')
                        );
 
                        return $values;
@@ -525,45 +541,56 @@
                {
                        $location_filter = array();
 
-                       if(!isset($values['location']) || 
!is_array($values['location']))
+                       $todo = false;
+                       $item_filter = '';
+                       
+                       if(isset($values['ecodimb']) && $values['ecodimb'])
                        {
-                               return 0;
+                               $item_filter =   " AND ecodimb = 
'{$values['ecodimb']}'";
+                               $location_filter[] = '';
+                               $todo = true;
                        }
-                       
-                       $item_filter = '';
-                       if(isset($values['extra']) && 
is_array($values['extra']))
+                       elseif(isset($values['extra']['p_entity_id']) && 
$values['extra']['p_entity_id'])
                        {
                                $location_code = implode('-', 
$values['location']);
 
-                               $item_filter =   " WHERE p_num = 
'{$values['extra']['p_num']}'"
+                               $item_filter =   " AND p_num = 
'{$values['extra']['p_num']}'"
                                                                .' AND 
p_entity_id =' . (int) $values['extra']['p_entity_id']
                                                                .' AND p_cat_id 
=' . (int) $values['extra']['p_cat_id'];
 
                                $location_filter[] = " AND location_code = 
'{$location_code}'";
                                $ordermethod = '';
+                               $todo = true;
                        }
-                       else
+                       else if(isset($values['location']) && 
$values['location'])
                        {
+                               $location_filter[] = ''; // when the 
responsibility is generic - not located to any location
                                $location_code = '';
                                $location_array = array();
-                               $where = ' WHERE';
                                foreach ($values['location'] as $location)
                                {
                                        $location_array[]       = $location;
                                        $location_code          = implode('-', 
$location_array);
-                                       $location_filter[]      = "{$where} 
location_code $this->like '$location_code%'";
-                                       $location_filter        = 
array_reverse($location_filter);
-                                       $where = ' AND';
+                                       $location_filter[]      = "AND 
location_code $this->like '$location_code%'";
                                }
                                
+                               // Start at the bottom level
+                               $location_filter        = 
array_reverse($location_filter);                              
+
                                $ordermethod = ' ORDER by location_code.id ASC';
+                               $todo = true;
                        }
 
+                       if( !$todo )
+                       {
+                               return 0;
+                       }
+
                        $sql = "SELECT contact_id FROM 
fm_responsibility_contact"
                         . " $this->join fm_responsibility ON 
fm_responsibility_contact.responsibility_id = fm_responsibility.id"
-                        . " {$item_filter}"
-                        . ' AND cat_id =' . (int) $values['cat_id']
-                        . ' AND active = 1 AND active_from < ' . time() . ' 
AND active_to > ' . time() . ' AND expired_on IS NULL';
+                        . ' WHERE cat_id =' . (int) $values['cat_id']
+                        . ' AND active = 1 AND active_from < ' . time() . ' 
AND (active_to > ' . time() . ' OR active_to = 0) AND expired_on IS NULL'
+                        . " {$item_filter}";
 
                        foreach ($location_filter as $filter_at_location)
                        {
@@ -588,9 +615,32 @@
 
                public function get_contact_user_id($person_id)
                {
-                       $sql = 'SELECT account_id FROM phpgw_accounts WHERE 
person_id =' . (int) $person_id;
+                       $person_id = (int) $person_id;
+                       $sql = "SELECT account_id FROM phpgw_accounts WHERE 
person_id ={$person_id} AND person_id > 0";
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->next_record();
                        return $this->db->f('account_id');
                }
+
+               /**
+               * Get the user_id for a particular responsibility
+               *
+               * @param integer $person_id the ID of the given contact
+               *
+               * @return user_id
+               */
+
+               public function get_responsible_user_id($responsibility_id)
+               {
+                       $responsibility_id = (int)$responsibility_id;
+                       $now = time();
+                       $sql = "SELECT contact_id FROM 
fm_responsibility_contact"
+                        . " $this->join fm_responsibility ON 
fm_responsibility_contact.responsibility_id = fm_responsibility.id"
+                        . " AND active = 1 AND active_from < {$now} AND 
active_to > {$now} AND expired_on IS NULL";
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->db->next_record(); 
+                       $contact_id = $this->db->f('contact_id');
+                       return $this->get_contact_user_id($contact_id);
+               }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.sos_agreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sos_agreement.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sos_agreement.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -27,6 +27,8 @@
        * @version $Id$
        */
 
+       phpgw::import_class('phpgwapi.datetime');
+
        /**
         * Description
         * @package property
@@ -35,18 +37,18 @@
        class property_sos_agreement
        {
                var $role;
+               var $uicols = array();
 
-               function property_sos_agreement()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
+                       $this->socommon         = 
CreateObject('property.socommon');
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->db2          = clone($this->db);
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->like                     = & $this->db->like;
                }
 
                function select_vendor_list()
@@ -565,11 +567,12 @@
                {
                        $table = 'fm_s_agreement';
 
-                       $this->db->query("SELECT * from $table where 
id='$s_agreement_id'");
+                       $sql = "SELECT fm_s_agreement.* FROM $table WHERE 
id='$s_agreement_id'";
+                       $this->db->query($sql);
 
                        if($this->db->next_record())
                        {
-                               $values['id']                           = 
(int)$this->db->f('id');
+                               $values['id']                           = 
$this->db->f('id');
                                $values['entry_date']           = 
$this->db->f('entry_date');
                                $values['cat_id']                       = 
$this->db->f('category');
                                $values['member_of']            = 
explode(',',$this->db->f('member_of'));
@@ -590,7 +593,20 @@
                                                $attr['value']  = 
$this->db->f($attr['column_name']);
                                        }
                                }
+
+                               $sql = "SELECT fm_s_agreement_budget.category 
as order_category, year, ecodimb,budget_account,budget"
+                                       . " FROM fm_s_agreement_budget WHERE 
agreement_id='$s_agreement_id' AND fm_s_agreement_budget.year =" . date('Y');
+                               $this->db->query($sql);
+                               $this->db->next_record();
+
+                               $values['order_category']       = 
$this->db->f('order_category');
+                               $values['year']                         = 
$this->db->f('year');
+                               $values['ecodimb']                      = 
$this->db->f('ecodimb');
+                               $values['b_account_id']         = 
$this->db->f('budget_account');
+                               $values['budget']                       = 
(int)$this->db->f('budget');
+                               $values['year']                         = 
$this->db->f('year');
                        }
+
                        return $values;
                }
 
@@ -605,7 +621,7 @@
 
                        if($this->db->next_record())
                        {
-                               $values['agreement_id']         = 
(int)$this->db->f('agreement_id');
+                               $values['agreement_id']         = 
$this->db->f('agreement_id');
                                $values['id']                           = 
(int)$this->db->f('id');
                                $values['entry_date']           = 
$this->db->f('entry_date');
                                $values['location_code']        = 
$this->db->f('location_code');
@@ -624,38 +640,38 @@
                        return $values;
                }
 
-               function add($s_agreement,$values_attribute='')
+               function add($values,$values_attribute='')
                {
-//_debug_array($s_agreement);
+//_debug_array($values);
                        $table = 'fm_s_agreement';
-                       $s_agreement['name'] = 
$this->db->db_addslashes($s_agreement['name']);
-                       $s_agreement['descr'] = 
$this->db->db_addslashes($s_agreement['descr']);
+                       $values['name'] = 
$this->db->db_addslashes($values['name']);
+                       $values['descr'] = 
$this->db->db_addslashes($values['descr']);
 
-                       if($s_agreement['member_of'])
+                       if($values['member_of'])
                        {
-                               $s_agreement['member_of']=',' . 
implode(',',$s_agreement['member_of']) . ',';
+                               $values['member_of']=',' . 
implode(',',$values['member_of']) . ',';
                        }
 
 
                        $this->db->transaction_begin();
-                       $id = $this->bocommon->increment_id('workorder');
+                       $id = $this->socommon->increment_id('workorder');
 
                        $vals[] = $id;
-                       $vals[] = $s_agreement['name'];
-                       $vals[] = $s_agreement['descr'];
+                       $vals[] = $values['name'];
+                       $vals[] = $values['descr'];
                        $vals[] = time();
-                       $vals[] = $s_agreement['cat_id'];
-                       $vals[] = $s_agreement['member_of'];
-                       $vals[] = $s_agreement['start_date'];
-                       $vals[] = $s_agreement['end_date'];
-                       $vals[] = $s_agreement['termination_date'];
-                       $vals[] = $s_agreement['vendor_id'];
-                       $vals[] = $s_agreement['b_account_id'];
+                       $vals[] = $values['cat_id'];
+                       $vals[] = $values['member_of'];
+                       $vals[] = $values['start_date'];
+                       $vals[] = $values['end_date'];
+                       $vals[] = $values['termination_date'];
+                       $vals[] = $values['vendor_id'];
+                       $vals[] = $values['b_account_id'];
                        $vals[] = $this->account;
 
-                       if(isset($s_agreement['extra']) && 
is_array($s_agreement['extra']))
+                       if(isset($values['extra']) && 
is_array($values['extra']))
                        {
-                               foreach ($s_agreement['extra'] as $input_name 
=> $value)
+                               foreach ($values['extra'] as $input_name => 
$value)
                                {
                                        if(isset($value) && $value)
                                        {
@@ -682,8 +698,23 @@
                                $cols   = "," . implode(",", $cols);
                        }
 
-                       $vals   = $this->bocommon->validate_db_insert($vals);
+                       $vals   = $this->db->validate_insert($vals);
 
+                       if(isset($values['budget']) && $values['budget'])
+                       {
+                               $_budget = array
+                               (
+                                       'agreement_id'          => 
$values['s_agreement_id'],
+                                       'category'                      => 
$values['order_category'],
+                                       'year'                          => 
(int)$values['year'],
+                                       'ecodimb'                       => 
(int)$values['ecodimb'],
+                                       'budget_account'        => 
$values['b_account_id'],
+                                       'budget'                        => 
$values['budget'],                           
+                               );
+
+                               $this->update_budget($_budget);
+                       }
+
                        $this->db->query("INSERT INTO $table 
(id,name,descr,entry_date,category,member_of,start_date,end_date,termination_date,vendor_id,account_id,user_id
 $cols) "
                                . "VALUES ($vals)",__LINE__,__FILE__);
 
@@ -768,12 +799,12 @@
                        if($cols)
                        {
                                $cols   = "," . implode(",", $cols);
-                               $vals   = "," . 
$this->bocommon->validate_db_insert($vals);
+                               $vals   = "," . 
$this->db->validate_insert($vals);
                        }
 
                        $this->db->transaction_begin();
 
-                       $id = 
$this->bocommon->next_id($table,array('agreement_id'=>$values['s_agreement_id']));
+                       $id = 
$this->db->next_id($table,array('agreement_id'=>$values['s_agreement_id']));
 
                        $this->db->query("INSERT INTO $table 
(id,agreement_id,entry_date,user_id $cols) "
                                . "VALUES ($id," . $values['s_agreement_id'] 
."," . time()
@@ -811,12 +842,51 @@
                        return $receipt;
                }
 
-               function edit($values,$values_attribute='')
+               function update_budget($data)
                {
+                       $sql = "SELECT * FROM fm_s_agreement_budget WHERE 
agreement_id = {$data['agreement_id']} AND year = {$data['year']}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       if($this->db->next_record())
+                       {
+                               $old_category   = $this->db->f('category');
+                               $old_ecodimb            = 
$this->db->f('ecodimb');
+                               $old_budget_account     = 
$this->db->f('budget_account');
+                               $old_budget                     = 
$this->db->f('budget');
+                               $sql = "UPDATE fm_s_agreement_budget SET"
+                                . " category = {$data['category']},"
+                                . " ecodimb = {$data['ecodimb']},"
+                                . " budget_account = 
'{$data['budget_account']}',"
+                                . " budget = {$data['budget']},"
+                                . ' modified_date=' . time()
+                                . " WHERE agreement_id = 
{$data['agreement_id']} AND year = {$data['year']}";
+                                                               
+                       }
+                       else
+                       {
+                               $sql = "INSERT INTO fm_s_agreement_budget 
(agreement_id,year,category,ecodimb,budget_account,budget,user_id,entry_date) 
VALUES("
+                                . "{$data['agreement_id']},"
+                                . "{$data['year']},"
+                                . "{$data['category']},"
+                                . "{$data['ecodimb']},"
+                                . "'{$data['budget_account']}',"
+                                . "{$data['budget']},"
+                                . "{$this->account},"
+                                . time() . ')';
+                       }
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+               
+               }
+
+               function edit($values,$values_attribute = array())
+               {
 //_debug_array($values);
 //_debug_array($values_attribute);
+
                        $table = 'fm_s_agreement';
 
+                       $values['s_agreement_id'] = 
$this->db->db_addslashes($values['s_agreement_id']); // bigint
                        $values['name'] = 
$this->db->db_addslashes($values['name']);
 
                        if($values['member_of'])
@@ -854,14 +924,30 @@
                        $value_set['descr']     = $values['descr'];
                        if($value_set)
                        {
-                               $value_set      = ',' . 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = ',' . 
$this->db->validate_update($value_set);
                        }
 
+                       $this->db->transaction_begin();
+                       if(isset($values['budget']) && $values['budget'])
+                       {
+                               $_budget = array
+                               (
+                                       'agreement_id'          => 
$values['s_agreement_id'],
+                                       'category'                      => 
$values['order_category'],
+                                       'year'                          => 
(int)$values['year'],
+                                       'ecodimb'                       => 
(int)$values['ecodimb'],
+                                       'budget_account'        => 
$values['b_account_id'],
+                                       'budget'                        => 
$values['budget'],                           
+                               );
+
+                               $this->update_budget($_budget);
+                       }
                        $this->db->query("UPDATE $table set entry_date='" . 
time() . "', category='"
-                                                       . $values['cat_id'] . 
"', member_of='" . $values['member_of'] . "', start_date=" . 
intval($values['start_date']) . ", end_date=" . intval($values['end_date']) . 
", termination_date=" . intval($values['termination_date']) . ", account_id=" . 
intval($values['b_account_id']) . "$value_set WHERE id=" . 
intval($values['s_agreement_id']));
+                                                       . $values['cat_id'] . 
"', member_of='" . $values['member_of'] . "', start_date=" . 
intval($values['start_date']) . ", end_date=" . intval($values['end_date']) . 
", termination_date=" . intval($values['termination_date']) . ", account_id=" . 
intval($values['b_account_id']) . "$value_set WHERE 
id='{$values['s_agreement_id']}'");
 
-                       $this->db->query("UPDATE fm_s_agreement_pricing set 
index_date=" . intval($values['start_date']) . " WHERE id=1 AND agreement_id= " 
. intval($values['s_agreement_id']));
+                       $this->db->query("UPDATE fm_s_agreement_pricing set 
index_date=" . intval($values['start_date']) . " WHERE id=1 AND agreement_id= 
'{$values['s_agreement_id']}'");
 
+                       $this->db->transaction_commit();
                        $receipt['s_agreement_id']= $values['s_agreement_id'];
                        $receipt['message'][] = array('msg'=>lang('s_agreement 
%1 has been edited',$values['s_agreement_id']));
                        return $receipt;
@@ -902,7 +988,7 @@
                                                if($entry['value'] != 
$old_value)
                                                {
                                                        
$history_set[$entry['attrib_id']] = array('value' => $entry['value'],
-                                                                               
                'date'  => $this->bocommon->date_to_timestamp($entry['date']));
+                                                                               
                'date'  => 
phpgwapi_datetime::date_to_timestamp($entry['date']));
                                                }
                                        }
                                }
@@ -926,12 +1012,12 @@
 
                        if($value_set)
                        {
-                               $value_set      = ',' . 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = ',' . 
$this->db->validate_update($value_set);
                        }
 
-                       $this->db->query("UPDATE $table set entry_date=" . 
time() . "$value_set WHERE agreement_id=" . intval($values['s_agreement_id']) . 
' AND id=' . intval($values['id']));
+                       $this->db->query("UPDATE $table set entry_date=" . 
time() . "$value_set WHERE agreement_id=" . ($values['s_agreement_id']) . ' AND 
id=' . intval($values['id']));
 
-                       $this->db->query("UPDATE fm_s_agreement_pricing set 
cost = this_index *" . $this->floatval($values['cost']) . " WHERE 
agreement_id=" . intval($values['s_agreement_id']) . ' AND item_id=' . 
intval($values['id']));
+                       $this->db->query("UPDATE fm_s_agreement_pricing set 
cost = this_index *" . $this->floatval($values['cost']) . " WHERE 
agreement_id=" . $values['s_agreement_id'] . ' AND item_id=' . 
intval($values['id']));
 
                        if (isset($history_set) AND is_array($history_set))
                        {
@@ -952,19 +1038,18 @@
 
                function update($values)
                {
-//_debug_array($values);
                        
$values['new_index']=$this->floatval($values['new_index']);
                        $this->db->transaction_begin();
 
-                       while (is_array($values['select']) && 
list($item_id,$value) = each($values['select']))
+                       if(isset($values['select']) && 
is_array($values['select']))
                        {
-
-                               $this->db->query("UPDATE fm_s_agreement_pricing 
set current_index = NULL WHERE agreement_id=" . intval($values['agreement_id']) 
. ' AND item_id=' . intval($item_id));
-
+                               foreach ($values['select'] as $item_id => 
$value)
+                               {
+                                       $this->db->query("UPDATE 
fm_s_agreement_pricing SET current_index = NULL WHERE agreement_id=" . 
$values['agreement_id'] . ' AND item_id=' . (int)$item_id);
                                $this->db->query("INSERT INTO 
fm_s_agreement_pricing 
(agreement_id,item_id,id,current_index,this_index,cost,index_date,entry_date,user_id)"
                                        . "VALUES (" . $values['agreement_id'] 
. "," . $item_id ."," . ($values['id'][$item_id]+1) .",1,'" . 
$values['new_index'] . "','" . ($value * $values['new_index'])  . "'," . 
(int)$values['date'] . "," . time()
                                        . "," . $this->account . ")");
-
+                               }
                        }
 
                        $this->db->transaction_commit();
@@ -1013,10 +1098,10 @@
                {
                        $table = 'fm_s_agreement';
                        $this->db->transaction_begin();
-                       $this->db->query("DELETE FROM $table WHERE id=" . 
intval($s_agreement_id));
-                       $this->db->query("DELETE FROM fm_s_agreement_detail 
WHERE agreement_id=" . intval($s_agreement_id));
-                       $this->db->query("DELETE FROM fm_s_agreement_pricing 
WHERE agreement_id=" . intval($s_agreement_id));
-                       $this->db->query("DELETE FROM fm_orders WHERE id=" . 
intval($s_agreement_id));
+                       $this->db->query("DELETE FROM $table WHERE id=" . 
$s_agreement_id);
+                       $this->db->query("DELETE FROM fm_s_agreement_detail 
WHERE agreement_id=" . $s_agreement_id);
+                       $this->db->query("DELETE FROM fm_s_agreement_pricing 
WHERE agreement_id=" . $s_agreement_id);
+                       $this->db->query("DELETE FROM fm_orders WHERE id=" . 
$s_agreement_id);
                        $this->db->transaction_commit();
                }
 
@@ -1040,5 +1125,50 @@
                        $next_id= $this->db->f('id')+1;
                        return $next_id;
                }
+
+               function get_year_filter_list($agreement_id = 0)
+               {
+                       $table = 'fm_s_agreement_budget';
+                       $sql = "SELECT year FROM $table WHERE agreement_id = 
{$agreement_id} group by year ORDER BY year ASC";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $values = array();
+
+                       while ($this->db->next_record())
+                       {
+                               $values[]       = $this->db->f('year');
        }
 
+                       return $values;
+               }
+
+               function get_budget($agreement_id = 0)
+               {
+                       $values = array();
+
+                       $sql = "SELECT * FROM fm_s_agreement_budget WHERE 
agreement_id = {$agreement_id} ORDER BY year ASC";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while($this->db->next_record())
+                       {
+                               $values[] = array
+                               (
+                                       'agreement_id'          => 
$agreement_id,
+                                       'year'                          => 
$this->db->f('year'),
+                                       'cat_id'                        => 
$this->db->f('category'),
+                                       'ecodimb'                       => 
$this->db->f('ecodimb'),
+                                       'budget_account'        => 
$this->db->f('budget_account'),
+                                       'budget'                        => 
$this->db->f('budget'),
+                                       'actual_cost'           => 
$this->db->f('actual_cost')
+                               );
+                       }
+                       
+                       return $values;
+               }
+
+               function delete_year_from_budget($data,$agreement_id)
+               {
+                       $sql = "DELETE FROM fm_s_agreement_budget WHERE 
agreement_id = {$agreement_id} AND year IN(" . implode(',', $data) . ')';
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+       }

Modified: people/sigurdne/modules/property/trunk/inc/class.sostandard_2.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sostandard_2.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sostandard_2.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,77 +35,67 @@
        class property_sostandard_2
        {
 
-               function property_sostandard_2()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-
-                       $this->join             = $this->bocommon->join;
-                       $this->like             = $this->bocommon->like;
+                       $this->_db                      = & 
$GLOBALS['phpgw']->db;
+                       $this->_like            = & $this->_db->like;
                }
 
                function read($data)
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                               $query          = isset($data['query']) ? 
$data['query'] : '';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
+                               $order          = isset($data['order']) ? 
$data['order'] : '';
+                               $type           = isset($data['type']) ? 
$data['type'] : '';
+                               $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
                                }
-                               else
+
+                       $standard = array();
+                       if (!$table = $this->select_table($type))
                                {
-                                       $start=0;
-                               }
-                               $query          = 
(isset($data['query'])?$data['query']:'');
-                               $sort           = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order          = 
(isset($data['order'])?$data['order']:'');
-                               $type           = 
(isset($data['type'])?$data['type']:0);
-                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
+                               return $standard;
                        }
 
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
-
+                               $ordermethod = " ORDER BY $order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by id asc';
+                               $ordermethod = ' ORDER BY id ASC';
                        }
 
-                       $table = $this->select_table($type);
-
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
+                               $query = $this->_db->db_addslashes($query);
 
-                               $querymethod = " where id $this->like 
'%$query%' or descr $this->like '%$query%'";
+                               $querymethod = " WHERE id $this->_like 
'%$query%' OR descr $this->_like '%$query%'";
                        }
 
                        $sql = "SELECT * FROM $table $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->_db->num_rows();
 
                        if(!$allrows)
                        {
-                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                               $this->_db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
                        }
                        else
                        {
-                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                               $this->_db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
                                $standard[] = array
                                (
-                                       'id'    => $this->db->f('id'),
-                                       'descr' => $this->db->f('descr')
+                                       'id'    => $this->_db->f('id'),
+                                       'descr' => $this->_db->f('descr')
                                );
                        }
                        return $standard;
@@ -143,61 +133,82 @@
 
                function read_single($id,$type)
                {
+                       $standard = array();
 
-                       $table = $this->select_table($type);
+                       if (!$table = $this->select_table($type))
+                       {
+                               return $standard;
+                       }
 
-                       $sql = "SELECT * FROM $table  where id='$id'";
+                       $sql = "SELECT * FROM $table WHERE id='{$id}'";
 
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->_db->query($sql,__LINE__,__FILE__);
 
-                       if ($this->db->next_record())
+                       if ($this->_db->next_record())
                        {
-                               $standard['id']                 = 
$this->db->f('id');
-                               $standard['descr']              = 
$this->db->f('descr');
-
-                               return $standard;
+                               $standard = array
+                               (
+                                       'id'            => $this->_db->f('id'),
+                                       'descr'         => 
$this->_db->f('descr', true)
+                               );
                        }
+                       return $standard;
                }
 
                function add($standard,$type)
                {
-                       $table = $this->select_table($type);
+                       $receipt = array();
+                       if (!$table = $this->select_table($type))
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
 
-                       $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);
+                       $standard['descr'] = 
$this->_db->db_addslashes($standard['descr']);
 
-                       $this->db->transaction_begin();
+                       $this->_db->transaction_begin();
 
-                       $this->db->query("INSERT INTO $table (id, descr) "
+                       $this->_db->query("INSERT INTO $table (id, descr) "
                                . "VALUES ('" . $standard['id'] . "','" . 
$standard['descr']. "')",__LINE__,__FILE__);
 
-                       $this->db->transaction_commit();
+                       $this->_db->transaction_commit();
                        $receipt['message'][] = array('msg' => lang('standard 
has been saved'));
                        return $receipt;
                }
 
                function edit($standard,$type)
                {
+                       $receipt = array();
+                       if (!$table = $this->select_table($type))
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
 
-                       $table = $this->select_table($type);
+                       $standard['descr'] = 
$this->_db->db_addslashes($standard['descr']);
 
-                       $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);
+                       $this->_db->transaction_begin();
 
-                       $this->db->transaction_begin();
-
-                       $this->db->query("UPDATE $table set descr='" . 
$standard['descr']
+                       $this->_db->query("UPDATE $table set descr='" . 
$standard['descr']
                                                        . "' WHERE id='" . 
$standard['id']. "'",__LINE__,__FILE__);
 
-                       $this->db->transaction_commit();
+                       $this->_db->transaction_commit();
                        $receipt['message'][] = array('msg' => lang('standard 
has been edited'));
                        return $receipt;
                }
 
                function delete($id,$type)
                {
-                       $table = $this->select_table($type);
-                       $this->db->transaction_begin();
-                       $this->db->query("DELETE FROM $table WHERE id=" . 
(int)$id,__LINE__,__FILE__);
-                       $this->db->transaction_commit();
+                       $receipt = array();
+                       if (!$table = $this->select_table($type))
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
+
+                       $this->_db->transaction_begin();
+                       $this->_db->query("DELETE FROM $table WHERE 
id='{$id}'",__LINE__,__FILE__);
+                       $this->_db->transaction_commit();
                }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sostandard_3.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,71 +34,63 @@
 
        class property_sostandard_3
        {
-
-               function property_sostandard_3()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
                        $this->socommon         = 
CreateObject('property.socommon');
+                       $this->_db                      = & 
$GLOBALS['phpgw']->db;
 
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->_join            = & $this->_db->join;
+                       $this->_like            = & $this->_db->like;
                }
 
                function read($data)
                {
                        if(is_array($data))
                        {
-                               if ($data['start'])
-                               {
-                                       $start=$data['start'];
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start']:0;
+                               $query          = 
isset($data['query'])?$data['query']:'';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
+                               $order          = 
isset($data['order'])?$data['order']:'';
+                               $type           = isset($data['type']) 
?$data['type']: '';
                                }
-                               else
+
+                       $standard = array();
+                       if (!$table = $this->select_table($type))
                                {
-                                       $start=0;
-                               }
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $type = (isset($data['type'])?$data['type']:0);
+                               return $standard;
                        }
 
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
-
                        }
                        else
                        {
                                $ordermethod = ' order by id asc';
                        }
 
-                       $table = $this->select_table($type);
-
                        if($query)
                        {
-                               $query = preg_replace("/'/",'',$query);
-                               $query = preg_replace('/"/','',$query);
-
-                               $querymethod = " where id $this->like 
'%$query%' or descr $this->like '%$query%'";
+                               $query = $this->_db->db_addslashes($query);
+                               // FIXME: change fm_async_method.name to 
fm_async_method.num
+                               //$querymethod = " WHERE num $this->_like 
'%$query%' or descr $this->_like '%$query%'";
+                               $querymethod = " WHERE descr $this->_like 
'%$query%'";
                        }
 
                        $sql = "SELECT * FROM $table $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
-                       $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->_db->num_rows();
+                       $this->_db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
 
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
                                $standard[] = array
                                (
-                                       'id'    => $this->db->f('id'),
-                                       'num'   => $this->db->f('num'),
-                                       'descr' => $this->db->f('descr')
+                                       'id'    => $this->_db->f('id'),
+                                       'num'   => $this->_db->f('num', true),
+                                       'descr' => $this->_db->f('descr',true)
                                );
                        }
                        return $standard;
@@ -106,6 +98,7 @@
 
                function select_table($type)
                {
+                       $table = '';
                        switch($type)
                        {
                                case 'branch':
@@ -121,38 +114,50 @@
                        return $table;
                }
 
-               function read_single($id,$type)
+               function read_single($id, $type)
                {
+                       $id = (int) $id;
+                       $standard = array();
 
-                       $table = $this->select_table($type);
+                       if (!$table = $this->select_table($type))
+                       {
+                               return $standard;
+                       }
 
-                       $sql = "SELECT * FROM $table  where id='$id'";
+                       $sql = "SELECT * FROM $table WHERE id={$id}";
 
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->_db->query($sql,__LINE__,__FILE__);
 
-                       if ($this->db->next_record())
+                       if ($this->_db->next_record())
                        {
-                               $standard['id']                 = 
$this->db->f('id');
-                               $standard['num']                = 
$this->db->f('num');
-                               $standard['descr']              = 
$this->db->f('descr');
-
-                               return $standard;
+                               $standard = array
+                               (
+                                       'id'            => $this->_db->f('id'),
+                                       'num'           => $this->_db->f('num', 
true),
+                                       'descr'         => 
$this->_db->f('descr', true)
+                               );
                        }
+                       return $standard;
                }
 
                function add($standard,$type)
                {
-                       $table = $this->select_table($type);
+                       $receipt = array();
+                       if (!$table = $this->select_table($type))
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
 
+                       $standard['num'] = 
$this->_db->db_addslashes($standard['num']);
+                       $standard['descr'] = 
$this->_db->db_addslashes($standard['descr']);
+
+                       $this->_db->transaction_begin();
                        $standard['id'] = $this->socommon->next_id($table);
-                       $standard['num'] = 
$this->db->db_addslashes($standard['num']);
-                       $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);
-
-                       $this->db->transaction_begin();
-                       $this->db->query("INSERT INTO $table (id, num, descr) "
+                       $this->_db->query("INSERT INTO $table (id, num, descr) "
                                . "VALUES ('" . $standard['id'] . "','" . 
$standard['num'] . "','" . $standard['descr']. "')",__LINE__,__FILE__);
 
-                       $this->db->transaction_commit();
+                       $this->_db->transaction_commit();
                        $receipt['id'] = $standard['id'];
                        $receipt['message'][] = array('msg' => lang('standard 
has been saved'));
 
@@ -161,16 +166,21 @@
 
                function edit($standard,$type)
                {
-                       $table = $this->select_table($type);
+                       $receipt = array();
+                       if (!$table = $this->select_table($type))
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
 
-                       $standard['num'] = 
$this->db->db_addslashes($standard['num']);
-                       $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);
+                       $standard['num'] = 
$this->_db->db_addslashes($standard['num']);
+                       $standard['descr'] = 
$this->_db->db_addslashes($standard['descr']);
 
-                       $this->db->transaction_begin();
-                       $this->db->query("UPDATE $table set descr='" . 
$standard['descr'] . "', num='". $standard['num']
+                       $this->_db->transaction_begin();
+                       $this->_db->query("UPDATE $table set descr='" . 
$standard['descr'] . "', num='". $standard['num']
                                                        . "' WHERE id='" . 
$standard['id']. "'",__LINE__,__FILE__);
 
-                       $this->db->transaction_commit();
+                       $this->_db->transaction_commit();
 
                        $receipt['id'] = $standard['id'];
                        $receipt['message'][] = array('msg' =>lang('standard 
has been edited'));
@@ -179,10 +189,16 @@
 
                function delete($id,$type)
                {
-                       $table = $this->select_table($type);
-                       $this->db->transaction_begin();
-                       $this->db->query("DELETE FROM $table WHERE id=" . 
(int)$id ,__LINE__,__FILE__);
-                       $this->db->transaction_commit();
+                       $receipt = array();
+                       if (!$table = $this->select_table($type))
+                       {
+                               $receipt['error'][] = array('msg' => lang('not 
a valid type'));
+                               return $receipt;
+                       }
+
+                       $this->_db->transaction_begin();
+                       $this->_db->query("DELETE FROM $table WHERE id=" . 
(int)$id ,__LINE__,__FILE__);
+                       $this->_db->transaction_commit();
                }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sotemplate.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -39,8 +39,7 @@
                //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
+                       $this->db           = & $GLOBALS['phpgw']->db;
 
                        $this->join                     = $this->bocommon->join;
                        $this->left_join        = $this->bocommon->left_join;
@@ -92,15 +91,15 @@
                                $query = preg_replace("/'/",'',$query);
                                $query = preg_replace('/"/','',$query);
 
-                               $querymethod = " $where (fm_template.descr 
$this->like '%$query%')";
+                               $querymethod = " $where (fm_template.name 
$this->like '%$query%' OR fm_template.descr $this->like '%$query%')";
                        }
 
                        $sql = "SELECT 
fm_template.id,fm_template.descr,fm_template.name,fm_template.owner,fm_template.entry_date,"
                         . " fm_chapter.descr as chapter FROM fm_template 
$this->left_join fm_chapter  on fm_template.chapter_id=fm_chapter.id"
                         . " $filtermethod $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {
@@ -170,8 +169,8 @@
 
                        $sql = "SELECT fm_template_hours.*, chapter_id from 
fm_template_hours  $this->join fm_template on 
fm_template.id=fm_template_hours.template_id $filtermethod $querymethod";
 
-                       $this->db2->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db2->num_rows();
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if(!$allrows)
                        {

Modified: 
people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sotenant_claim.inc.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -37,11 +37,9 @@
                function property_sotenant_claim()
                {
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
                        $this->interlink        = 
CreateObject('property.interlink');
                }
 
@@ -49,20 +47,29 @@
                {
                        if(is_array($data))
                        {
-                               $start  = 
(isset($data['start'])?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $status = 
(isset($data['status'])?$data['status']:'open');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
-                               $project_id     = 
(isset($data['project_id'])?$data['project_id']:'');
+                               $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
+                               $filter         = isset($data['filter']) && 
$data['filter'] ? $data['filter'] : 'none';
+                               $status         = isset($data['status']) && 
$data['status'] ? $data['status'] : 'open';
+                               $query          = isset($data['query']) ? 
$data['query'] : '';
+                               $sort           = isset($data['sort']) && 
$data['sort'] ? $data['sort'] : 'DESC';
+                               $order          = isset($data['order']) ? 
$data['order'] : '';
+                               $cat_id         = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id'] : 0;
+                               $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
+                               $project_id     = isset($data['project_id']) ? 
$data['project_id'] : '';
 
                        }
 
                        if ($order)
                        {
+                               switch($order)
+                               {
+                                       case 'claim_id':
+                                               $order = 'fm_tenant_claim.id';
+                                               break;
+                                       case 'name':
+                                               $order = 'last_name';
+                                               break;
+                               }
                                $ordermethod = " order by $order $sort";
                        }
                        else
@@ -84,17 +91,11 @@
                                $where = 'AND';
                        }
 
-                       if ($status == 'closed'):
+                       if ($status && $status != 'all')
                        {
-                               $filtermethod .= " $where 
fm_tenant_claim.status='closed'";
+                               $filtermethod .= " $where 
fm_tenant_claim.status='{$status}'";
                                $where = 'AND';
                        }
-                       elseif($status == ''):
-                       {
-                               $filtermethod .= " $where 
fm_tenant_claim.status='open'";
-                               $where = 'AND';
-                       }
-                       endif;
 
                        if($query)
                        {
@@ -103,7 +104,7 @@
                                $querymethod = " $where ( first_name 
$this->like '%$query%' OR last_name $this->like '%$query%')";
                        }
 
-                       $sql = "SELECT fm_tenant_claim.*, descr as category 
FROM fm_tenant_claim "
+                       $sql = "SELECT fm_tenant_claim.*, descr as category, 
fm_tenant.last_name, fm_tenant.first_name FROM fm_tenant_claim "
                         . " $this->join fm_tenant_claim_category on 
fm_tenant_claim.category=fm_tenant_claim_category.id"
                         . " $this->join fm_tenant ON fm_tenant_claim.tenant_id 
= fm_tenant.id"
                         . " $filtermethod $querymethod";
@@ -120,6 +121,7 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
+                       $claims = array();
                        while ($this->db->next_record())
                        {
                                $claims[] = array
@@ -127,6 +129,7 @@
                                        'claim_id'              => 
$this->db->f('id'),
                                        'project_id'    => 
$this->db->f('project_id'),
                                        'tenant_id'             => 
$this->db->f('tenant_id'),
+                                       'name'                  => 
$this->db->f('last_name') . ', ' . $this->db->f('first_name'),
                                        'remark'                => 
$this->db->f('remark',true),
                                        'entry_date'    => 
$this->db->f('entry_date'),
                                        'category'              => 
$this->db->f('category'),
@@ -220,7 +223,7 @@
                                $claim['status']
                                );
 
-                       $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                       $values_insert  = 
$this->db->validate_insert($values_insert);
 
 
                        $this->db->query("INSERT INTO fm_tenant_claim 
(project_id,tenant_id,amount,b_account_id,category,remark,user_id,entry_date,status)
 "
@@ -269,7 +272,7 @@
                                'remark'                        => 
$this->db->db_addslashes($claim['remark'])
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE fm_tenant_claim set $value_set 
 WHERE id=" . (int)$claim['claim_id'],__LINE__,__FILE__);
 

Modified: people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -27,6 +27,8 @@
        * @version $Id$
        */
 
+       phpgw::import_class('phpgwapi.datetime');
+
        /**
         * Description
         * @package property
@@ -34,16 +36,21 @@
 
        class property_sotts
        {
-               function property_sotts()
+               var $uicols_related = array();
+               var $acl_location = '.ticket';
+
+               var $soap_enabled = array
+               (
+                       'read'  => true
+               );
+
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->historylog       = 
CreateObject('property.historylog','tts');
-                       $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db           = $this->bocommon->new_db();
-                       $this->join                     = $this->bocommon->join;
-                       $this->like                     = $this->bocommon->like;
-                       $this->soadmin_entity   = 
CreateObject('property.soadmin_entity');
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+                       $this->like             = & $this->db->like;
+                       $this->join             = & $this->db->join;
                        $this->dateformat       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                }
 
@@ -56,11 +63,10 @@
 
                function read($data)
                {
-                       if(is_array($data))
-                       {
                                $start                  = isset($data['start']) 
&& $data['start'] ? $data['start']:0;
-                               $filter                 = 
isset($data['filter']) && $data['filter'] ? $data['filter']:'O'; //O='Open'
-                               $user_filter    = 
isset($data['user_filter'])?$data['user_filter']:'';
+                       $status_id              = isset($data['status_id']) && 
$data['status_id'] ? $data['status_id']:'O'; //O='Open'
+                       $user_id                = 
isset($data['user_id'])?$data['user_id']:'';
+                       $owner_id               = 
isset($data['owner_id'])?$data['owner_id']:'';
                                $query                  = 
isset($data['query'])?$data['query']:'';
                                $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort']:'DESC';
                                $order                  = 
isset($data['order'])?$data['order']:'';
@@ -70,35 +76,53 @@
                                $start_date             = 
isset($data['start_date'])?$data['start_date']:'';
                                $end_date               = 
isset($data['end_date'])?$data['end_date']:'';
                                $external               = 
isset($data['external'])?$data['external']:'';
-                       }
+                       $dry_run                = isset($data['dry_run']) ? 
$data['dry_run'] : '';
 
                        $this->grants   = 
$GLOBALS['phpgw']->session->appsession('grants_ticket','property');
 
                        if(!$this->grants)
                        {
-                               $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants('property','.ticket');
+//                             $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants('property','.ticket');
                                
$GLOBALS['phpgw']->session->appsession('grants_ticket','property',$this->grants);
                        }
 
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
+                               if( $order == 'assignedto' )
+                               {
+                                       $order_join = "$this->join 
phpgw_accounts ON fm_tts_tickets.assignedto=phpgw_accounts.account_id";
+                                       $order = 'account_lastname';
+                               }
+                               else if( $order == 'user' )
+                               {
+                                       $order_join = "$this->join 
phpgw_accounts ON fm_tts_tickets.user_id=phpgw_accounts.account_id";
+                                       $order = 'account_lastname';
+                               }
+                               else
+                               {
+                                       $order_join = '';
+                               }
+                               
+                               $ordermethod = " ORDER BY $order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by fm_tts_tickets.id 
DESC';
+                               $ordermethod = ' ORDER BY fm_tts_tickets.id 
DESC';
                        }
 
                        $where= 'WHERE';
 
                        $filtermethod = '';
-                       $GLOBALS['phpgw']->config->read_repository();
+                       $GLOBALS['phpgw']->config->read();
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
                        {
-                               $access_location = 
$this->bocommon->get_location_list(PHPGW_ACL_READ);
+                               $access_location = 
execMethod('property.socommon.get_location_list', PHPGW_ACL_READ);
+                               if($access_location)
+                               {
                                $filtermethod = " WHERE fm_tts_tickets.loc1 in 
('" . implode("','", $access_location) . "')";
                                $where= 'AND';
                        }
+                       }
 
                        if (is_array($this->grants))
                        {
@@ -115,25 +139,53 @@
                        if($tenant_id = 
$GLOBALS['phpgw']->session->appsession('tenant_id','property'))
                        {
                                $filtermethod .= $where . ' 
fm_tts_tickets.tenant_id=' . $tenant_id;
+                               $where = 'AND';
                        }
 
-                       if ($filter == 'X')
+                       if ($status_id == 'X')
                        {
                                $filtermethod .= " $where 
fm_tts_tickets.status='X'";
                                $where = 'AND';
                        }
-                       else if($filter == 'O')
+                       else if($status_id == 'O')
                        {
-                               $filtermethod .= " $where 
(fm_tts_tickets.status='O' OR fm_tts_tickets.status $this->like 'C%')";
+                               $open = '';
+                               $this->db->query('SELECT * from 
fm_tts_status',__LINE__,__FILE__);
+
+                               while ($this->db->next_record())
+                       {
+                                       if( ! $this->db->f('closed'))
+                                       {
+                                               $open .= " OR 
fm_tts_tickets.status = 'C" . $this->db->f('id') . "'";
+                                       }
+                               }
+
+                               $filtermethod .= " $where 
(fm_tts_tickets.status='O'{$open})";
                                $where = 'AND';
                        }
-                       else if($filter == 'all')
+                       else if($status_id == 'all')
                        {
                                //nothing
                        }
+                       else if(is_array($status_id) && count($status_id))
+                       {
+                               $or = '';
+                               $filtermethod .= "{$where} (";
+                               
+                               foreach ($status_id as $value)
+                               {
+                                       $value = trim($value,'C');
+                                       $filtermethod .= "{$or} 
fm_tts_tickets.status = '{$value}'";                                    
+                                       $or = ' OR';
+                               }
+
+                               $filtermethod .= ')';
+
+                               $where = 'AND';
+                       }
                        else
                        {
-                               $filtermethod .= " $where 
fm_tts_tickets.status='{$filter}'";
+                               $filtermethod .= " $where 
fm_tts_tickets.status='{$status_id}'";
                                $where = 'AND';
                        }
 
@@ -143,15 +195,21 @@
                                $where = 'AND';
                        }
 
-                       if ($user_filter > 0)
+                       if ($user_id > 0)
                        {
-                               $filtermethod .= " $where 
assignedto=$user_filter";
+                               $filtermethod .= " $where assignedto=" . 
(int)$user_id;
                                $where = 'AND';
                        }
 
+                       if ($owner_id > 0)
+                       {
+                               $filtermethod .= " $where 
fm_tts_tickets.user_id=" . (int)$owner_id;
+                               $where = 'AND';
+                       }
+
                        if ($district_id > 0)
                        {
-                               $filtermethod .= " $where  
district_id='$district_id' ";
+                               $filtermethod .= " $where  district_id=" 
.(int)$district_id;
                                $where = 'AND';
                        }
 
@@ -177,14 +235,18 @@
                                }
                        }
 
-                       $sql = "SELECT fm_tts_tickets.* FROM fm_tts_tickets"
-                       . " $this->join fm_location1 on 
fm_tts_tickets.loc1=fm_location1.loc1"
-                       . " $this->join fm_part_of_town on 
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id $filtermethod 
$querymethod";
+                       $sql = "SELECT fm_tts_tickets.* ,fm_location1.loc1_name 
FROM fm_tts_tickets"
+                       . " $this->join fm_location1 ON 
fm_tts_tickets.loc1=fm_location1.loc1"
+                       . " $this->join fm_part_of_town ON 
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id"
+                       . " $order_join"
+                       . " $filtermethod $querymethod";
 
-//echo $sql;
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db->num_rows();
-
+                       if(!$dry_run)
+                       {
+                               $this->db->query('SELECT count(*) as hits ' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $this->total_records = $this->db->f('hits');
+                               $this->db->fetchmode = 'ASSOC';
                        if(!$allrows)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -194,36 +256,42 @@
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
-                       $db2            = $this->bocommon->new_db($this->db);
+                       }
 
                        $tickets = array();
-                       $i = 0;
+
                        while ($this->db->next_record())
                        {
-                               $tickets[$i]['id']                              
= $this->db->f('id');
-                               $tickets[$i]['subject']                 = 
$this->db->f('subject',true);
-                               $tickets[$i]['location_code']   = 
$this->db->f('location_code');
-                               $tickets[$i]['user_id']                 = 
$this->db->f('user_id');
-                               $tickets[$i]['address']                 = 
$this->db->f('address',true);
-                               $tickets[$i]['assignedto']              = 
$this->db->f('assignedto');
-                               $tickets[$i]['status']                  = 
$this->db->f('status');
-                               $tickets[$i]['priority']                = 
$this->db->f('priority');
-                               $tickets[$i]['cat_id']                  = 
$this->db->f('cat_id');
-                               $tickets[$i]['group_id']                = 
$this->db->f('group_id');
-                               $tickets[$i]['entry_date']              = 
$this->db->f('entry_date');
-                               $tickets[$i]['finnish_date']    = 
$this->db->f('finnish_date');
-                               $tickets[$i]['finnish_date2']   = 
$this->db->f('finnish_date2');
+                               $tickets[]= array
+                               (
+                                       'id'                            => 
(int) $this->db->f('id'),
+                                       'subject'                       => 
$this->db->f('subject',true),
+                                       'loc1_name'                     => 
$this->db->f('loc1_name',true),
+                                       'location_code'         => 
$this->db->f('location_code'),
+                                       'user_id'                       => 
$this->db->f('user_id'),
+                                       'address'                       => 
$this->db->f('address',true),
+                                       'assignedto'            => 
$this->db->f('assignedto'),
+                                       'status'                        => 
$this->db->f('status'),
+                                       'priority'                      => 
$this->db->f('priority'),
+                                       'cat_id'                        => 
$this->db->f('cat_id'),
+                                       'group_id'                      => 
$this->db->f('group_id'),
+                                       'entry_date'            => 
$this->db->f('entry_date'),
+                                       'finnish_date'          => 
$this->db->f('finnish_date'),
+                                       'finnish_date2'         => 
$this->db->f('finnish_date2'),
+                                       'new_ticket'            => ''
+                               );
+                       }
 
-                               $db2->query("select count(*) from fm_tts_views 
where id='" . (int)$this->db->f('id')
-                                       . "' and account_id='" . 
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
-                               $db2->next_record();
+                       foreach ($tickets as &$ticket)
+                               {
+                               $this->db->query("SELECT count(*) as hits FROM 
fm_tts_views where id={$ticket['id']}"
+                                       . " AND 
account_id='{$this->account}'",__LINE__,__FILE__);
+                               $this->db->next_record();
 
-                               if (!$db2->f(0))
+                               if(! $this->db->f('hits'))
                                {
-                                       $tickets[$i]['new_ticket'] = true;
+                                       $ticket['new_ticket'] = true;
                                }
-
-                               $i++;
                        }
                        return $tickets;
                }
@@ -248,9 +316,9 @@
                        }
 
                        $entity[$i]['type']='.project';
-                       $uicols[]       = lang('project');
+                       $uicols[]       = 'project';
 
-                       $this->uicols   = $uicols;
+                       $this->uicols_related   = $uicols;
                        return $entity;
                }
 
@@ -267,18 +335,27 @@
                                $ticket['group_id']                     = 
$this->db->f('group_id');
                                $ticket['status']                       = 
$this->db->f('status');
                                $ticket['cat_id']                       = 
$this->db->f('cat_id');
-                               $ticket['subject']                      = 
stripslashes($this->db->f('subject'));
+                               $ticket['subject']                      = 
$this->db->f('subject', true);
                                $ticket['priority']                     = 
$this->db->f('priority');
-                               $ticket['details']                      = 
stripslashes($this->db->f('details'));
+                               $ticket['details']                      = 
$this->db->f('details', true);
                                $ticket['location_code']        = 
$this->db->f('location_code');
                                $ticket['contact_phone']        = 
$this->db->f('contact_phone');
-                               $ticket['address']                      = 
stripslashes($this->db->f('address'));
+                               $ticket['contact_email']        = 
$this->db->f('contact_email',true);
+                               $ticket['address']                      = 
$this->db->f('address', true);
                                $ticket['tenant_id']            = 
$this->db->f('tenant_id');
                                $ticket['p_num']                        = 
$this->db->f('p_num');
                                $ticket['p_entity_id']          = 
$this->db->f('p_entity_id');
                                $ticket['p_cat_id']                     = 
$this->db->f('p_cat_id');
                                $ticket['finnish_date']         = 
$this->db->f('finnish_date');
                                $ticket['finnish_date2']        = 
$this->db->f('finnish_date2');
+                               $ticket['contact_id']           = 
$this->db->f('contact_id');
+                               $ticket['order_id']                     = 
$this->db->f('order_id');
+                               $ticket['vendor_id']            = 
$this->db->f('vendor_id');
+                               $ticket['b_account_id']         = 
$this->db->f('b_account_id');
+                               $ticket['order_descr']          = 
$this->db->f('order_descr', true);
+                               $ticket['ecodimb']                      = 
$this->db->f('ecodimb');
+                               $ticket['budget']                       = 
$this->db->f('budget');
+                               $ticket['actual_cost']          = 
$this->db->f('actual_cost');
 
                                $user_id=(int)$this->db->f('user_id');
                                $this->db->query("SELECT 
account_firstname,account_lastname FROM phpgw_accounts WHERE 
account_id='$user_id' ");
@@ -300,14 +377,15 @@
                function update_view($id='')
                {
                        // Have they viewed this ticket before ?
-                       $this->db->query("select count(*) from fm_tts_views 
where id='$id' "
-                                       . "and account_id='" . 
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
+                       $id = (int) $id;
+                       $this->db->query("SELECT count(*) FROM fm_tts_views 
where id={$id}"
+                                       . " AND account_id='" . 
$GLOBALS['phpgw_info']['user']['account_id'] . "'",__LINE__,__FILE__);
                        $this->db->next_record();
 
                        if (! $this->db->f(0))
                        {
-                               $this->db->query("insert into fm_tts_views 
(id,account_id,time) values ('$id','"
-                                       . 
$GLOBALS['phpgw_info']['user']['account_id'] . "','" . time() . 
"')",__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_tts_views 
(id,account_id,time) values ({$id},'"
+                                       . 
$GLOBALS['phpgw_info']['user']['account_id'] . "','" . 
phpgwapi_datetime::user_localtime() . "')",__LINE__,__FILE__);
                        }
                }
 
@@ -356,8 +434,9 @@
                                $address = 
$this->db->db_addslashes($ticket['location_name']);
                        }
 
-                       $values= array(
-                               $ticket['priority'],
+                       $values= array
+                       (
+                               
isset($ticket['priority'])?$ticket['priority']:0,
                                $GLOBALS['phpgw_info']['user']['account_id'],
                                $ticket['assignedto'],
                                $ticket['group_id'],
@@ -367,15 +446,17 @@
                                $this->db->db_addslashes($ticket['details']),
                                $ticket['location_code'],
                                $address,
-                               time(),
-                               $ticket['finnish_date']);
+                               phpgwapi_datetime::user_localtime(),
+                               $ticket['finnish_date'],
+                               $ticket['contact_id']
+                       );
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
                        $this->db->transaction_begin();
 
                        $this->db->query("insert into fm_tts_tickets 
(priority,user_id,"
                                . 
"assignedto,group_id,subject,cat_id,status,details,location_code,"
-                               . "address,entry_date,finnish_date $cols)"
+                               . "address,entry_date,finnish_date,contact_id 
$cols)"
                                . "VALUES ($values $vals )",__LINE__,__FILE__);
 
                        $id = 
$this->db->get_last_insert_id('fm_tts_tickets','id');
@@ -393,7 +474,7 @@
                                                'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$ticket['origin'][0]['location']),
                                                'location1_item_id' => 
$ticket['origin'][0]['data'][0]['id'],
                                                'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'),                 
-                                               'location2_item_id' => 
$ticket['project_id'],
+                                               'location2_item_id' => $id,
                                                'account_id'            => 
$this->account
                                        );
                                        
@@ -404,7 +485,7 @@
 
                        if($this->db->transaction_commit())
                        {
-                               $this->historylog->add('O',$id,mktime(),'');
+                               $this->historylog->add('O',$id, 
phpgwapi_datetime::user_localtime(),'');
                                if($ticket['finnish_date'])
                                {
                                        
$this->historylog->add('IF',$id,$ticket['finnish_date'],'');
@@ -439,4 +520,423 @@
                        }
                        return $status;
                }
+               function update_status($ticket,$id = 0)
+               {
+                       $id = (int) $id;
+                       $receipt = array();
+                       // DB Content is fresher than http posted value.
+                       $this->db->query("select * from fm_tts_tickets where 
id='$id'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $old_status             = $this->db->f('status');
+
+                       $this->db->transaction_begin();
+
+                       /*
+                       ** phpgw_fm_tts_append.append_type - Defs
+                       ** R - Reopen ticket
+                       ** X - Ticket closed
+                       ** O - Ticket opened
+                       ** C - Comment appended
+                       ** A - Ticket assignment
+                       ** G - Ticket group assignment
+                       ** P - Priority change
+                       ** T - Category change
+                       ** S - Subject change
+                       ** B - Budget
+                       ** H - Billing hours
+                       ** F - finnish date
+                       ** C% - Status changed
+                       ** L - Location changed
+                       ** M - Mail sent to vendor
+                       */
+
+                       if ($old_status != $ticket['status'])
+                       {
+                               $check_old_custom = (int) trim($old_status,'C');
+                               $this->db->query("SELECT * from fm_tts_status 
WHERE id = {$check_old_custom}",__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $this->fields_updated = true;
+                               if($old_status=='X' || $this->db->f('closed'))
+                               {
+                                       $new_status = $ticket['status'];
+                                       
$this->historylog->add('R',$id,$ticket['status'],$old_status);
+
+                                       $this->db->query("UPDATE fm_tts_tickets 
SET status='{$new_status}' WHERE id= {$id}",__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       
$this->historylog->add($ticket['status'],$id,$ticket['status'],$old_status);
+                                       $this->db->query("UPDATE fm_tts_tickets 
SET status='{$ticket['status']}' WHERE id={$id}",__LINE__,__FILE__);
+                               }
+                               $this->check_pending_action($ticket, $id);
+                       }
+
+                       $this->db->transaction_commit();
+
+                       if ($this->fields_updated)
+                       {
+                               $receipt['message'][]= array('msg' => 
lang('Ticket %1 has been updated',$id));
+                       }
+
+                       return $receipt;
+
+               }
+
+               function update_ticket($ticket,$id = 0)
+               {
+                       $id = (int) $id;
+                       $receipt = array();
+                       // DB Content is fresher than http posted value.
+                       $this->db->query("select * from fm_tts_tickets where 
id='$id'",__LINE__,__FILE__);
+                       $this->db->next_record();
+
+
+                       $location_code  = $this->db->f('location_code');
+                       $oldlocation_code       = $this->db->f('location_code');
+                       $oldfinnish_date        = $this->db->f('finnish_date');
+                       $oldfinnish_date2       = $this->db->f('finnish_date2');
+                       $oldassigned            = $this->db->f('assignedto');
+                       $oldgroup_id            = $this->db->f('group_id');
+                       $oldpriority            = $this->db->f('priority');
+                       $oldcat_id                      = 
$this->db->f('cat_id');
+                       $old_status             = $this->db->f('status');
+                       $old_budget             = $this->db->f('budget');
+               //      $old_billable_hours     = 
$this->db->f('billable_hours');
+               //      $old_billable_rate      = $this->db->f('billable_rate');
+                       $old_subject            = $this->db->f('subject');
+                       $old_contact_id         = $this->db->f('contact_id');
+                       if($oldcat_id ==0){$oldcat_id ='';}
+                       if($oldassigned ==0){$oldassigned ='';}
+                       if($oldgroup_id ==0){$oldgroup_id ='';}
+
+                       // Figure out and last note
+
+                       $history_values = 
$this->historylog->return_array(array(),array('C'),'history_timestamp','DESC',$id);
+                       $old_note = $history_values[0]['new_value'];
+
+                       if(!$old_note)
+                       {
+                               $old_note = $this->db->f('details');
+                       }
+
+
+                       $this->db->transaction_begin();
+
+                       /*
+                       ** phpgw_fm_tts_append.append_type - Defs
+                       ** R - Reopen ticket
+                       ** X - Ticket closed
+                       ** O - Ticket opened
+                       ** C - Comment appended
+                       ** A - Ticket assignment
+                       ** G - Ticket group assignment
+                       ** P - Priority change
+                       ** T - Category change
+                       ** S - Subject change
+                       ** B - Budget change
+                       ** H - Billing hours
+                       ** F - finnish date
+                       ** C% - Status change
+                       ** L - Location changed
+                       ** M - Mail sent to vendor
+                       */
+
+                       $finnish_date   = (isset($ticket['finnish_date']) ? 
phpgwapi_datetime::date_to_timestamp($ticket['finnish_date']):'');
+
+                       if ($oldfinnish_date && isset($ticket['finnish_date']) 
&& $ticket['finnish_date']):
+                       {
+                               $this->db->query("update fm_tts_tickets set 
finnish_date2='" . $finnish_date
+                                       . "' where id='$id'",__LINE__,__FILE__);
+                       }
+                       elseif(!$oldfinnish_date && 
isset($ticket['finnish_date']) && $ticket['finnish_date']):
+                       {
+                               $this->db->query("update fm_tts_tickets set 
finnish_date='" . $finnish_date
+                                       . "' where id='$id'",__LINE__,__FILE__);
+                       }
+                       endif;
+
+                       if($oldfinnish_date2>0)
+                       {
+                               $oldfinnish_date = $oldfinnish_date2;
+                       }
+                       if(isset($ticket['finnish_date']) && 
$ticket['finnish_date'])
+                       {
+                               if ($oldfinnish_date != $finnish_date)
+                               {
+                                       $this->fields_updated = true;
+                                       
$this->historylog->add('F',$id,$finnish_date,$oldfinnish_date);
+                               }
+                       }
+
+                       if (isset($ticket['status']) && ($old_status != 
$ticket['status']))
+                       {
+                               $check_old_custom = (int) trim($old_status,'C');
+                               $this->db->query("SELECT * from fm_tts_status 
WHERE id = {$check_old_custom}",__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $this->fields_updated = true;
+                               if($old_status=='X' || $this->db->f('closed'))
+                               {
+                                       $new_status = $ticket['status'];
+                                       
$this->historylog->add('R',$id,$ticket['status'],$old_status);
+
+                                       $this->db->query("UPDATE fm_tts_tickets 
SET status='{$new_status}' WHERE id= {$id}",__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       
$this->historylog->add($ticket['status'],$id,$ticket['status'],$old_status);
+                                       $this->db->query("UPDATE fm_tts_tickets 
SET status='{$ticket['status']}' WHERE id={$id}",__LINE__,__FILE__);
+                               }
+                               $this->check_pending_action($ticket, $id);
+                       }
+
+                       if (($oldassigned != $ticket['assignedto']) && 
$ticket['assignedto'] != 'ignore')
+                       {
+                               $this->fields_updated = true;
+
+                               $value_set=array('assignedto'   => 
$ticket['assignedto']);
+                               $value_set      = 
$this->db->validate_update($value_set);
+
+                               $this->db->query("update fm_tts_tickets set 
$value_set where id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('A',$id,$ticket['assignedto'],$oldassigned);
+                       }
+
+                       if (($oldgroup_id != $ticket['group_id']) && 
$ticket['group_id'] != 'ignore')
+                       {
+                               $this->fields_updated = true;
+
+                               $value_set=array('group_id'     => 
$ticket['group_id']);
+                               $value_set      = 
$this->db->validate_update($value_set);
+
+                               $this->db->query("update fm_tts_tickets set 
$value_set where id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('G',$id,$ticket['group_id'],$oldgroup_id);
+                       }
+
+                       if ($oldpriority != $ticket['priority'])
+                       {
+                               $this->fields_updated = true;
+                               $this->db->query("update fm_tts_tickets set 
priority='" . $ticket['priority']
+                                       . "' where id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('P',$id,$ticket['priority'],$oldpriority);
+                       }
+
+                       if ($old_contact_id != $ticket['contact_id'])
+                       {
+                               $contact_id  = (int) $ticket['contact_id'];
+                               $this->fields_updated = true;
+                               $this->db->query("update fm_tts_tickets set 
contact_id={$contact_id} WHERE id=$id",__LINE__,__FILE__);
+                       }
+
+                       if (($oldcat_id != $ticket['cat_id']) && 
$ticket['cat_id'] != 'ignore')
+                       {
+                               $this->fields_updated = true;
+                               $this->db->query("update fm_tts_tickets set 
cat_id='" . $ticket['cat_id']
+                                       . "' where id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('T',$id,$ticket['cat_id'],$oldcat_id);
+                       }
+
+                       if ($old_budget != $ticket['budget'])
+                       {
+                               $this->fields_updated = true;
+                               $this->db->query("UPDATE fm_tts_tickets set 
budget='" . (int)$ticket['budget']
+                                       . "' where id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('B',$id,$ticket['budget'],$old_budget);
+                       }
+       /*
+                       if ($old_billable_rate != $ticket['billable_rate'])
+                       {
+                               $this->fields_updated = true;
+                               $this->db->query("update fm_tts_tickets set 
billable_rate='" . $ticket['billable_rate']
+                                       . "' where id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('B',$id,$ticket['billable_rate'],$old_billable_rate);
+                       }
+       */
+                       if ($old_subject != $ticket['subject'])
+                       {
+                               $this->db->query("update fm_tts_tickets set 
subject='" . $ticket['subject']
+                                       . "' where id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('S',$id,$ticket['subject'],$old_subject);
+                               $receipt['message'][]= array('msg' => 
lang('Subject has been updated'));
+                       }
+
+                       if (($old_note != $ticket['note']) && $ticket['note'])
+                       {
+                               $this->fields_updated = true;
+                               
$this->historylog->add('C',$id,$ticket['note'],$old_note);
+                       }
+
+                       if(isset($ticket['location']) && $ticket['location'])
+                       {
+                               $ticket['location_code'] = implode('-', 
$ticket['location']);
+                       }
+
+                       if (isset($ticket['location_code']) && 
$ticket['location_code'] && ($oldlocation_code != $ticket['location_code']))
+                       {
+                               $interlink      = 
CreateObject('property.interlink');
+                               if( $interlink->get_relation('property', 
'.ticket', $id, 'origin') || $interlink->get_relation('property', '.ticket', 
$id, 'target'))
+                               {
+                                       $receipt['message'][]= array('msg' => 
lang('location could not be changed'));
+                               }
+                               else
+                               {
+                                       $value_set      = array();
+
+                                       if(isset($ticket['street_name']) && 
$ticket['street_name'])
+                                       {
+                                               $address[]= 
$ticket['street_name'];
+                                               $address[]= 
$ticket['street_number'];
+                                               $value_set['address'] = 
$this->db->db_addslashes(implode(" ", $address));
+                                       }
+
+                                       if(!isset($address) || !$address)
+                                       {
+                                               $address = 
isset($ticket['location_name']) ? 
$this->db->db_addslashes($ticket['location_name']) : '';
+                                               if($address)
+                                               {
+                                                       $value_set['address'] = 
$address;
+                                               }
+                                       }
+
+                                       if (isset($ticket['location_code']) && 
$ticket['location_code'])
+                                       {
+                                               $value_set['location_code'] = 
$ticket['location_code'];
+                                       }
+
+                                       $admin_location = 
CreateObject('property.soadmin_location');
+                                       $admin_location->read(false);
+
+                               // Delete old values for location - in case of 
moving up in the hierarchy
+                                       $metadata = 
$this->db->metadata('fm_tts_tickets');
+                                       for ($i = 1;$i < 
$admin_location->total_records + 1; $i++)
+                                       {
+                                               if(isset($metadata["loc{$i}"]))
+                                               {
+                                                       $value_set["loc{$i}"]   
= false;
+                                               }
+                                       }
+
+                                       if(isset($ticket['location']) && 
is_array($ticket['location']))
+                                       {
+                                               foreach ($ticket['location'] as 
$column => $value)
+                                               {
+                                                       $value_set[$column]     
= $value;
+                                               }
+                                       }
+
+                                       if(isset($ticket['extra']) && 
is_array($ticket['extra']))
+                                       {
+                                               foreach ($ticket['extra'] as 
$column => $value)
+                                               {
+                                                       $value_set[$column]     
= $value;
+                                               }
+                                       }
+
+                                       $value_set      = 
$this->db->validate_update($value_set);
+
+                                       $this->db->query("UPDATE fm_tts_tickets 
SET $value_set WHERE id={$id}",__LINE__,__FILE__);
+
+                                       
$this->historylog->add('L',$id,$ticket['location_code'],$oldlocation_code);
+                                       $receipt['message'][]= array('msg' => 
lang('Location has been updated'));
+                               }
+                               unset($interlink);
+                       }
+
+
+                       if(isset($ticket['make_order']) && 
$ticket['make_order'])
+                       {
+                               $order_id = 
execMethod('property.socommon.increment_id', 'order');
+                               if($order_id)
+                               {
+                                       $this->db->query("UPDATE fm_tts_tickets 
SET order_id = {$order_id} WHERE id={$id}",__LINE__,__FILE__);
+                               }
+                       }
+
+                       $value_set                                      = 
array();
+                       $value_set['vendor_id']         = $ticket['vendor_id'];
+                       $value_set['b_account_id']      = 
$ticket['b_account_id'];
+                       $value_set['order_descr']       = 
$this->db->db_addslashes($ticket['order_descr']);
+                       $value_set['ecodimb']           = $ticket['ecodimb'];
+                       $value_set['budget']            = $ticket['budget'];
+                       $value_set                                      = 
$this->db->validate_update($value_set);
+                       $this->db->query("UPDATE fm_tts_tickets SET $value_set 
WHERE id={$id}",__LINE__,__FILE__);
+
+                       $this->db->transaction_commit();
+
+                       if (isset($this->fields_updated))
+                       {
+                               $receipt['message'][]= array('msg' => 
lang('Ticket has been updated'));
+
+                               $criteria = array
+                               (
+                                       'appname'       => 'property',
+                                       'location'      => $this->acl_location,
+                                       'allrows'       => true
+                               );
+
+                               $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+                               foreach ( $custom_functions as $entry )
+                               {
+                                       // prevent path traversal
+                                       if ( preg_match('/\.\./', 
$entry['file_name']) )
+                                       {
+                                               continue;
+                                       }
+
+                                       $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+                                       if ( $entry['active'] && is_file($file) 
)
+                                       {
+                                               require_once $file;
+                                       }
+                               }
+                       }
+                       return $receipt;
+               }
+
+               function check_pending_action($ticket,$id)
+               {
+                       $status = (int)trim($ticket['status'], 'C');
+                       $this->db->query("SELECT * FROM fm_tts_status WHERE id 
= '{$status}'");
+
+                       $this->db->next_record();
+
+                       if ($this->db->f('approved') )
+                       {
+                               $action_params = array
+                               (
+                                       'appname'                       => 
'property',
+                                       'location'                      => 
'.ticket',
+                                       'id'                            => $id,
+                                       'responsible'           => 
$this->account,
+                                       'responsible_type'  => 'user',
+                                       'action'                        => 
'approval',
+                                       'remark'                        => '',
+                                       'deadline'                      => ''
+                               );
+
+                               
execMethod('property.sopending_action.close_pending_action', $action_params);
+                               unset($action_params);
+                       }
+                       if ($this->db->f('in_progress') )
+                       {
+                               $action_params = array
+                               (
+                                       'appname'                       => 
'property',
+                                       'location'                      => 
'.ticket',
+                                       'id'                            => $id,
+                                       'responsible'           => 
$ticket['vendor_id'],
+                                       'responsible_type'  => 'vendor',
+                                       'action'                        => 
'remind',
+                                       'remark'                        => '',
+                                       'deadline'                      => ''
+                               );
+
+                               
execMethod('property.sopending_action.close_pending_action', $action_params);
+                               unset($action_params);
+                       }
+
+                       if ($this->db->f('delivered') )
+                       {
+                               //close
+                       }
+               }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.sowo_hour.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sowo_hour.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.sowo_hour.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -34,23 +34,22 @@
 
        class property_sowo_hour
        {
-               function property_sowo_hour()
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->bocommon = CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
 
-                       $this->join             = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like             = $this->bocommon->like;
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+                       $this->db2                      = clone($this->db);
+                       $this->like             = & $this->db->like;
+                       $this->join             = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
                }
 
                function get_chapter_list()
                {
                        $this->db->query("SELECT id, descr FROM fm_chapter 
ORDER BY id ");
 
+                       $chapter_entries = array();
                        $i = 0;
                        while ($this->db->next_record())
                        {
@@ -234,7 +233,7 @@
                                time()
                                );
 
-                       $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                       $values_insert  = 
$this->db->validate_insert($values_insert);
 
                        $this->db->query("INSERT INTO fm_wo_h_deviation 
(workorder_id,hour_id,id,amount,descr,entry_date) VALUES 
($values_insert)",__LINE__,__FILE__);
 
@@ -253,7 +252,7 @@
                                'descr'                 => 
$this->db->db_addslashes($values['descr'])
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE fm_wo_h_deviation set 
$value_set WHERE workorder_id=" . $values['workorder_id'] . " AND hour_id=" . 
$values['hour_id'] . " AND id=" . $values['id'],__LINE__,__FILE__);
 
@@ -299,7 +298,7 @@
                                time()
                                 );
 
-                       $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                       $values_insert  = 
$this->db->validate_insert($values_insert);
 
                        $this->db->query("insert into fm_template 
(owner,name,descr,chapter_id,entry_date) "
                                . " values ($values_insert)",__LINE__,__FILE__);
@@ -333,7 +332,7 @@
                                        $record,
                                        $template_id );
 
-                               $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
+                               $values_insert  = 
$this->db->validate_insert($values_insert);
 
                                $this->db->query("insert into fm_template_hours 
(activity_id,activity_num,owner,hours_descr,unit,"
                                . 
"cost,quantity,billperae,ns3420_id,dim_d,grouping_id,grouping_descr,remark,tolerance,building_part,record,template_id)
 "
@@ -362,7 +361,7 @@
                                        $hour[$i]['hours_descr'],
                                        $hour[$i]['unit'],
                                        $hour[$i]['cost'],
-                                       $hour[$i]['quantity'],
+                                       (int)$hour[$i]['quantity'],
                                        $hour[$i]['billperae'],
                                        $hour[$i]['ns3420_id'],
                                        $hour[$i]['dim_d'],
@@ -373,7 +372,7 @@
                                        $hour[$i]['cat_per_cent']
                                        );
 
-                               $values = 
$this->bocommon->validate_db_insert($values);
+                               $values = $this->db->validate_insert($values);
 
                                $this->db->query("insert into fm_wo_hours 
(activity_id,activity_num,owner,hours_descr,unit,cost,quantity,billperae,ns3420_id,dim_d,record,entry_date,workorder_id,category,cat_per_cent)
 "
                                . " values ($values)",__LINE__,__FILE__);
@@ -443,7 +442,7 @@
                                        $hour[$i]['cat_per_cent']
                                        );
 
-                               $values = 
$this->bocommon->validate_db_insert($values);
+                               $values = $this->db->validate_insert($values);
 
                                $this->db->query("insert into fm_wo_hours 
(owner,activity_id,activity_num,hours_descr,unit,cost,quantity,billperae,ns3420_id,dim_d,"
                                . " 
grouping_id,grouping_descr,record,building_part,tolerance,remark,entry_date,workorder_id,category,cat_per_cent)
 "
@@ -520,7 +519,7 @@
                                        $hour['cat_per_cent']
                                        );
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
                        $this->db->query("insert into fm_wo_hours 
(owner,hours_descr,unit,cost,quantity,billperae,ns3420_id,dim_d,"
                                . " 
grouping_id,grouping_descr,record,building_part,tolerance,remark,entry_date,workorder_id,category,cat_per_cent)
 "
@@ -661,7 +660,7 @@
                                'cat_per_cent'          => $hour['cat_per_cent']
                                );
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $this->db->query("UPDATE fm_wo_hours set $value_set 
WHERE id= '" . $hour['hour_id'] ."'",__LINE__,__FILE__);
 
@@ -680,11 +679,12 @@
                        $this->db->query("UPDATE fm_vendor set email 
='$to_email' where  id= '$vendor_id'",__LINE__,__FILE__);
                }
 
-               function get_email($vendor_id)
+               function get_email($vendor_id = 0)
                {
                        $vendor_id=(int)$vendor_id;
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.vendor');
                        $this->db->query("select column_name from 
phpgw_cust_attribute WHERE location_id = {$location_id} AND 
datatype='email'",__LINE__,__FILE__);
+                       $email_list = array();
                        while ($this->db->next_record())
                        {
                                $this->db2->query("select " . 
$this->db->f('column_name') . " from fm_vendor where 
id=$vendor_id",__LINE__,__FILE__);
@@ -742,8 +742,8 @@
 
                        if($calculation > 0)
                        {
-                               $config         = 
CreateObject('phpgwapi.config');
-                               $config->read_repository();
+                               $config         = 
CreateObject('phpgwapi.config','property');
+                               $config->read();
                                $tax = 1+(($config->config_data['fm_tax'])/100);
                                $calculation = $calculation * $tax;
 

Modified: people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.soworkorder.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -35,19 +35,18 @@
        class property_soworkorder
        {
 
-               function property_soworkorder()
+               var $total_records = 0;
+
+               function __construct()
                {
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->db               = $this->bocommon->new_db();
-                       $this->db2              = 
$this->bocommon->new_db($this->db);
-                       $this->join                     = $this->bocommon->join;
-
-                       $this->left_join        = $this->bocommon->left_join;
-
-                       $this->like                     = $this->bocommon->like;
-
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+                       $this->db2                      = clone($this->db);
+                       $this->like             = & $this->db->like;
+                       $this->join             = & $this->db->join;
+                       $this->left_join        = & $this->db->left_join;
+                       $this->interlink        = 
CreateObject('property.interlink');
                //      $this->grants           = 
$GLOBALS['phpgw']->session->appsession('grants_project','property');
                //      if(!$this->grants)
                        {
@@ -128,37 +127,39 @@
                        if(is_array($data))
                        {
                                $start                  = isset($data['start']) 
&& $data['start'] ? $data['start'] : 0;
-                               $filter                 = $data['filter'] ? 
$data['filter'] : 'all';
+                               $filter                 = $data['filter'] ? 
(int)$data['filter'] : 0;
                                $query                  = isset($data['query']) 
? $data['query'] : '';
                                $sort                   = isset($data['sort']) 
&& $data['sort'] ? $data['sort'] : 'DESC';
                                $order                  = isset($data['order']) 
? $data['order'] : '';
                                $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? $data['cat_id'] : 0;
                                $status_id              = 
isset($data['status_id']) && $data['status_id'] ? $data['status_id'] : 0;
-                               $search_vendor  = isset($data['search_vendor']) 
? $data['search_vendor'] : '';
                                $start_date             = 
isset($data['start_date']) ? $data['start_date'] : '';
                                $end_date               = 
isset($data['end_date']) ? $data['end_date'] : '';
                                $allrows                = 
isset($data['allrows']) ? $data['allrows'] : '';
                                $wo_hour_cat_id = 
isset($data['wo_hour_cat_id']) ? $data['wo_hour_cat_id'] : '';
                                $b_group                = 
isset($data['b_group']) ? $data['b_group'] : '';
                                $paid                   = isset($data['paid']) 
? $data['paid'] : '';
+                               $b_account              = 
isset($data['b_account']) ? $data['b_account'] : '';
+                               $district_id    = isset($data['district_id']) ? 
$data['district_id'] : '';
+                               $dry_run                = 
isset($data['dry_run']) ? $data['dry_run'] : '';
+                               $criteria               = 
isset($data['criteria']) && $data['criteria'] ? $data['criteria'] : array();
                        }
 
-
+                       $GLOBALS['phpgw']->config->read();
                        $sql = 
$this->bocommon->fm_cache('sql_workorder'.!!$search_vendor . '_' . 
!!$wo_hour_cat_id . '_' . !!$b_group);
 //echo $sql;
                        if(!$sql)
                        {
                                $entity_table = 'fm_project';
 
-                               $cols .= $entity_table . '.location_code';
-                               $cols_return[] = 'location_code';
-
-                               $cols .= ",$entity_table.id as project_id";
+                               $cols = "$entity_table.id as project_id";
                                $cols_return[]                          = 
'project_id';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'project_id';
                                $uicols['descr'][]                      = 
lang('Project');
                                $uicols['statustext'][]         = lang('Project 
ID');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols .= ",fm_workorder.id as workorder_id";
                                $cols_return[]                          = 
'workorder_id';
@@ -166,6 +167,8 @@
                                $uicols['name'][]                       = 
'workorder_id';
                                $uicols['descr'][]                      = 
lang('Workorder');
                                $uicols['statustext'][]         = 
lang('Workorder ID');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols .= ",fm_workorder.title as title";
                                $cols_return[]                          = 
'title';
@@ -173,6 +176,8 @@
                                $uicols['name'][]                       = 
'title';
                                $uicols['descr'][]                      = 
lang('Title');
                                $uicols['statustext'][]         = 
lang('Workorder title');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols .= ",fm_workorder.status as status";
                                $cols_return[]                          = 
'status';
@@ -180,6 +185,8 @@
                                $uicols['name'][]                       = 
'status';
                                $uicols['descr'][]                      = 
lang('Status');
                                $uicols['statustext'][]         = 
lang('Workorder status');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols .= ",fm_workorder.entry_date as 
entry_date";
                                $cols_return[]                          = 
'entry_date';
@@ -187,6 +194,8 @@
                                $uicols['name'][]                       = 
'entry_date';
                                $uicols['descr'][]                      = 
lang('Entry date');
                                $uicols['statustext'][]         = 
lang('Workorder entry date');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols .= ",phpgw_accounts.account_lid as 
user_lid";
                                $cols_return[]                          = 
'user_lid';
@@ -194,6 +203,8 @@
                                $uicols['name'][]                       = 
'user_lid';
                                $uicols['descr'][]                      = 
lang('User');
                                $uicols['statustext'][]         = 
lang('Workorder User');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols .= ',fm_workorder.vendor_id';
                                $cols_return[] = 'vendor_id';
@@ -201,7 +212,19 @@
                                $uicols['name'][]                       = 
'vendor_id';
                                $uicols['descr'][]                      = 
lang('Vendor ID');
                                $uicols['statustext'][]         = lang('Vendor 
ID');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
+                               $cols.= ",loc1_name";
+                               $cols_return[]                          = 
'loc1_name';
+                               $uicols['input_type'][]         = 'hidden';
+                               $uicols['name'][]                       = 
'loc1_name';
+                               $uicols['descr'][]                      = '';
+                               $uicols['statustext'][]         = '';
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
+
+
                                $cols .= ",fm_project.user_id as project_owner";
 
                                $joinmethod .= " $this->join  fm_workorder ON 
($entity_table.id = fm_workorder.project_id) $this->join  phpgw_accounts ON 
(fm_workorder.user_id = phpgw_accounts.account_id))";
@@ -213,6 +236,8 @@
                                $uicols['name'][]                       = 
'org_name';
                                $uicols['descr'][]                      = 
lang('Vendor name');
                                $uicols['statustext'][]         = lang('Vendor 
name');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
 
                                $cols .= ',fm_workorder.combined_cost';
                                $cols_return[] = 'combined_cost';
@@ -220,6 +245,8 @@
                                $uicols['name'][]                       = 
'combined_cost';
                                $uicols['descr'][]                      = 
lang('Cost');
                                $uicols['statustext'][]         = lang('Cost - 
either budget or calculation');
+                               $uicols['formatter'][]          = 
'myFormatCount2';
+                               $uicols['classname'][]          = 'rightClasss';
 
                                $cols .= ',fm_workorder.act_mtrl_cost + 
fm_workorder.act_vendor_cost as actual_cost';
                                $cols_return[] = 'actual_cost';
@@ -227,6 +254,8 @@
                                $uicols['name'][]                       = 
'actual_cost';
                                $uicols['descr'][]                      = 
lang('Actual cost');
                                $uicols['statustext'][]         = lang('Actual 
cost - paid so far');
+                               $uicols['formatter'][]          = 
'myFormatCount2';
+                               $uicols['classname'][]          = 'rightClasss';
 
                                $joinmethod .= " $this->left_join  fm_vendor ON 
(fm_workorder.vendor_id = fm_vendor.id))";
                                $paranthesis .='(';
@@ -256,8 +285,30 @@
                                //----- b_group
 
 
+                       $cols_return[] = 'location_code';
+                       $no_address = false;
+                       
if(isset($GLOBALS['phpgw']->config->config_data['location_at_workorder']) && 
$GLOBALS['phpgw']->config->config_data['location_at_workorder'])
+                       {
+                               $no_address = true;
+                               $cols .= ',fm_workorder.location_code';
+                               $cols .= ',fm_workorder.address';
+                               $cols_return[]                          = 
'address';
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'address';
+                               $uicols['descr'][]                      = 
lang('address');
+                               $uicols['statustext'][]         = 
lang('address');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                       }
+                       else
+                       {
+                               $cols .= ",{$entity_table}.location_code";
+                       }
+
                                $sql    = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
-                                                                       
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,'force_location'=>true));
+                                                                       
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,
+                                                                       
'force_location'=>true, 'no_address' => $no_address));
 
                                
$this->bocommon->fm_cache('sql_workorder'.!!$search_vendor . '_' . 
!!$wo_hour_cat_id . '_' . !!$b_group,$sql);
 
@@ -280,6 +331,17 @@
 //                             $this->cols_extra       = 
$this->bocommon->fm_cache('cols_extra_workorder'.!!$search_vendor . '_' . 
!!$wo_hour_cat_id . '_' . !!$b_group);
                        }
 
+                       if($dry_run)
+                       {
+                               return array();
+                       }
+
+                       $location_table = 'fm_project';
+                       
if(isset($GLOBALS['phpgw']->config->config_data['location_at_workorder']) && 
$GLOBALS['phpgw']->config->config_data['location_at_workorder'])
+                       {
+                               $location_table = 'fm_workorder';
+                       }
+
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
@@ -293,7 +355,7 @@
 
                        $filtermethod = '';
 
-                       $GLOBALS['phpgw']->config->read_repository();
+
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_location']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_location'])
                        {
                                $access_location = 
$this->bocommon->get_location_list(PHPGW_ACL_READ);
@@ -318,7 +380,7 @@
                        {
                                $filtermethod .= " $where 
fm_wo_hours_category.id=$wo_hour_cat_id ";
                                $where= 'AND';
-                               $group_method = " group by 
fm_project.id,fm_project.location_code,fm_workorder.id,workorder_id,title,fm_workorder.status,fm_workorder.entry_date,user_lid,fm_workorder.vendor_id,project_owner,fm_project.address,fm_vendor.org_name,fm_workorder.combined_cost,fm_workorder.act_mtrl_cost,fm_workorder.act_vendor_cost";
+                               $group_method = " group by 
fm_project.id,{$location_table}.location_code,fm_workorder.id,workorder_id,title,fm_workorder.status,fm_workorder.entry_date,user_lid,fm_workorder.vendor_id,project_owner,{$location_table}.address,fm_vendor.org_name,fm_workorder.combined_cost,fm_workorder.act_mtrl_cost,fm_workorder.act_vendor_cost";
                        }
 
                        if ($b_group)
@@ -334,8 +396,18 @@
                                $where= 'AND';
                        }
 
-                       if ($filter=='all')
+                       if ($b_account)
                        {
+                               $filtermethod .= " {$where} 
fm_workorder.account_id = '{$b_account}'";
+                               $where= 'AND';
+                       }
+
+                       if ($district_id)
+                       {
+                               $filtermethod .= " {$where} district_id = 
{$district_id}";
+                               $where= 'AND';
+                       }
+
                                if (is_array($this->grants))
                                {
                                        $grants = $this->grants;
@@ -344,13 +416,13 @@
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
-                                       $filtermethod .= " $where 
(fm_project.access='public' AND fm_project.user_id IN(" . 
implode(',',$public_user_list) . "))";
+                               $filtermethod .= " $where 
(fm_project.access='public' AND fm_project.user_id IN(" . 
implode(',',$public_user_list) . ")";
                                        $where= 'AND';
                                }
-                       }
-                       else
+
+                       if ($filter)
                        {
-                               $filtermethod .= " $where 
fm_workorder.user_id=$filter ";
+                               $filtermethod .= " $where 
fm_workorder.user_id={$filter}";
                                $where= 'AND';
                        }
 
@@ -368,37 +440,64 @@
                                if(stristr($query, '.'))
                                {
                                        $query=explode(".",$query);
-                                       $querymethod = " $where 
(fm_project.loc1='" . $query[0] . "' AND fm_project.loc".$type_id."='" . 
$query[1] . "')";
+                                       $querymethod = " $where 
({$location_table}.location_code $this->like '{$query[0]}%' AND 
{$location_table}.location_code $this->like '%{$query[1]}')";
                                }
                                else
                                {
-                                       $querymethod = " $where 
(fm_workorder.title $this->like '%$query%' or fm_workorder.descr $this->like 
'%$query%' or fm_project.address $this->like '%$query%' or 
fm_project.location_code $this->like '%$query%' or fm_workorder.id =" . 
(int)$query . ')';
+                                       $matchtypes = array
+                                       (
+                                               'exact' => '=',
+                                               'like'  => $this->like
+                                       );
+
+                                       if(count($criteria) > 1)
+                                       {
+                                               $_querymethod = array();
+                                               foreach($criteria as 
$field_info)
+                                               {
+                                                       if($field_info['type'] 
== int)
+                                                       {
+                                                               $_query = (int) 
$query;
                                }
-                               $where= 'AND';
+                                                       else
+                                                       {
+                                                               $_query = 
$query;
+                                                       }
+
+                                                       $_querymethod[] = 
"{$field_info['field']} {$matchtypes[$field_info['matchtype']]} 
{$field_info['front']}{$_query}{$field_info['back']}";
                        }
 
-                       $querymethod_vendor = '';
-                       if($search_vendor)
+                                               $querymethod = $where . ' ' . 
implode(' OR ', $_querymethod);
+                                               unset($_querymethod);
+                                       }
+                                       else
                        {
-                               if((int)$search_vendor>0)
+                                               if($criteria[0]['type'] == int)
                                {
-                                       $querymethod_vendor = " $where 
fm_workorder.vendor_id=" .(int)$search_vendor ;
+                                                       $_query = (int) $query;
                                }
                                else
                                {
-                                       $querymethod_vendor = " $where  
fm_vendor.org_name $this->like '%$search_vendor%'";
+                                                       $_query = $query;
                                }
+
+                                               $querymethod = "{$where} 
{$criteria[0]['field']} {$matchtypes[$criteria[0]['matchtype']]} 
{$criteria[0]['front']}{$_query}{$criteria[0]['back']}";
                        }
 
-                       $sql .= " $filtermethod $querymethod 
$querymethod_vendor";
-//echo $sql;
+                               }
+                               $where= 'AND';
+                       }
+                       $querymethod .= ')';
 
+                       $sql .= " $filtermethod $querymethod";
+
+//_debug_array($sql);
                        
if($GLOBALS['phpgw_info']['server']['db_type']=='postgres')
                        {
                                $sql2 = 'SELECT count(*) FROM (SELECT 
fm_workorder.id ' . substr($sql,strripos($sql,'from'))  . ') as cnt';
                                $this->db->query($sql2,__LINE__,__FILE__);
                                $this->db->next_record();
-                               $this->total_records = $this->db->f(0);
+                               $this->total_records = 
$this->db->f('count');//$this->db->f('0');
                        }
                        else
                        {
@@ -409,6 +508,8 @@
 
                        $sql .= " $group_method";
 
+                       //address@hidden 23/10/08 avoid retrieve data in first 
time, only render definition for headers (var myColumnDefs)
+
                        if(!$allrows)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -444,43 +545,59 @@
                        return $workorder_list;
                }
 
-               function read_single($workorder_id)
+               function read_single($workorder_id = 0)
                {
+               //      $this->update_actual_cost_global();
+               //      $this->update_planned_cost_global();
+
                        $sql = "SELECT fm_workorder.*, fm_chapter.descr as 
chapter ,fm_project.user_id from fm_workorder $this->join fm_project on 
fm_workorder.project_id=fm_project.id  $this->left_join fm_chapter on "
-                               . " fm_workorder.chapter_id = fm_chapter.id 
where fm_workorder.id=$workorder_id";
+                               . " fm_workorder.chapter_id = fm_chapter.id 
where fm_workorder.id={$workorder_id}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $workorder = array();
                        if ($this->db->next_record())
                        {
-                               $workorder['workorder_id']              = 
$this->db->f('id');
-                               $workorder['project_id']                = 
$this->db->f('project_id');
-                               $workorder['title']                             
= $this->db->f('title');
-                               $workorder['name']                              
= $this->db->f('name');
-                               $workorder['key_fetch']                 = 
$this->db->f('key_fetch');
-                               $workorder['key_deliver']               = 
$this->db->f('key_deliver');
-                               $workorder['key_responsible']   = 
$this->db->f('key_responsible');
-                               $workorder['charge_tenant']             = 
$this->db->f('charge_tenant');
-                               $workorder['descr']                             
= stripslashes($this->db->f('descr'));
-                               $workorder['status']                    = 
$this->db->f('status');
-                               $workorder['budget']                    = 
(int)$this->db->f('budget');
-                               $workorder['calculation']                       
= 
$this->db->f('calculation')>0?($this->db->f('calculation')*(1+$this->db->f('addition')/100))+$this->db->f('rig_addition'):0;
-                               $workorder['b_account_id']                      
= (int)$this->db->f('account_id');
-                               $workorder['addition_percentage']       = 
(int)$this->db->f('addition');
-                               $workorder['addition_rs']                       
= (int)$this->db->f('rig_addition');
-                               $workorder['act_mtrl_cost']                     
= $this->db->f('act_mtrl_cost');
-                               $workorder['act_vendor_cost']           = 
$this->db->f('act_vendor_cost');
-                               $workorder['user_id']                           
= $this->db->f('user_id');
-                               $workorder['vendor_id']                 = 
$this->db->f('vendor_id');
-                               $workorder['coordinator']               = 
$this->db->f('coordinator');
-                               $workorder['access']                    = 
$this->db->f('access');
-                               $workorder['start_date']                = 
$this->db->f('start_date');
-                               $workorder['end_date']                  = 
$this->db->f('end_date');
-                               $workorder['cat_id']                    = 
$this->db->f('category');
-                               $workorder['chapter_id']                = 
$this->db->f('chapter_id');
-                               $workorder['chapter']                   = 
$this->db->f('chapter');
-                               $workorder['deviation']                 = 
$this->db->f('deviation');
-                               $workorder['grants']                            
= (int)$this->grants[$this->db->f('user_id')];
+                               $workorder = array
+                               (
+                                       'id'                                    
=> $this->db->f('id'),
+                                       'workorder_id'                  => 
$this->db->f('id'), // FIXME
+                                       'project_id'                    => 
$this->db->f('project_id'),
+                                       'title'                                 
=> $this->db->f('title'),
+                                       'name'                                  
=> $this->db->f('name'),
+                                       'key_fetch'                             
=> $this->db->f('key_fetch'),
+                                       'key_deliver'                   => 
$this->db->f('key_deliver'),
+                                       'key_responsible'               => 
$this->db->f('key_responsible'),
+                                       'charge_tenant'                 => 
$this->db->f('charge_tenant'),
+                                       'descr'                                 
=> stripslashes($this->db->f('descr')),
+                                       'status'                                
=> $this->db->f('status'),
+                                       'budget'                                
=> (int)$this->db->f('budget'),
+                                       'calculation'                   => 
$this->db->f('calculation'),
+                                       'b_account_id'                  => 
(int)$this->db->f('account_id'),
+                                       'addition_percentage'   => 
(int)$this->db->f('addition'),
+                                       'addition_rs'                   => 
(int)$this->db->f('rig_addition'),
+                                       'act_mtrl_cost'                 => 
$this->db->f('act_mtrl_cost'),
+                                       'act_vendor_cost'               => 
$this->db->f('act_vendor_cost'),
+                                       'user_id'                               
=> $this->db->f('user_id'),
+                                       'vendor_id'                             
=> $this->db->f('vendor_id'),
+                                       'coordinator'                   => 
$this->db->f('coordinator'),
+                                       'access'                                
=> $this->db->f('access'),
+                                       'start_date'                    => 
$this->db->f('start_date'),
+                                       'end_date'                              
=> $this->db->f('end_date'),
+                                       'cat_id'                                
=> $this->db->f('category'),
+                                       'chapter_id'                    => 
$this->db->f('chapter_id'),
+                                       'chapter'                               
=> $this->db->f('chapter'),
+                                       'deviation'                             
=> $this->db->f('deviation'),
+                                       'ecodimb'                               
=> $this->db->f('ecodimb'),
+                                       'location_code'                 => 
$this->db->f('location_code'),
+                                       'p_num'                                 
=> $this->db->f('p_num'),
+                                       'p_entity_id'                   => 
$this->db->f('p_entity_id'),
+                                       'p_cat_id'                              
=> $this->db->f('p_cat_id'),
+                                       'contact_phone'                 => 
$this->db->f('contact_phone'),
+                                       'tenant_id'                             
=> $this->db->f('tenant_id'),
+                                       'cat_id'                                
=> $this->db->f('category'),
+                                       'grants'                                
=> (int)$this->grants[$this->db->f('user_id')]
+                               );
                        }
 
 //_debug_array($workorder);
@@ -490,7 +607,9 @@
 
                function project_budget_from_workorder($project_id = '')
                {
-                       $this->db->query("select budget, id as workorder_id 
from fm_workorder where project_id='$project_id'");
+                       $project_id = (int) $project_id;
+                       $this->db->query("select budget, id as workorder_id 
from fm_workorder WHERE project_id={$project_id}");
+                       $budget = array();
                        while ($this->db->next_record())
                        {
                                $budget[] = array(
@@ -501,10 +620,133 @@
                        return $budget;
                }
 
+               /**
+               * planned cost start out as the project budget - and reflect 
the amount yet to be spent on the project
+               * When an order is placed  - the "planned cost" is reduced with 
expected cost for that order.
+               * When an invoice is paid -  the "planned cost" is reduced with 
actual cost for that order (replace the expected cost).
+               *
+               * @param integer $project_id the project in question
+               *
+               * @return void
+               */
+
+               function update_planned_cost($project_id)
+               {
+                       $this->db->query("SELECT paid, paid_percent, 
act_mtrl_cost, act_vendor_cost, combined_cost, budget FROM fm_workorder WHERE 
project_id={$project_id}");
+                       $workorders = array();
+                       while ($this->db->next_record())
+                       {
+                               $workorders[] = array
+                               (
+                                       'paid'                  => 
$this->db->f('paid'), //0-cancelled /1-invoice received but not paid / 2 - paid
+                                       'paid_percent'  => 
$this->db->f('paid_percent')/100,
+                                       'actual_cost'   => 
$this->db->f('act_mtrl_cost') + $this->db->f('act_vendor_cost'),
+                                       'cost'                  => 
abs($this->db->f('combined_cost')) > 0 ? $this->db->f('combined_cost') : 
$this->db->f('budget'),
+                               );
+                       }
+
+                       $orded_or_paid = 0;
+
+                       foreach($workorders as $workorder)
+                       {
+                               if($workorder['paid'] == 0 || 
$workorder['paid'] == 1)
+                               {
+                                       $orded_or_paid = $orded_or_paid + 
$workorder['cost'];
+                               }
+                               else
+                               {
+                                       if(!$workorder['paid_percent'])
+                                       {
+                                               $workorder['paid_percent'] = 1;
+                                       }
+                                       $orded_or_paid = $orded_or_paid + 
($workorder['actual_cost']/$workorder['paid_percent']);
+                               }
+                       }
+
+            $this->db->query("SELECT budget, reserve FROM fm_project WHERE 
id={$project_id}"); 
+            $this->db->next_record(); 
+            $project_sum = $this->db->f('budget') + $this->db->f('reserve'); 
+
+                       $project_planned_cost = round($project_sum - 
$orded_or_paid);
+
+                       if($project_planned_cost < 0)
+                       {
+                               $project_planned_cost = 0;
+                       }
+
+//_debug_array("UPDATE fm_project SET planned_cost = {$project_planned_cost} 
WHERE id = {$project_id}");
+                       $this->db->query("UPDATE fm_project SET planned_cost = 
{$project_planned_cost} WHERE id = {$project_id}");
+               }
+
+               function update_actual_cost_global()
+               {
+                       set_time_limit(1800);
+                       $this->db->query("SELECT id FROM fm_workorder ORDER BY 
id ASC",__LINE__,__FILE__);
+                       $workorders = array();
+                       while ($this->db->next_record())
+                       {
+                               $workorders[] = $this->db->f('id');
+                       }
+//_debug_array($workorders);die();
+
+                       foreach ($workorders as $workorder_id)
+                       {
+                               $this->update_actual_cost($workorder_id);
+                       }
+               }
+
+               function update_planned_cost_global()
+               {
+                       set_time_limit(3600);
+                       $this->db->query("SELECT id FROM fm_project ORDER BY id 
ASC",__LINE__,__FILE__);
+                       $projects = array();
+                       while ($this->db->next_record())
+                       {
+                               $projects[] = $this->db->f('id');
+                       }
+//_debug_array($projects);die();
+
+                       foreach ($projects as $project_id)
+               {
+                               $this->update_planned_cost($project_id);
+                       }
+               }
+
+               function update_actual_cost($workorder_id)
+               {
+                       $this->db->query("SELECT godkjentbelop, dimd FROM 
fm_ecobilagoverf WHERE pmwrkord_code = {$workorder_id}",__LINE__,__FILE__);
+                       $cost = array();
+                       while ($this->db->next_record())
+                       {
+                               $cost[] = array
+                               (
+                                       'godkjentbelop' => 
$this->db->f('godkjentbelop'),
+                                       'dimd' => $this->db->f('dimd'),
+                               );
+                       }
+                       $act_mtrl_cost = 0;
+                       $act_vendor_cost = 0;
+                       foreach ($cost as $entry)
+                       {
+                               if($entry['dimd'] % 2 == 0)
+                               {
+                                       $act_mtrl_cost = $act_mtrl_cost + 
$entry['godkjentbelop'];
+                               }
+                               else
+                               {
+                                       $act_vendor_cost = $act_vendor_cost + 
$entry['godkjentbelop'];
+                               }
+                       }
+//_debug_array("UPDATE fm_workorder SET act_mtrl_cost = {$act_mtrl_cost}, 
act_vendor_cost = {$act_vendor_cost}  WHERE id = {$workorder_id}");
+                       $this->db->query("UPDATE fm_workorder SET act_mtrl_cost 
= {$act_mtrl_cost}, act_vendor_cost = {$act_vendor_cost}  WHERE id = 
{$workorder_id}");
+
+               }
+
                function branch_p_list($project_id = '')
                {
-
-                       $this->db2->query("SELECT branch_id from 
fm_projectbranch WHERE project_id='$project_id' ",__LINE__,__FILE__);
+                       $project_id = (int) $project_id;
+                       $this->db2->query("SELECT branch_id from 
fm_projectbranch WHERE project_id={$project_id}",__LINE__,__FILE__);
+                       $selected = array();
                        while ($this->db2->next_record())
                        {
                                $selected[] = array('branch_id' => 
$this->db2->f('branch_id'));
@@ -520,17 +762,67 @@
 
                function add($workorder)
                {
+                       $receipt = array();
                        $historylog     = 
CreateObject('property.historylog','workorder');
                        $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
                        $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
 
+                       $cols = array();
+                       $vals = array();
+
+                       if (isset($workorder['extra']) && 
is_array($workorder['extra']))
+                       {
+                               foreach ($workorder['extra'] as $input_name => 
$value)
+                               {
+                                       if($value)
+                                       {
+                                               $cols[] = $input_name;
+                                               $vals[] = $value;
+                                       }
+                               }
+                       }
+
+                       if ($workorder['location_code'])
+                       {
+                               $cols[] = 'location_code';
+                               $vals[] = $workorder['location_code'];
+
+                               if($workorder['street_name'])
+                               {
+                                       $address[]= $workorder['street_name'];
+                                       $address[]= $workorder['street_number'];
+                                       $address = 
$this->db->db_addslashes(implode(" ", $address));
+                               }
+
+                               if(!$address)
+                               {
+                                       $address = 
$this->db->db_addslashes($workorder['location_name']);
+                               }
+                               $cols[] = 'address';
+                               $vals[] = $address;
+                       }
+
+                       if($cols)
+                       {
+                               $cols   = "," . implode(",", $cols);
+                               $vals   = ",'" . implode("','", $vals) . "'";
+                       }
+                       else
+                       {
+                               $cols = '';
+                               $vals = '';
+                       }
+
+                       $this->db->transaction_begin();
+                       $id = $this->next_id();
                        if(!$workorder['workorder_num'])
                        {
-                               $workorder['workorder_num'] = 
$workorder['workorder_id'];
+                               $workorder['workorder_num'] = $id;
                        }
 
-                       $values= array(
-                               $workorder['workorder_id'],
+                       $values= array
+                       (
+                               $id,
                                $workorder['workorder_num'],
                                $workorder['project_id'],
                                $workorder['title'],
@@ -540,8 +832,8 @@
                                $workorder['end_date'],
                                $workorder['status'],
                                $workorder['descr'],
-                               $workorder['budget'],
-                               $workorder['budget'],
+                               (int) $workorder['budget'],
+                               (int) $workorder['budget'],
                                $workorder['b_account_id'],
                                $workorder['addition_rs'],
                                $workorder['addition_percentage'],
@@ -549,17 +841,18 @@
                                $workorder['key_fetch'],
                                $workorder['vendor_id'],
                                $workorder['charge_tenant'],
-                               $this->account);
+                               $this->account,
+                               $workorder['ecodimb'],
+                               $workorder['cat_id']
+                       );
 
                        $values = $this->bocommon->validate_db_insert($values);
 
-                       $this->db->transaction_begin();
-
                        $this->db->query("INSERT INTO fm_workorder 
(id,num,project_id,title,access,entry_date,start_date,end_date,status,"
-                               . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,user_id)
 "
-                               . "VALUES ( $values )",__LINE__,__FILE__);
+                               . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,user_id,ecodimb,category
 $cols) "
+                               . "VALUES ( $values $vals)",__LINE__,__FILE__);
 
-                       $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES (" . $workorder['workorder_id'] . ",'workorder')");
+                       $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES ({$id},'workorder')");
 
 /*
                        if($workorder['charge_tenant'])
@@ -567,21 +860,41 @@
                                $this->db->query("UPDATE fm_project set 
charge_tenant = 1 WHERE id =" . $workorder['project_id']);
                        }
 */
+
+                       if(is_array($workorder['origin']))
+                       {
+                               if($workorder['origin'][0]['data'][0]['id'])
+                               {
+                                       $interlink_data = array
+                                       (
+                                               'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$workorder['origin'][0]['location']),
+                                               'location1_item_id' => 
$workorder['origin'][0]['data'][0]['id'],
+                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.workorder'),
+                                               'location2_item_id' => $id,
+                                               'account_id'            => 
$this->account
+                                       );
+
+                                       
$this->interlink->add($interlink_data,$this->db);
+                               }
+                       }
+
+
                        if($this->db->transaction_commit())
                        {
                                $this->increment_workorder_id();
-                               
$historylog->add('SO',$workorder['workorder_id'],$workorder['status']);
+                               $historylog->add('SO', $id, 
$workorder['status']);
                                if ($workorder['remark'])
                                {
-                                       
$historylog->add('RM',$workorder['workorder_id'],$workorder['remark']);
+                                       $historylog->add('RM', $id, 
$workorder['remark']);
                                }
 
-                               $receipt['message'][] = 
array('msg'=>lang('workorder %1 has been saved',$workorder['workorder_id']));
+                               $receipt['message'][] = 
array('msg'=>lang('workorder %1 has been saved', $id));
                        }
                        else
                        {
                                $receipt['error'][] = array('msg'=>lang('the 
workorder has not been saved'));
                        }
+                       $receipt['id'] = $id;
                        return $receipt;
                }
 
@@ -591,25 +904,26 @@
                        $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
                        $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
 
-                       $this->db->query("SELECT status,budget,calculation FROM 
fm_workorder where id='" .$workorder['workorder_id']."'",__LINE__,__FILE__);
+                       $this->db->query("SELECT status,budget,calculation FROM 
fm_workorder WHERE id = {$workorder['id']}",__LINE__,__FILE__);
                        $this->db->next_record();
 
+                       $old_status = $this->db->f('status');
+                       $old_budget = $this->db->f('budget');
+
                        if ($this->db->f('calculation') > 0)
                        {
-                               $config = CreateObject('phpgwapi.config');
+                               $calculation = $this->db->f('calculation');
+                               $config = 
CreateObject('phpgwapi.config','property');
                                $config->read_repository();
                                $tax = 1+(($config->config_data['fm_tax'])/100);
-                               $combined_cost = $this->db->f('calculation')* 
$tax;
+                               $combined_cost = $calculation * $tax;
                        }
                        else
                        {
                                $combined_cost = $workorder['budget'];
                        }
 
-                       $old_status = $this->db->f('status');
-                       $old_budget = $this->db->f('budget');
-
-                       $this->db->query("SELECT bilagsnr FROM fm_ecobilag 
where pmwrkord_code ='" .$workorder['workorder_id']."'",__LINE__,__FILE__);
+                       $this->db->query("SELECT bilagsnr FROM fm_ecobilag 
WHERE pmwrkord_code ={$workorder['id']}",__LINE__,__FILE__);
                        $this->db->next_record();
 
                        if($this->db->f('bilagsnr'))
@@ -617,7 +931,7 @@
                                $paid = 1;
                        }
 
-                       $this->db->query("SELECT bilagsnr FROM fm_ecobilagoverf 
where pmwrkord_code ='" .$workorder['workorder_id']."'",__LINE__,__FILE__);
+                       $this->db->query("SELECT bilagsnr FROM fm_ecobilagoverf 
where pmwrkord_code = {$workorder['id']}",__LINE__,__FILE__);
                        $this->db->next_record();
                        if($this->db->f('bilagsnr'))
                        {
@@ -625,7 +939,8 @@
                        }
 
 
-                       $value_set=array(
+                       $value_set=array
+                       (
                                'title'                 => $workorder['title'],
                                'status'                => $workorder['status'],
                                'start_date'            => 
$workorder['start_date'],
@@ -639,61 +954,145 @@
                                'rig_addition'          => 
$workorder['addition_rs'],
                                'addition'              => 
$workorder['addition_percentage'],
                                'charge_tenant'         => 
$workorder['charge_tenant'],
-                               'vendor_id'             => 
$workorder['vendor_id']
+                               'vendor_id'             => 
$workorder['vendor_id'],
+                               'ecodimb'               => 
$workorder['ecodimb'],
+                               'category'              => $workorder['cat_id']
                                );
 
                        if($workorder['status'] == 'closed')
                        {
                                $value_set['paid'] = $paid = 
(isset($paid)?$paid:0);
+                               $value_set['paid_percent'] = 100;
                        }
 
+                       if (isset($workorder['extra']) && 
is_array($workorder['extra']))
+                       {
+                               foreach ($workorder['extra'] as $input_name => 
$value)
+                               {
+                                       $value_set[$input_name] = $value;
+                               }
+                       }
+
+                       if ($workorder['location_code'])
+                       {
+                               $value_set['location_code'] = 
$workorder['location_code'];
+
+                               if($workorder['street_name'])
+                               {
+                                       $address[]= $workorder['street_name'];
+                                       $address[]= $workorder['street_number'];
+                                       $address = 
$this->db->db_addslashes(implode(" ", $address));
+                               }
+
+                               if(!isset($address) || !$address)
+                               {
+                                       $address = 
$this->db->db_addslashes($workorder['location_name']);
+                               }
+
+                               $value_set['address'] = $address;
+                       }
+
                        $value_set      = 
$this->bocommon->validate_db_update($value_set);
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("UPDATE fm_workorder set $value_set 
WHERE id=" . $workorder['workorder_id'] ,__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_workorder set $value_set 
WHERE id= {$workorder['id']}" ,__LINE__,__FILE__);
 
 /*                     if($workorder['charge_tenant'])
                        {
                                $this->db->query("UPDATE fm_project set 
charge_tenant = 1 WHERE id =" . $workorder['project_id']);
                        }
 */
-                       if($this->db->transaction_commit())
-                       {
+                       $this->update_planned_cost($workorder['project_id']); 
// at project
+
+                       $check_pending_action = false;
                                if ($old_status != $workorder['status'])
                                {
-                                       
$historylog->add('S',$workorder['workorder_id'],$workorder['status']);
+                                       
$historylog->add('S',$workorder['id'],$workorder['status'], $old_status);
                                        $receipt['notice_owner'][]=lang('Status 
changed') . ': ' . $workorder['status'];
+                                       $check_pending_action = true;
                                }
                                elseif($workorder['confirm_status'])
                                {
-                                       
$historylog->add('SC',$workorder['workorder_id'],$workorder['status']);
+                                       $check_pending_action = true;
+                                       
$historylog->add('SC',$workorder['id'],$workorder['status'], $old_status);
                                        $receipt['notice_owner'][]=lang('Status 
confirmed') . ': ' . $workorder['status'];
                                }
 
+                               if( $check_pending_action )
+                               {
+                                       $this->db->query("SELECT * FROM 
fm_workorder_status WHERE id = '{$workorder['status']}'");
+
+                                       $this->db->next_record();
+
+                                       if ($this->db->f('approved') )
+                                       {
+                                               $action_params = array
+                                               (
+                                                       'appname'               
        => 'property',
+                                                       'location'              
        => '.project.workorder',
+                                                       'id'                    
        => $workorder['id'],
+                                                       'responsible'           
=> $this->account,
+                                                       'responsible_type'  => 
'user',
+                                                       'action'                
        => 'approval',
+                                                       'remark'                
        => '',
+                                                       'deadline'              
        => ''
+                                               );
+
+                                               
execMethod('property.sopending_action.close_pending_action', $action_params);
+                                               unset($action_params);
+                                       }
+                                       if ($this->db->f('in_progress') )
+                                       {
+                                               $action_params = array
+                                               (
+                                                       'appname'               
        => 'property',
+                                                       'location'              
        => '.project.workorder',
+                                                       'id'                    
        => $workorder['id'],
+                                                       'responsible'           
=> $workorder['vendor_id'],
+                                                       'responsible_type'  => 
'vendor',
+                                                       'action'                
        => 'remind',
+                                                       'remark'                
        => '',
+                                                       'deadline'              
        => ''
+                                               );
+
+                                               
execMethod('property.sopending_action.close_pending_action', $action_params);
+                                               unset($action_params);
+
+                                       }
+                                       if ($this->db->f('delivered') )
+                                       {
+                                               //close
+                                       }
+                               }
+
                                if ($old_budget != $workorder['budget'])
                                {
-                                       
$historylog->add('B',$workorder['workorder_id'],$workorder['budget']);
+                                       $historylog->add('B', $workorder['id'], 
$workorder['budget'], $old_budget);
                                }
 
                                if ($workorder['remark'])
                                {
-                                       
$historylog->add('RM',$workorder['workorder_id'],$workorder['remark']);
+                                       $historylog->add('RM', 
$workorder['id'], $workorder['remark']);
                                }
+                       if($this->db->transaction_commit())
+                       {
 
-                               $receipt['message'][] = 
array('msg'=>lang('workorder %1 has been edited',$workorder['workorder_id']));
+                               $receipt['message'][] = 
array('msg'=>lang('workorder %1 has been edited', $workorder['id']));
                        }
                        else
                        {
-                               $receipt['error'][] = 
array('msg'=>lang('workorder %1 has not been 
edited',$workorder['workorder_id']));
+                               $receipt['error'][] = 
array('msg'=>lang('workorder %1 has not been edited', $workorder['id']));
                        }
 
+                       $receipt['id'] = $workorder['id'];
                        return $receipt;
                }
 
                function delete($workorder_id )
                {
                        $this->db->transaction_begin();
+                       $this->interlink->delete_at_target('property', 
'.project.workorder', $workorder_id, $this->db);
                        $this->db->query("DELETE FROM fm_workorder WHERE id='" 
. $workorder_id . "'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_workorder_history  
WHERE  history_record_id='" . $workorder_id   . "'",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_wo_hours WHERE 
workorder_id='" . $workorder_id   . "'",__LINE__,__FILE__);
@@ -702,4 +1101,3 @@
 
                }
        }
-

Added: people/sigurdne/modules/property/trunk/inc/class.test.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.test.inc.php               
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.test.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,83 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2009 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage test
+       * @version $Id$
+       */
+
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_test
+       {
+               var $public_functions = array
+               (
+                       'date' => true
+               );
+
+               function __construct()
+               {
+                       
$GLOBALS['phpgw']->css->add_external_file('rental/templates/base/css/base.css');
+               }
+
+               function date()
+               {
+                       $date1 = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+
+                       $start_field = 
$GLOBALS['phpgw']->yuical->add_listener('start_date', $date1);
+                       $end_field = 
$GLOBALS['phpgw']->yuical->add_listener('end_date');
+
+                       //Only if not xslt_app
+                       $GLOBALS['phpgw']->common->phpgw_header(true);
+
+                       $html = <<<HTML
+                       <div class="yui-content">
+                               <div class="details">
+                                       <form action="#" method="post">
+                                               <dl class="proplist-col">
+                                                       <dt>
+                                                               <label 
for="name">Gjelder fra</label>
+                                                       </dt>
+                                                       <dd>
+                                                               {$start_field}
+                                                       </dd>
+                                                       <dt>
+                                                               <label 
for="name">Gjelder til</label>
+                                                       </dt>
+                                                       <dd>
+                                                               {$end_field}
+                                                       </dd>
+                                       </form>
+                               </div>
+                       </div>
+HTML;
+
+                       echo $html;
+//                     $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.test.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision

Modified: people/sigurdne/modules/property/trunk/inc/class.uiXport.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiXport.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiXport.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -252,6 +252,7 @@
                                        }
                                        else
                                        {
+                                               
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
                                                
$this->debug_import($buffer,$invoice_common);
                                                return;
                                        }
@@ -455,7 +456,7 @@
 
                        );
 
-                       $vendor = 
$this->contacts->read_single($table[0]['spvend_code'], 
array('attributes'=>array(array('column_name' => 'org_name'))));
+                       $vendor = 
$this->contacts->read_single($invoice_common['vendor_id'], 
array('attributes'=>array(array('column_name' => 'org_name'))));
 
                        foreach($vendor['attributes'] as $attribute)
                        {
@@ -468,24 +469,23 @@
 
                        $data = array
                        (
-                               'artid'                                         
        => $table[0]['artid'],
+                               'artid'                                         
        => $invoice_common['art'],
                                'lang_type'                                     
        => lang('Type'),
-                               'artid'                                         
        => $table[0]['artid'],
                                'lang_bilagsnr'                                 
=> lang('bilagsnr'),
-                               'bilagsnr'                                      
        => $table[0]['bilagsnr'],
+                               'bilagsnr'                                      
        => $invoice_common['bilagsnr'],
                                'lang_vendor'                                   
=> lang('Vendor'),
                                'vendor_name'                                   
=> $vendor_name,
-                               'spvend_code'                                   
=> $table[0]['spvend_code'],
+                               'spvend_code'                                   
=> $invoice_common['vendor_id'],
                                'lang_fakturadato'                              
=> lang('invoice date'),
-                               'fakturadato'                                   
=> $table[0]['fakturadato'],
+                               'fakturadato'                                   
=> $invoice_common['invoice_date'],
                                'lang_forfallsdato'                             
=> lang('Payment date'),
                                'forfallsdato'                                  
=> $table[0]['forfallsdato'],
                                'lang_janitor'                                  
=> lang('Janitor'),
-                               'oppsynsmannid'                                 
=> $table[0]['oppsynsmannid'],
+                               'oppsynsmannid'                                 
=> $invoice_common['janitor'],
                                'lang_supervisor'                               
=> lang('Supervisor'),
-                               'saksbehandlerid'                               
=> $table[0]['saksbehandlerid'],
+                               'saksbehandlerid'                               
=> $invoice_common['supervisor'],
                                'lang_budget_responsible'               => 
lang('Budget Responsible'),
-                               'budsjettansvarligid'                   => 
$table[0]['budsjettansvarligid'],
+                               'budsjettansvarligid'                   => 
$invoice_common['budget_responsible'],
                                'lang_sum'                                      
        => lang('Sum'),
                                'sum'                                           
        => number_format($sum, 2, ',', ''),
                                'table_header'                                  
=> $table_header,

Modified: people/sigurdne/modules/property/trunk/inc/class.uiactor.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiactor.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiactor.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,9 +24,11 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id$
+       * @version $Id$
        */
 
+       phpgw::import_class('phpgwapi.yui');
+
        /**
         * uiactor class
         *
@@ -58,13 +60,13 @@
 
                function property_uiactor()
                {
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; // 
menus added where needed via bocommon::get_menu
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
 
-                       $this->nextmatchs               = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo                               = 
CreateObject('property.boactor',true);
-                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->bocommon                 = & $this->bo->bocommon;
 
                        $this->role                             = 
$this->bo->role;
 
@@ -127,6 +129,10 @@
 
                function columns()
                {
+
+                       //cramirez: necesary for windows.open . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
                        $values = phpgw::get_var('values');
@@ -134,7 +140,7 @@
                        if ($values['save'])
                        {
                                
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-                               
$GLOBALS['phpgw']->preferences->read_repository();
+                               $GLOBALS['phpgw']->preferences->read();
                                
$GLOBALS['phpgw']->preferences->add('property','actor_columns_' 
.$this->role,$values['columns'],'user');
                                
$GLOBALS['phpgw']->preferences->save_repository();
 
@@ -183,190 +189,447 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('actor',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs',
-                                                                               
'filter_member_of'));
+                       $dry_run=false;
+                       $lookup = ''; //Fix this
+
+                       $datatable = array();
+                       $values_combo_box = array();
 
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','actor_receipt_' . 
$this->role);
                        
$GLOBALS['phpgw']->session->appsession('session_data','actor_receipt_' . 
$this->role,'');
 
-                       $list = $this->bo->read();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                               if(!$lookup)
+                               {
+                                       $datatable['menu']      = 
$this->bocommon->get_menu();
+                               }
+
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                                               'menuaction'=> 
'property.uiactor.index',
+                                                                       
'lookup'    => $lookup,
+                                                                       
'cat_id'        =>$this->cat_id,
+                                                                       'query' 
        =>$this->query,
+                                                                       'role'  
        => $this->role,
+                                                                       
'member_id'     => $this->member_id
+
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiactor.index',"
+
+                                                                               
                ."lookup:'{$lookup}',"
+                                                                               
                ."query:'{$this->query}',"
+                                                                               
                        ."cat_id:'{$this->cat_id}',"
+                                                                               
."role:'{$this->role}',"
+                                                                               
."member_id:'{$this->member_id}'";
+                //die(_debug_array($datatable));
+
+                               $values_combo_box[0]  = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true));
+                               $default_value = array 
('cat_id'=>'','name'=>lang('no member'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $values_combo_box[1] = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' => $this->role,'order'=>'descr'));
+                               $default_value = array ('id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uiactor.index',
+                                                                       
'lookup'                        => $lookup,
+                                                                       
'cat_id'        => $this->cat_id,
+                                                                       'query' 
        => $this->query,
+                                                                       'role'  
        => $this->role,
+                                                                       
'member_id'     => $this->member_id
+                                                               )
+                                                       ),
+                                               'fields'        => array(
+                                       'field' => array(
+                                                               array(
+                                                                   'id' => 
'btn_member_id',
+                                                                   'name' => 
'member_id',
+                                                                   'value'     
=> lang('Member'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array(
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                        array(
+                                                                               
                'type'=> 'link',
+                                                                               
                'id'  => 'btn_columns',
+                                                                               
                'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                       array(
+                                                                               
                           'menuaction' => 'property.uiactor.columns',
+                                                                               
                           'role'               => $this->role
+                                                                               
                           ))."','','width=350,height=370')",
+                                                                               
                 'value' => lang('columns'),
+                                                                               
                 'tab_index' => 6
+                                                                               
            ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 5
+                                                                           ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'size'    
=> 28,
+                                                                   'tab_index' 
=> 3
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id') 
//i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+
+                               if($this->role == 'tenant')
+                               {
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][0]);
+                               }
+
+                               if(!$this->acl_add)
+                               {
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][3]);
+                               }
+                               $dry_run=true;
+                       }
+
+                       $actor_list = array();
+                       $actor_list = $this->bo->read($dry_run);
+
+                       //echo $dry_run; count($actor_list); 
die(_debug_array($actor_list));
 
                        $uicols = $this->bo->uicols;
 
                        $j=0;
-
-                       if (isset($list) AND is_array($list))
+                       if (isset($actor_list) && is_array($actor_list))
                        {
-                               foreach($list as $entry)
+                               foreach($actor_list as $actor)
                                {
                                        for 
($i=0;$i<count($uicols['name']);$i++)
                                        {
                                                
if($uicols['input_type'][$i]!='hidden')
                                                {
-                                                       
$content[$j]['row'][$i]['value'] = $entry[$uicols['name'][$i]];
-                                                       
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
-                                               }
-                                       }
-
-                                       if($this->acl_read)
+                                                       
if(isset($actor['query_location'][$uicols['name'][$i]]))
                                        {
-                                               
$content[$j]['row'][$i]['statustext']   = lang('view the entity');
-                                               $content[$j]['row'][$i]['text'] 
        = lang('view');
-                                               
$content[$j]['row'][$i++]['link']       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiactor.view', 'actor_id'=> $entry['id'], 'role'=> $this->role));
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['statustext']               = 
lang('search');
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$actor[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['java_link']                = true;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']                             
= $actor['query_location'][$uicols['name'][$i]];
                                        }
-                                       if($this->acl_edit)
+                                                       else
                                        {
-                                               
$content[$j]['row'][$i]['statustext']   = lang('edit the actor');
-                                               $content[$j]['row'][$i]['text'] 
        = lang('edit');
-                                               
$content[$j]['row'][$i++]['link']       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiactor.edit', 'actor_id'=> $entry['id'], 'role'=> $this->role));
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$actor[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['lookup']                   = 
$lookup;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+
+                                                               
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $actor[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']            = lang('link');
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']             = 
$actor[$uicols['name'][$i]];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
                                        }
-                                       if($this->acl_delete)
+                                                       }
+                                               }
+                                               else
                                        {
-                                               
$content[$j]['row'][$i]['statustext']   = lang('delete the actor');
-                                               $content[$j]['row'][$i]['text'] 
        = lang('delete');
-                                               
$content[$j]['row'][$i++]['link']       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiactor.delete', 'actor_id'=> $entry['id'], 'role'=> $this->role));
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$actor[$uicols['name'][$i]];
+                                               }
+
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                    = 
$actor[$uicols['name'][$i]];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                     = 
$uicols['name'][$i];
                                        }
 
                                        $j++;
                                }
                        }
 
-//html_print_r($content);
-                       for ($i=0;$i<count($uicols['descr']);$i++)
-                       {
-                               if($uicols['input_type'][$i]!='hidden')
-                               {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if(isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]!='T' && $uicols['datatype'][$i]!='CH')
+                       // NO pop-up
+                       $datatable['rowactions']['action'] = array();
+                       if(!$lookup)
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                               $parameters = array
                                                        (
-                                                               'sort'  => 
$this->sort,
-                                                               'var'   => 
$uicols['name'][$i],
-                                                               'order' => 
$this->order,
-                                                               'extra' => 
array('menuaction'   => 'property.uiactor.index',
-                                                                               
                        'query'         => $this->query,
-                                                                               
                        'role'          => $this->role,
-                                                                               
                        'member_id'     => $this->member_id
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'actor_id',
+                                                       'source'        => 'id'
                                                                                
                )
-                                                       ));
-                                       }
-                               }
-                       }
+                                       )
+                               );
 
                        if($this->acl_read)
                        {
-                               $table_header[$i]['width']      = '5%';
-                               $table_header[$i]['align']      = 'center';
-                               $table_header[$i]['header']     = lang('view');
-                               $i++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiactor.view',
+                                                                               
        'role'  => $this->role
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('open view in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiactor.view',
+                                                                               
        'role'                  => $this->role,
+                                                                               
        'target'                => '_blank'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                        }
                        if($this->acl_edit)
                        {
-                               $table_header[$i]['width']      = '5%';
-                               $table_header[$i]['align']      = 'center';
-                               $table_header[$i]['header']     = lang('edit');
-                               $i++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'edit',
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiactor.edit',
+                                                                               
        'role'  => $this->role
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('open edit in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiactor.edit',
+                                                                               
        'role'                  => $this->role,
+                                                                               
        'target'                => '_blank'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                        }
                        if($this->acl_delete)
                        {
-                               $table_header[$i]['width']      = '5%';
-                               $table_header[$i]['align']      = 'center';
-                               $table_header[$i]['header']     = 
lang('delete');
-                               $i++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'delete',
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiactor.delete',
+                                                                               
        'role'  => $this->role
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                        }
-
                        if($this->acl_add)
                        {
-                               $table_add = array
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'add',
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                                (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add an 
actor'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiactor.edit', 'role'=> $this->role))
+                                                                               
                'menuaction'    => 'property.uiactor.edit',
+                                                                               
                'role'  => $this->role
+                                                                               
        ))
                                );
                        }
+                               unset($parameters);
+                       }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uiactor.index',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'cat_id'        =>$this->cat_id,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query,
-                               'role'          => $this->role,
-                               'member_id'     => $this->member_id
-                       );
+                       $uicols_count   = count($uicols['descr']);
 
-                       if(!$this->allrows)
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       if(isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]!='T' && $uicols['datatype'][$i]!='CH')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                                       }
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                                       
$datatable['headers']['header'][$i]['name']                     = 'id2';
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       // path for property.js
+                       $datatable['property_js'] =  
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned'] = 
count($actor_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       $link_columns = array
+                       //$datatable['sorting']['order']        = 
phpgw::get_var('order', 'string'); // Column
+                       //$datatable['sorting']['sort']         = 
phpgw::get_var('sort', 'string'); // ASC / DESC
+
+                       if($this->role == 'tenant')
+                       {
+                               if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                               {
+                                       $datatable['sorting']['order']          
        = 'first_name'; // name key Column in myColumnDef
+                                       $datatable['sorting']['sort']           
        = 'asc'; // ASC / DESC
+                               }
+                               else
+                               {
+                                       $datatable['sorting']['order']          
        = phpgw::get_var('order', 'string'); // name of column of Database
+                                       $datatable['sorting']['sort']           
        = phpgw::get_var('sort', 'string'); // ASC / DESC
+                               }
+                       }
+                       else
+                       {
+                               if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                               {
+                                       $datatable['sorting']['order']          
        = 'org_name'; // name key Column in myColumnDef
+                                       $datatable['sorting']['sort']           
        = 'asc'; // ASC / DESC
+                               }
+                               else
+                               {
+                                       $datatable['sorting']['order']          
        = phpgw::get_var('order', 'string'); // name of column of Database
+                                       $datatable['sorting']['sort']           
        = phpgw::get_var('sort', 'string'); // ASC / DESC
+                               }
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 'property.uiactor.columns',
-                               'role'          => $this->role
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true, 'link_data' =>$link_data));
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                        $json['records'][] = $json_row;
+                               }
+                       }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_columns'                                  
        => lang('columns'),
-                               'link_columns'                                  
        => $GLOBALS['phpgw']->link('/index.php',$link_columns),
-                               'lang_columns_help'                             
        => lang('Choose columns'),
-                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'links'                                         
                => $links,
-                               'allow_allrows'                                 
        => false,
-                               'allrows'                                       
                => $this->allrows,
-                               'start_record'                                  
        => $this->start,
-                               'record_limit'                                  
        => $record_limit,
-                               'num_records'                                   
        => count($list),
-                               'all_records'                                   
        => $this->bo->total_records,
-                               'link_url'                                      
                => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
                => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
        => lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the actor belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
        => 'cat_id',
-                               'cat_list'                                      
                => 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' => $this->role,'order'=>'descr')),
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
-                               'select_action'                                 
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
 
-                               'lang_no_member'                                
        => lang('no member'),
-                               'member_of_name'                                
        => 'member_id',
-                               'member_of_list'                                
        => $member_of_data['cat_list'],
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'filter_list'                                   
        => $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
-                               'lang_filter_statustext'                        
=> lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                         
                => $this->query,
-                               'lang_search'                                   
        => lang('search'),
-                               'table_header'                                  
        => $table_header,
-                               'values'                                        
                => $content,
-                               'table_add'                                     
                => $table_add
-                       );
-                       $this->save_sessiondata();
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('actor') . ': ' . lang('list ' . $this->role);
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'actor.index', 'property' );
+
+                       //$this->save_sessiondata();
                }
 
                function edit()
@@ -411,6 +674,11 @@
                                if ((isset($values['save']) && $values['save']) 
|| (isset($values['apply']) && $values['apply']))
                                {
 
+                                       
if($GLOBALS['phpgw']->session->is_repost())
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+                                       }
+
                                        if(!isset($values['cat_id']) || 
!$values['cat_id'])
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
@@ -453,18 +721,18 @@
                        }
 
 
-                       $actor = 
$this->bo->read_single(array('actor_id'=>$actor_id));
+                       $values = 
$this->bo->read_single(array('actor_id'=>$actor_id));
 
                        /* Preserve attribute values from post */
                        if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
                        {
-                               $actor = 
$this->bo->preserve_attribute_values($actor,$values_attribute);
+                               $values = 
$this->bo->preserve_attribute_values($values,$values_attribute);
                        }
 
                        if ($actor_id)
                        {
-                               $this->cat_id = 
($actor['cat_id']?$actor['cat_id']:$this->cat_id);
-                               $this->member_id = 
($actor['member_of']?$actor['member_of']:$this->member_id);
+                               $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
+                               $this->member_id = 
($values['member_of']?$values['member_of']:$this->member_id);
                        }
 
                        $link_data = array
@@ -474,41 +742,52 @@
                                'role'          => $this->role
                        );
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
 
-                       $dateformat= (implode($sep,$dlarr));
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true, 'link_data' =>array()));
+
+                       $tabs = array();
 
-                       switch(substr($dateformat,0,1))
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
+                       {
+                               foreach ($values['attributes'] as & $attribute)
                        {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
+                                       if($attribute['history'] == true)
+                                       {
+                                               $link_history_data = array
+                                               (
+                                                       'menuaction'    => 
'property.uiactor.attrib_history',
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'actor_id'      => 
$actor_id,
+                                                       'role'          => 
$this->role,
+                                                       'edit'          => true
+                                               );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                               
phpgwapi_yui::tabview_setup('actor_edit_tabview');
+                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
 
-                       $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true, 'link_data' =>array()));
+                               $location = $this->acl_location;
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $values['attributes']);
 
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $tabs[str_replace(' ', '_', 
$group['name'])] = array('label' => $group['name'], 'link' => '#' . 
str_replace(' ', '_', $group['name']));
+                                               $group['link'] = str_replace(' 
', '_', $group['name']);
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($values['attributes']);
+                       }
 
-//_debug_array($member_of_data);
                        $data = array
                        (
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -519,7 +798,7 @@
                                'lang_save'                                     
        => lang('save'),
                                'lang_cancel'                                   
=> lang('cancel'),
                                'lang_apply'                                    
=> lang('apply'),
-       //                      'value_cat'                                     
        => $actor['cat'],
+       //                      'value_cat'                                     
        => $values['cat'],
                                'lang_id_statustext'                    => 
lang('Choose an ID'),
                                'lang_apply_statustext'                 => 
lang('Apply the values'),
                                'lang_cancel_statustext'                => 
lang('Leave the actor untouched and return back to the list'),
@@ -533,35 +812,39 @@
                                'member_of_name'                                
=> 'member_id',
                                'member_of_list'                                
=> $member_of_data['cat_list'],
 
-                               'lang_dateformat'                               
=> lang(strtolower($dateformat)),
-                               'dateformat_validate'                   => 
$dateformat_validate,
-                               'onKeyUp'                                       
        => $onKeyUp,
-                               'onBlur'                                        
        => $onBlur,
                                'lang_attributes'                               
=> lang('Attributes'),
-               //              'attributes_header'                             
=> $attributes_header,
-                               'attributes_values'                             
=> $actor['attributes'],
-                               'lookup_functions'                              
=> isset($actor['lookup_functions'])?$actor['lookup_functions']:'',
+                               'attributes_group'                              
=> $attributes,
+                               'lookup_functions'                              
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
                                'dateformat'                                    
=> $dateformat,
                                'lang_edit'                                     
        => lang('edit'),
                                'lang_add'                                      
        => lang('add'),
                                'textareacols'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
+                               'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, 'general')
                        );
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('actor') . ': ' . ($actor_id?lang('edit') . ' ' . 
lang($this->role):lang('add') . ' ' . lang($this->role));
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
 
                function delete()
                {
+
+                       $actor_id       = phpgw::get_var('actor_id', 'int');
+
+                       //cramirez add JsonCod for Delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($actor_id);
+                               return "actor_id ".$actor_id." ".lang("has been 
deleted");
+                       }
+
                        if(!$this->acl_delete)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
                        }
 
-                       $actor_id       = phpgw::get_var('actor_id', 'int');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
                        $link_data = array

Modified: people/sigurdne/modules/property/trunk/inc/class.uiadmin.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiadmin.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiadmin.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -337,6 +337,7 @@
                                $receipt        = 
$this->bo->set_permission($values,$r_processed,false,$initials);
                        }
 
+                       $num_records = 0;
                        if ($this->location)
                        {
                                if($this->cat_id=='accounts')
@@ -346,6 +347,7 @@
 
                                if (isSet($user_list) AND is_array($user_list))
                                {
+                                       $num_records = count($user_list);
                                        foreach($user_list as $user)
                                        {
                                                $processed[] = 
$user['account_id'];
@@ -403,6 +405,7 @@
 
                                if (isSet($group_list) AND 
is_array($group_list))
                                {
+                                       $num_records = count($group_list);
                                        foreach($group_list as $group)
                                        {
                                                $processed[] = 
$group['account_id'];
@@ -541,8 +544,8 @@
                                'processed'                                     
        => (isset($processed)?$processed:''),
                                'location'                                      
        => $this->location,
 
-                               'num_records'                                   
=> (isset($user_list)?count($user_list):''),
-                               'all_records'                                   
=> (isset($this->bo->total_records)?$this->bo->total_records:''),
+                               'num_records'                                   
=> $num_records,
+                               'all_records'                                   
=> isset($this->bo->total_records) && $this->bo->total_records ? 
$this->bo->total_records : 0,
                                'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
 
@@ -663,15 +666,15 @@
                                return;
                        }
 
+                       $user_id        = phpgw::get_var('user_id', 'int');
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array('admin'));
 
                        $values         = phpgw::get_var('values');
 
                        if ($values['save'])
                        {
-                               // this should use the contacts backend in the 
API - each account is already linked to a contact
-                               
$GLOBALS['phpgw']->preferences->account_id=$this->filter;
-                               
$GLOBALS['phpgw']->preferences->read_repository();
+                               
$GLOBALS['phpgw']->preferences->set_account_id($user_id, true);
 
                                if ($values['old_email'] != $values['email'])
                                {
@@ -711,9 +714,9 @@
                                
$GLOBALS['phpgw']->preferences->save_repository();
                        }
 
-                       if($this->filter)
+                       if($user_id)
                        {
-                               $prefs = 
$this->bocommon->create_preferences('property',$this->filter);
+                               $prefs = 
$this->bocommon->create_preferences('property',$user_id);
                        }
 
                        $cats           = CreateObject('phpgwapi.categories');
@@ -797,10 +800,10 @@
 
 
                                'lang_user_statustext'                  => 
lang('Select the user to edit email'),
-                               'select_user_name'                              
=> 'filter',
+                               'select_user_name'                              
=> 'user_id',
                                'lang_no_user'                                  
=> lang('No user'),
-                               'value_user_id'                                 
=> $this->filter,
-                               'user_list'                                     
        => 
$this->bocommon->get_user_list('filter',$this->filter,$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+                               'value_user_id'                                 
=> $user_id,
+                               'user_list'                                     
        => 
$this->bocommon->get_user_list('filter',$user_id,$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1,
 true),
                                'group_list_tts'                                
=> $groups_tts,
                                'account_list_tts'                              
=> $accounts_tts,
                                'lang_group_select'                             
=> lang('Default group TTS'),

Modified: 
people/sigurdne/modules/property/trunk/inc/class.uiadmin_entity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiadmin_entity.inc.php     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiadmin_entity.inc.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -28,6 +28,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -52,30 +53,21 @@
                        'edit_category'         => true,
                        'view'                  => true,
                        'delete'                => true,
+                       'list_attribute_group'  => true,
                        'list_attribute'        => true,
+                       'edit_attrib_group'             => true,
                        'edit_attrib'           => true,
-                       'list_custom_function'  =>true,
+                       'list_custom_function'  => true,
                        'edit_custom_function'  => true
                );
 
                function property_uiadmin_entity()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'admin::property::entity';
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                                       = 
CreateObject('property.boadmin_entity',true);
-                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->bocommon                         = & 
$this->bo->bocommon;
 
-                       $this->acl                              = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location                     = 
'.admin.entity';
-                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
-                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
-                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
-                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
-                       $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, 'property');
-
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
@@ -83,7 +75,17 @@
                        $this->entity_id                        = 
$this->bo->entity_id;
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->allrows                          = 
$this->bo->allrows;
+                       $this->type                                     = 
$this->bo->type;
+                       $this->type_app                         = 
$this->bo->type_app;
+                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
+                       $this->acl_location                     = 
'.admin.entity';
+                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 
$this->type_app[$this->type]);
+                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 
$this->type_app[$this->type]);
+                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 
$this->type_app[$this->type]);
+                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 
$this->type_app[$this->type]);
+                       $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, $this->type_app[$this->type]);
 
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"admin::{$this->type_app[$this->type]}::entity";
                }
 
                function save_sessiondata()
@@ -109,260 +111,707 @@
                        }
 
                        $this->bocommon->reset_fm_cache();
-                       $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                               'admin_entity',
-                                                               'nextmatchs',
-                                                               
'search_field'));
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uiadmin_entity.index',
+                                       'sort'          =>$this->sort,
+                                       'order'         =>$this->order,
+                                       'query'         =>$this->query,
+                                       'type'          => $this->type
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_entity.index',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."type:'{$this->type}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'property.uiadmin_entity.index',
+                               'sort'          =>$this->sort,
+                               'order'         =>$this->order,
+                                       'query'         =>$this->query,
+                                       'type'          => $this->type
+                       );
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_entity.index',
+                                                               'sort'          
=>$this->sort,
+                                                               'order'         
=>$this->order,
+                                                               'query'         
=>$this->query,
+                                                               'type'          
=> $this->type
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
+                       );
+
+                               $dry_run = true;
+               }
+
                        $entity_list = $this->bo->read();
+                       $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('Entity ID');
+                       $uicols['name'][1]      = 'name';
+                       $uicols['descr'][1]     = lang('Name');
+                       $uicols['name'][2]      = 'descr';
+                       $uicols['descr'][2]     = lang('Descr');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
-                       if (isSet($entity_list) AND is_array($entity_list))
+                       if (isset($entity_list) AND is_array($entity_list))
+               {
+                               foreach($entity_list as $entity_entry)
                        {
-                               foreach($entity_list as $entry)
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
                                {
-                                       $content[] = array
-                                       (
-                                               'id'                            
=> $entry['id'],
-                                               'name'                          
=> $entry['name'],
-                                               'descr'                         
=> $entry['descr'],
-                                               'link_categories'               
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.category',' entity_id'=> $entry['id'])),
-                                               'link_edit'                     
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit', 'id'=> $entry['id'])),
-                                               'link_delete'                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.delete',' entity_id'=> $entry['id'])),
-                                               'lang_view_standardtext'        
=> lang('view the standard'),
-                                               'lang_category_text'            
=> lang('categories for the entity type'),
-                                               'lang_edit_standardtext'        
=> lang('edit the entity'),
-                                               'lang_delete_standardtext'      
=> lang('delete the entity'),
-                                               'text_categories'               
=> lang('Categories'),
-                                               'text_edit'                     
=> lang('edit'),
-                                               'text_delete'                   
=> lang('delete')
-                                       );
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $entity_entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
                                }
                        }
 
-//_debug_array($content);
+                       $datatable['rowactions']['action'] = array();
 
-                       $table_header[] = array
+                       $parameters = array
                        (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
 
-                               'lang_descr'            => lang('Descr'),
-                               'lang_categories'       => lang('Categories'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_id'               => 
$this->nextmatchs->show_sort_order(array
+                       $parameters2 = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uiadmin_entity.index',
-                                                                               
                                                'allrows'=> $this->allrows)
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'entity_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'categories',
+                                               'statustext'    => 
lang('categories'),
+                                               'text'                  => 
lang('Categories'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_entity.category',
+                                                                       'type'  
                => $this->type
                                                                                
)),
-                               'lang_id'               => lang('entity id'),
-                               'sort_name'             => 
$this->nextmatchs->show_sort_order(array
+                                       'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('edit'),
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uiadmin_entity.index',
-                                                                               
                                                'allrows'=> $this->allrows)
+                                                                       
'menuaction'    => 'property.uiadmin_entity.edit',
+                                                                       'type'  
                => $this->type
                                                                                
)),
-                               'lang_name'             => lang('Name'),
+                                       'parameters'    => $parameters
                        );
 
-                       $table_add[] = array
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('delete'),
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_add'              => lang('add'),
-                               'lang_add_standardtext' => lang('add a 
standard'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit')),
-                               'lang_done'             => lang('done'),
-                               'lang_done_standardtext'=> lang('back to 
admin'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/admin/index.php')
+                                                                       
'menuaction'    => 'property.uiadmin_entity.delete',
+                                                                       'type'  
                => $this->type
+                                                               )),
+                                       'parameters'    => $parameters2
                        );
 
-                       if(!$this->allrows)
+
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                       (
+                                               'menuaction'    => 
'property.uiadmin_entity.edit',
+                                               'type'                  => 
$this->type
+                                       )));
+
+                       unset($parameters);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
                        }
-                       else
+                                       if($uicols['name'][$i]=='name')
                        {
-                               $record_limit   = $this->bo->total_records;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }
+                               }
                        }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uiadmin_entity.index',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'query'         =>$this->query
-                       );
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $data = array
-                       (
-                               'allow_allrows'                         => true,
-                               'allrows'                               => 
$this->allrows,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($entity_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_standardtext'         => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_standardtext'        => 
lang('Submit the search string'),
-                               'query'                                 => 
$this->query,
-                               'lang_search'                           => 
lang('search'),
-                               'table_header'                          => 
$table_header,
-                               'values'                                => 
$content,
-                               'table_add'                             => 
$table_add
-                       );
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($entity_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
                        $appname        = lang('entity');
                        $function_msg   = lang('list entity type');
 
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+               {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                       {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                               {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                       {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                                       {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                                       }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+                                       {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+                                       }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
-               }
 
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_entity.index', 'property' );
+                               }
 
                function category()
-               {
+                               {
                        if(!$this->acl_read)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
-                       }
+                               }
 
                        $entity_id      = phpgw::get_var('entity_id', 'int');
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::entity_{$entity_id}";
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                               'admin_entity',
-                                                               'nextmatchs',
-                                                               
'search_field'));
+                       $entity = $this->bo->read_single($entity_id);
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uiadmin_entity.category',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'type'          => $this->type
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_entity.category',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."entity_id:'{$this->entity_id}',"
+                                                                               
."type:'{$this->type}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                       $link_data = array
+                       (
+                                       'menuaction'    => 
'property.uiadmin_entity.category',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'type'          => $this->type
+                       );
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_entity.category',
+                                                               'sort'          
=> $this->sort,
+                                                               'order'         
=> $this->order,
+                                                               'query'         
=> $this->query,
+                                                               'entity_id'     
=> $entity_id,
+                                                               'type'          
=> $this->type
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       ),
+                                                                       array(
+                                                                           
'id' => 'txtcategory',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => 'Entity: '.$entity['name'],
+                                                                           
'type' => 'label',
+                                                                           
'style' => 'filter'
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
                        $category_list = $this->bo->read_category($entity_id);
+                       $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('category ID');
+                       $uicols['name'][1]      = 'name';
+                       $uicols['descr'][1]     = lang('Name');
+                       $uicols['name'][2]      = 'descr';
+                       $uicols['descr'][2]     = lang('Descr');
+                       $uicols['name'][3]      = 'prefix';
+                       $uicols['descr'][3]     = lang('Prefix');
+                       $uicols['name'][4]      = 'entity_id';
+                       $uicols['descr'][4]     = lang('id');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
-                       if (isSet($category_list) AND is_array($category_list))
+                       if (isset($category_list) AND is_array($category_list))
                        {
-                               foreach($category_list as $entry)
+                               foreach($category_list as $category_entry)
                                {
-                                       $content[] = array
-                                       (
-                                               'id'                            
        => $entry['id'],
-                                               'name'                          
        => $entry['name'],
-                                               'prefix'                        
        => $entry['prefix'],
-                                               'descr'                         
        => $entry['descr'],
-//                                             'link_status'                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_status', 'cat_id'=> $entry['id'], 'entity_id'=> 
$entity_id)),
-                                               'link_custom_function'          
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'cat_id'=> $entry['id'], 
'entity_id'=> $entity_id)),
-                                               'link_attribute'                
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute', 'cat_id'=> $entry['id'], 
'entity_id'=> $entity_id)),
-                                               'link_edit'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_category','id'=> $entry['id'], 'entity_id'=> 
$entity_id)),
-                                               'link_delete'                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.delete', 'cat_id'=> $entry['id'], 'entity_id'=> 
$entity_id)),
-                                               'lang_view_standardtext'        
        => lang('view the category'),
-                                               'lang_status_standardtext'      
        => lang('Status for the entity category'),
-                                               'lang_attribute_standardtext'   
        => lang('attributes for the entity category'),
-                                               
'lang_custom_function_standardtext'     => lang('custom functions for the 
entity category'),
-                                               'lang_edit_standardtext'        
        => lang('edit the standard'),
-                                               'lang_delete_standardtext'      
        => lang('delete the standard'),
-                                               'text_status'                   
        => lang('Status'),
-                                               'text_attribute'                
        => lang('Attributes'),
-                                               'text_custom_function'          
        => lang('Custom functions'),
-                                               'text_edit'                     
        => lang('edit'),
-                                               'text_delete'                   
        => lang('delete')
-                                       );
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$category_entry[$uicols['name'][$k]];
+                                                       
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'entity_id')
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['value']            = $entity_id;
+                                                       }
+                                               }
+                                       }
+                                       $j++;
                                }
                        }
 
-//_debug_array($content);
+                       $datatable['rowactions']['action'] = array();
 
-                       $table_header[] = array
+                       $parameters = array
                        (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'entity_id',
+                                               'source'        => 'entity_id'
+                                       )
+                               )
+                       );
 
-                               'lang_descr'            => lang('Descr'),
-                               'lang_prefix'           => lang('prefix'),
-//                             'lang_status'           => lang('Status'),
-                               'lang_attribute'        => lang('Attributes'),
-                               'lang_custom_function'  => lang('custom 
functions'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_id'               => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uiadmin_entity.category',
-                                                                               
                                                'entity_id' =>$entity_id,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
-                               'lang_id'               => lang('category id'),
-                               'sort_name'             => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uiadmin_entity.category',
-                                                                               
                                                'entity_id' =>$entity_id,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
-                               'lang_name'             => lang('Name'),
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'cat_id',
+                                               'source'        => 'id'
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'entity_id',
+                                               'source'        => 'entity_id'
+                                       )
+                               )
                        );
 
-                       $table_add[] = array
+                       $parameters3 = array
                        (
-                               'lang_add'                      => lang('add'),
-                               'lang_add_standardtext'         => lang('add a 
category'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_category', 'entity_id'=> $entity_id)),
-                               'lang_done'                     => lang('done'),
-                               'lang_done_standardtext'        => lang('back 
to entity'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.index'))
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'entity_id',
+                                               'source'        => 'entity_id'
+                                       )
+                               )
                        );
 
-                       $entity = $this->bo->read_single($entity_id,false);
+                       //_debug_array($parameters2);die;
 
-                       if(!$this->allrows)
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'attribute_groups',
+                                               'statustext'    => 
lang('attribute groups'),
+                                               'text'                  => 
lang('attribute groups'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_entity.list_attribute_group',
+                                                                       'type'  
                => $this->type
+                                                               )),
+                                       'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'attributes',
+                                               'statustext'    => 
lang('attributes'),
+                                               'text'                  => 
lang('Attributes'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_entity.list_attribute',
+                                                                       'type'  
                => $this->type
+                                                               )),
+                                       'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'custom functions',
+                                               'statustext'    => lang('custom 
functions'),
+                                               'text'                  => 
lang('Custom functions'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_entity.list_custom_function',
+                                                                       'type'  
                => $this->type
+                                                               )),
+                                       'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('edit'),
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_entity.edit_category',
+                                                                       'type'  
                => $this->type
+                                                               )),
+                                       'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('delete'),
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_entity.delete',
+                                                                       'type'  
                => $this->type
+                                                               )),
+                                       'parameters'    => $parameters2
+                                       );
+
+
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'property.uiadmin_entity.edit_category',
+                                                       'entity_id'             
=> $entity_id,
+                                                       'type'                  
=> $this->type
+                                               )),
+                                       'parameters'    => $parameters3
+                                       );
+
+                       unset($parameters);
+                       unset($parameters2);
+                       unset($parameters3);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
+                                       }
+                                       if($uicols['name'][$i]=='name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }
+                                       if($uicols['name'][$i]=='entity_id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']          = false;
+                                       }
+                               }
                        }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($category_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname        = lang('entity');
+                       $function_msg   = lang('list entity type');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uiadmin_entity.category',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'query'         => $this->query,
-                               'entity_id'     => $entity_id
-                       );
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $data = array
-                       (
-                               'lang_entity'                                   
=> lang('entity'),
-                               'entity_name'                                   
=> $entity['name'],
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($category_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_standardtext'                 
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_standardtext'                
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_category'                         
=> $table_header,
-                               'values_category'                               
=> $content,
-                               'table_add'                                     
=> $table_add
-                       );
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
 
-                       $appname        = lang('entity');
-                       $function_msg   = lang('list entity type');
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_category' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_entity.category', 'property' );
                }
 
                function edit()
@@ -374,7 +823,7 @@
 
                        $id     = phpgw::get_var('id', 'int');
                        $values                 = phpgw::get_var('values');
-                       $config = CreateObject('phpgwapi.config','property');
+                       $config = CreateObject('phpgwapi.config', 
$this->type_app[$this->type]);
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
 
@@ -399,7 +848,7 @@
                                        {
                                                $id=$receipt['id'];
                                        }
-                                       $config->read_repository();
+                                       $config->read();
 
                                        
if(!is_array($config->config_data['location_form']))
                                        {
@@ -446,7 +895,8 @@
                        $link_data = array
                        (
                                'menuaction'    => 
'property.uiadmin_entity.edit',
-                               'id'            => $id
+                               'id'            => $id,
+                               'type'          => $this->type
                        );
 //_debug_array($include_list);
 
@@ -457,7 +907,7 @@
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'lang_name_standardtext'                        
=> lang('Enter a name of the standard'),
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.index')),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.index', 'type' => $this->type)),
                                'lang_id'                                       
=> lang('standard ID'),
                                'lang_name'                                     
=> lang('Name'),
                                'lang_descr'                                    
=> lang('Descr'),
@@ -491,7 +941,7 @@
 
                        $appname        = lang('entity');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
@@ -559,8 +1009,9 @@
                        $link_data = array
                        (
                                'menuaction'    => 
'property.uiadmin_entity.edit_category',
-                               'entity_id'     =>$entity_id,
-                               'id'            => $id
+                               'entity_id'             => $entity_id,
+                               'id'                    => $id,
+                               'type'                  => $this->type
                        );
 //_debug_array($link_data);
 
@@ -577,7 +1028,7 @@
                                'lang_name_standardtext'                        
=> lang('Enter a name of the standard'),
 
                                'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.category', 'entity_id'=> $entity_id)),
+                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.category', 'entity_id'=> $entity_id,'type' => 
$this->type)),
                                'lang_id'                                       
                => lang('Category'),
                                'lang_name'                                     
                => lang('Name'),
                                'lang_descr'                                    
        => lang('Descr'),
@@ -605,7 +1056,7 @@
                                'lang_tracking_statustext'                      
=> lang('If this entity type is to be tracket in ticket list'),
                                'lang_fileupload'                               
        => lang('Enable file upload'),
                                'value_fileupload'                              
        => $values['fileupload'],
-                               'lang_fileupload_statustext'            => 
lang('If files can be uploaded for this category'),
+                               'value_jasperupload'                            
=> $values['jasperupload'],
                                'lang_loc_link'                                 
        => lang('Link from location'),
                                'value_loc_link'                                
        => $values['loc_link'],
                                'lang_loc_link_statustext'                      
=> lang('Enable link from location detail'),
@@ -614,12 +1065,13 @@
                                'lang_start_project_statustext'         => 
lang('Enable start project from this category'),
                                'lang_start_ticket'                             
        => lang('Start ticket'),
                                'value_start_ticket'                            
=> $values['start_ticket'],
-                               'lang_start_ticket_statustext'          => 
lang('Enable start ticket from this category')
+                               'lang_start_ticket_statustext'          => 
lang('Enable start ticket from this category'),
+                               'jasperupload'                                  
        => true
                        );
 
                        $appname = lang('entity');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
@@ -634,23 +1086,34 @@
                        $entity_id              = phpgw::get_var('entity_id', 
'int');
                        $cat_id                 = phpgw::get_var('cat_id', 
'int');
                        $attrib_id              = phpgw::get_var('attrib_id', 
'int');
+                       $group_id               = phpgw::get_var('group_id', 
'int');
                        $acl_location           = 
phpgw::get_var('acl_location');
                        $custom_function_id     = 
phpgw::get_var('custom_function_id', 'int');
                        $confirm                = phpgw::get_var('confirm', 
'bool', 'POST');
 
-                       if($attrib_id):
+                       // JSON code delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
+                               
$this->bo->delete($cat_id,$entity_id,$attrib_id,$acl_location,$custom_function_id,$group_id);
+                               return lang("this record has been deleted");
+                       }
+
+                       if($group_id)
+                       {
+                               $function='list_attribute_group';
+                       }
+                       else if($attrib_id)
+                       {
                                $function='list_attribute';
                        }
-                       elseif($custom_function_id):
+                       else if($custom_function_id)
                        {
                                $function='list_custom_function';
                        }
-                       endif;
 
                        if (!$acl_location && $entity_id && $cat_id)
                        {
-                               $acl_location = '.entity.' . $entity_id . '.' . 
$cat_id;
+                               $acl_location = 
".{$this->type}.{$entity_id}.{$cat_id}";
                        }
 
                        if(!$function)
@@ -671,7 +1134,8 @@
                                'menuaction'    => 
'property.uiadmin_entity.'.$function,
                                'cat_id'        => $cat_id,
                                'entity_id'     => $entity_id,
-                               'attrib_id'     => $attrib_id
+                               'attrib_id'     => $attrib_id,
+                               'type'          => $this->type
                        );
 
                        $delete_data = array
@@ -679,17 +1143,13 @@
                                'menuaction'    => 
'property.uiadmin_entity.delete',
                                'cat_id'        => $cat_id,
                                'entity_id'     => $entity_id,
+                               'group_id'      => $group_id,
                                'attrib_id'     => $attrib_id,
                                'acl_location'  => $acl_location,
-                               'custom_function_id' => $custom_function_id
+                               'custom_function_id' => $custom_function_id,
+                               'type'                          => $this->type
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               
$this->bo->delete($cat_id,$entity_id,$attrib_id,$acl_location,$custom_function_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array
@@ -706,13 +1166,12 @@
                        $appname                = lang('entity');
                        $function_msg           = lang('delete entity type');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
-
-               function list_attribute()
+               function list_attribute_group()
                {
                        if(!$this->acl_read)
                        {
@@ -727,6 +1186,374 @@
                        $id     = phpgw::get_var('id', 'int');
                        $resort = phpgw::get_var('resort');
 
+                       if($resort)
+                       {
+                               $this->bo->resort_attrib_group($id,$resort);
+                       }
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                               {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uiadmin_entity.list_attribute_group',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'cat_id'        => $cat_id,
+                                       'type'          => $this->type
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_entity.list_attribute_group',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."entity_id:'{$this->entity_id}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."type:'{$this->type}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                                       (
+                                       'menuaction'    => 
'property.uiadmin_entity.list_attribute',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'cat_id'        => $cat_id,
+                                       'type'          => $this->type
+                               );
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_entity.list_attribute_group',
+                                                               'sort'          
=> $this->sort,
+                                                               'order'         
=> $this->order,
+                                                               'query'         
=> $this->query,
+                                                               'entity_id'     
=> $entity_id,
+                                                               'cat_id'        
=> $cat_id,
+                                                               'type'          
=> $this->type
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+                       $attrib_list = 
$this->bo->read_attrib_group($entity_id,$cat_id);
+                       $uicols['name'][0]      = 'name';
+                       $uicols['descr'][0]     = lang('Name');
+                       $uicols['name'][1]      = 'descr';
+                       $uicols['descr'][1]     = lang('Descr');
+                       $uicols['name'][2]      = 'group_sort';
+                       $uicols['descr'][2]     = lang('sorting');
+                       $uicols['name'][3]      = 'up';
+                       $uicols['descr'][3]     = lang('up');
+                       $uicols['name'][4]      = 'down';
+                       $uicols['descr'][4]     = lang('down');
+                       $uicols['name'][5]      = 'id';
+                       $uicols['descr'][5]     = lang('id');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($attrib_list) AND is_array($attrib_list))
+                       {
+                               foreach($attrib_list as $attrib_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$attrib_entry[$uicols['name'][$k]];
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'up')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'up';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute_group', 'resort'=> 'up', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $attrib_entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'down')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'down';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute_group', 'resort'=> 'down', 
'entity_id'=> $entity_id, 'cat_id'=> $cat_id, 'id'=> $attrib_entry['id'], 
'allrows'=> $this->allrows, 'type' => $this->type)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'group_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('Edit'),
+                                               'text'                  => 
lang('Edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_entity.edit_attrib_group',
+                                                               'entity_id'     
                => $entity_id,
+                                                               'cat_id'        
                => $cat_id,
+                                                               'type'          
                => $this->type
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('Delete'),
+                                               'text'                  => 
lang('Delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_entity.delete',
+                                                               'entity_id'     
                => $entity_id,
+                                                               'cat_id'        
                => $cat_id,
+                                                               'type'          
                => $this->type
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiadmin_entity.edit_attrib_group',
+                                                                               
'entity_id'                     => $entity_id,
+                                                                               
'cat_id'                        => $cat_id,
+                                                                               
'type'                          => $this->type
+                                                                       ))
+                                               );
+
+                       unset($parameters);
+                       unset($parameters2);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       }
+
+                                       if($uicols['name'][$i]=='name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($attrib_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname        = lang('attribute');
+                       $function_msg   = lang('list entity attribute');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'name'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
//$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 //$json_row[$column['name']] 
= "<a href='".$column['link']."'>" .$column['value']."</a>";
+                                                 $json_row[$column['name']] = 
"<a href='#' onclick='".$column['link']."'>" .$column['value']."</a>";
+                                                 //$json_row[$column['name']] 
= '<a href="#" 
onclick="delete_record("/index.php?menuaction=property.uiasync.delete")">' 
.$column['value'].'</a>';
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                               // query parameters
+                               if(isset($current_Consult) && 
is_array($current_Consult))
+                               {
+                                       $json ['current_consult'] = 
$current_Consult;
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_entity.attribute_group', 'property' );
+
+                       /*if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $entity_id      = $this->entity_id;
+                       $cat_id = $this->cat_id;
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::entity_{$entity_id}::entity_{$entity_id}_{$cat_id}";
+
+                       $id     = phpgw::get_var('id', 'int');
+                       $resort = phpgw::get_var('resort');
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
                                                                'admin_entity',
                                                                'nextmatchs',
@@ -734,9 +1561,9 @@
 
                        if($resort)
                        {
-                               $this->bo->resort_attrib($id,$resort);
+                               $this->bo->resort_attrib_group($id,$resort);
                        }
-                       $attrib_list = 
$this->bo->read_attrib($entity_id,$cat_id);
+                       $attrib_list = 
$this->bo->read_attrib_group($entity_id,$cat_id);
 
                        if (isset($attrib_list) AND is_array($attrib_list))
                        {
@@ -745,16 +1572,13 @@
 
                                        $content[] = array
                                        (
-                                               'name'                          
=> $entry['name'],
-                                               'datatype'                      
=> $entry['trans_datatype'],
-                                               'column_name'                   
=> $entry['column_name'],
-                                               'input_text'                    
=> $entry['input_text'],
-                                               'sorting'                       
=> $entry['attrib_sort'],
-                                               'search'                        
=> $entry['search'],
-                                               'link_up'                       
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute', 'resort'=> 'up', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows)),
-                                               'link_down'                     
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute', 'resort'=> 'down', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows)),
-                                               'link_edit'                     
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_attrib', 'entity_id'=> $entity_id, 'cat_id'=> 
$cat_id, 'id'=> $entry['id'])),
-                                               'link_delete'                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.delete', 'entity_id'=> $entity_id, 'cat_id'=> $cat_id, 
'attrib_id'=> $entry['id'])),
+                                               'name'                          
        => $entry['name'],
+                                               'descr'                         
        => $entry['descr'],
+                                               'sorting'                       
        => $entry['group_sort'],
+                                               'link_up'                       
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute_group', 'resort'=> 'up', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)),
+                                               'link_down'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute_group', 'resort'=> 'down', 
'entity_id'=> $entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)),
+                                               'link_edit'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_attrib_group', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id, 'id'=> $entry['id'], 'type' => $this->type)),
+                                               'link_delete'                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.delete', 'entity_id'=> $entity_id, 'cat_id'=> $cat_id, 
'group_id'=> $entry['id'], 'type' => $this->type)),
                                                'lang_up_text'                  
=> lang('shift up'),
                                                'lang_down_text'                
=> lang('shift down'),
                                                'lang_edit_text'                
=> lang('edit the attrib'),
@@ -773,9 +1597,7 @@
                        $table_header[] = array
                        (
                                'lang_descr'            => lang('Descr'),
-                               'lang_datatype'         => lang('Datatype'),
                                'lang_sorting'          => lang('sorting'),
-                               'lang_search'           => lang('search'),
                                'lang_edit'             => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'sort_name'             => 
$this->nextmatchs->show_sort_order(array
@@ -786,7 +1608,8 @@
                                                                                
        'extra' => array('menuaction'   => 
'property.uiadmin_entity.list_attribute',
                                                                                
                                                'entity_id'     =>$entity_id,
                                                                                
                                                'cat_id'        =>$cat_id,
-                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
                                                'allrows'=>$this->allrows,
+                                                                               
                                                'type'  => $this->type)
                                                                                
)),
                                'sort_sorting'          => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
@@ -796,7 +1619,8 @@
                                                                                
        'extra' => array('menuaction'   => 
'property.uiadmin_entity.list_attribute',
                                                                                
                                                'entity_id'     =>$entity_id,
                                                                                
                                                'cat_id'        =>$cat_id,
-                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
                                                'allrows'=>$this->allrows,
+                                                                               
                                                'type'  => $this->type)
                                                                                
)),
                                'lang_name'             => lang('Name'),
                        );
@@ -805,10 +1629,10 @@
                        (
                                'lang_add'              => lang('add'),
                                'lang_add_attribtext'   => lang('add an 
attrib'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_attrib', 'entity_id'=> $entity_id, 'cat_id'=> 
$cat_id)),
+                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_attrib_group', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id,'type' => $this->type)),
                                'lang_done'             => lang('done'),
                                'lang_done_attribtext'  => lang('back to 
admin'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.category', 'entity_id'=> $entity_id)),
+                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.category', 'entity_id'=> $entity_id, 'type' => 
$this->type)),
                        );
 
                        if(!$this->allrows)
@@ -827,7 +1651,8 @@
                                'order'         => $this->order,
                                'query'         => $this->query,
                                'entity_id'     => $entity_id,
-                               'cat_id'        => $cat_id
+                               'cat_id'        => $cat_id,
+                               'type'          => $this->type
                        );
 
                        $entity = $this->bo->read_single($entity_id,false);
@@ -835,35 +1660,574 @@
 
                        $data = array
                        (
+                               'lang_entity'                                   
        => lang('entity'),
+                               'entity_name'                                   
        => $entity['name'],
+                               'lang_category'                                 
        => lang('category'),
+                               'category_name'                                 
        => $category['name'],
+                               'allow_allrows'                                 
        => true,
+                               'allrows'                                       
                => $this->allrows,
+                               'start_record'                                  
        => $this->start,
+                               'record_limit'                                  
        => $record_limit,
+                               'start_record'                                  
        => $this->start,
+                               'num_records'                                   
        => count($attrib_list),
+                               'all_records'                                   
        => $this->bo->total_records,
+                               'link_url'                                      
                => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                                      
                => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                               'lang_searchfield_attribtext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
+                               'lang_searchbutton_attribtext'          => 
lang('Submit the search string'),
+                               'query'                                         
                => $this->query,
+                               'lang_search'                                   
        => lang('search'),
+                               'table_header_attrib_group'                     
=> $table_header,
+                               'values_attrib_group'                           
=> $content,
+                               'table_add'                                     
                => $table_add
+                       );
+
+                       $appname        = lang('attribute');
+                       $function_msg   = lang('list entity attribute group');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute_group' => 
$data));
+                       $this->save_sessiondata();*/
+               }
+
+               function list_attribute()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $entity_id      = $this->entity_id;
+                       $cat_id = $this->cat_id;
+
+                       $entity = $this->bo->read_single($entity_id);
+                       $category = 
$this->bo->read_single_category($entity_id,$cat_id);
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::entity_{$entity_id}::entity_{$entity_id}_{$cat_id}";
+
+                       $id     = phpgw::get_var('id');
+                       $resort = phpgw::get_var('resort');
+
+                       if($resort && phpgw::get_var('phpgw_return_as') == 
'json')
+                       {
+                               $this->bo->resort_attrib($id,$resort);
+                       }
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uiadmin_entity.list_attribute',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'cat_id'        => $cat_id,
+                                       'type'          => $this->type
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_entity.list_attribute',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."entity_id:'{$this->entity_id}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."type:'{$this->type}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uiadmin_entity.list_attribute',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'cat_id'        => $cat_id,
+                                       'type'          => $this->type
+                               );
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_entity.list_attribute',
+                                                               'sort'          
=> $this->sort,
+                                                               'order'         
=> $this->order,
+                                                               'query'         
=> $this->query,
+                                                               'entity_id'     
=> $entity_id,
+                                                               'cat_id'        
=> $cat_id,
+                                                               'type'          
=> $this->type
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
// mensaje
+                                                                               
                                        'type'  => 'label',
+                                                                               
                                        'id'    => 'msg_header',
+                                                                               
                                        'value' => '',
+                                                                               
                                        'style' => 'filter'
+                                                                               
                                ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       ),
+                                                                               
                                array( //container of  control's Form
+                                                                               
                                        'type'  => 'label',
+                                                                               
                                        'id'    => 'controlsForm_container',
+                                                                               
                                        'value' => ''
+                                                                               
                                )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+                       $attrib_list = 
$this->bo->read_attrib($entity_id,$cat_id);
+                       $uicols['name'][0]      = 'column_name';
+                       $uicols['descr'][0]     = lang('Name');
+                       $uicols['name'][1]      = 'input_text';
+                       $uicols['descr'][1]     = lang('Descr');
+                       $uicols['name'][2]      = 'trans_datatype';
+                       $uicols['descr'][2]     = lang('Datatype');
+                       $uicols['name'][3]      = 'group_id';
+                       $uicols['descr'][3]     = lang('group');
+                       $uicols['name'][4]      = 'attrib_sort';
+                       $uicols['descr'][4]     = lang('sorting');
+                       $uicols['name'][5]      = 'up';
+                       $uicols['descr'][5]     = lang('up');
+                       $uicols['name'][6]      = 'down';
+                       $uicols['descr'][6]     = lang('down');
+                       $uicols['name'][7]      = 'search';
+                       $uicols['descr'][7]     = lang('Search');
+                       $uicols['name'][8]      = 'id';
+                       $uicols['descr'][8]     = lang('id');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($attrib_list) AND is_array($attrib_list))
+                       {
+                               foreach($attrib_list as $attrib_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$attrib_entry[$uicols['name'][$k]];
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'up')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'up';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute', 'resort'=> 'up', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $attrib_entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'down')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'down';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute', 'resort'=> 'down', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $attrib_entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $current_Consult = array ();
+                       for($i=0;$i<2;$i++)
+                       {
+                               if($i==0)
+                               {
+                                       $current_Consult[] = 
array('entity',$entity['name']);
+                               }
+                               if($i==1)
+                               {
+                                       $current_Consult[] = 
array('Category',$category['name']);
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'attrib_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('Edit'),
+                                               'text'                  => 
lang('Edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_entity.edit_attrib',
+                                                               'entity_id'     
                => $entity_id,
+                                                               'cat_id'        
                => $cat_id,
+                                                               'type'          
                => $this->type
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('Delete'),
+                                               'text'                  => 
lang('Delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_entity.delete',
+                                                               'entity_id'     
                => $entity_id,
+                                                               'cat_id'        
                => $cat_id,
+                                                               'type'          
                => $this->type
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiadmin_entity.edit_attrib',
+                                                                               
'entity_id'                     => $entity_id,
+                                                                               
'cat_id'                        => $cat_id,
+                                                                               
'type'                          => $this->type
+                                                                       ))
+                                               );
+
+                       unset($parameters);
+                       unset($parameters2);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='column_name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'column_name';
+                                       }
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       }
+                                       if($uicols['name'][$i]=='attrib_sort')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'attrib_sort';
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($attrib_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname        = lang('attribute');
+                       $function_msg   = lang('list entity attribute');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'column_name'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
//$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 //$json_row[$column['name']] 
= "<a href='".$column['link']."'>" .$column['value']."</a>";
+                                                 $json_row[$column['name']] = 
"<a href='#' onclick='".$column['link']."'>" .$column['value']."</a>";
+                                                 //$json_row[$column['name']] 
= '<a href="#" 
onclick="delete_record("/index.php?menuaction=property.uiasync.delete")">' 
.$column['value'].'</a>';
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                               if(isset($current_Consult) && 
is_array($current_Consult))
+                               {
+                                       $json ['current_consult'] = 
$current_Consult;
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_entity.attribute', 'property' );
+               }
+
+               function edit_attrib_group()
+               {
+                       if(!$this->acl_add)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $entity_id      = phpgw::get_var('entity_id', 'int');
+                       $cat_id         = phpgw::get_var('cat_id', 'int');
+                       $id                     = phpgw::get_var('id', 'int');
+                       $values         = phpgw::get_var('values');
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::entity_{$entity_id}::entity_{$entity_id}_{$cat_id}";
+
+                       if(!$values)
+                       {
+                               $values=array();
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
+
+                       if (isset($values['save']) && $values['save'])
+                       {
+                               if($id)
+                               {
+                                       $values['id']=$id;
+                                       $action='edit';
+                               }
+
+                               $values['entity_id']=$entity_id;
+                               $values['cat_id']=$cat_id;
+
+                               if (!$values['group_name'])
+                               {
+                                       $receipt['error'][] = 
array('msg'=>lang('group name not entered!'));
+                               }
+
+                               if (!$values['descr'])
+                               {
+                                       $receipt['error'][] = 
array('msg'=>lang('description not entered!'));
+                               }
+
+                               if (!$values['entity_id'])
+                               {
+                                       $receipt['error'][] = 
array('msg'=>lang('entity type not chosen!'));
+                               }
+
+
+                               if (!isset($receipt['error']))
+                               {
+                                       $receipt = 
$this->bo->save_attrib_group($values,$action);
+
+                                       if(!$id)
+                                       {
+                                               $id=$receipt['id'];
+                                       }
+                               }
+                               else
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('Attribute group has NOT been saved'));
+                               }
+                       }
+
+                       if ($id)
+                       {
+                               $values = 
$this->bo->read_single_attrib_group($entity_id,$cat_id,$id);
+                               $type_name=$values['type_name'];
+                               $function_msg = lang('edit attribute group'). ' 
' . lang($type_name);
+                               $action='edit';
+                       }
+                       else
+                       {
+                               $function_msg = lang('add attribute group');
+                               $action='add';
+                       }
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'property.uiadmin_entity.edit_attrib_group',
+                               'entity_id'     => $entity_id,
+                               'cat_id'        => $cat_id,
+                               'id'            => $id,
+                               'type'          => $this->type
+                       );
+
+
+                       $entity = $this->bo->read_single($entity_id,false);
+                       $category = 
$this->bo->read_single_category($entity_id,$cat_id);
+
+                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
+
+                       $data = array
+                       (
                                'lang_entity'                                   
=> lang('entity'),
                                'entity_name'                                   
=> $entity['name'],
                                'lang_category'                                 
=> lang('category'),
                                'category_name'                                 
=> $category['name'],
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'start_record'                                  
=> $this->start,
-                               'num_records'                                   
=> count($attrib_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_attribtext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_attribtext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_attrib'                           
=> $table_header,
-                               'values_attrib'                                 
=> $content,
-                               'table_add'                                     
=> $table_add
+
+                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute_group', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id, 'type' => $this->type)),
+                               'lang_id'                                       
                => lang('Attribute group ID'),
+                               'lang_entity_type'                              
        => lang('Entity type'),
+                               'lang_no_entity_type'                           
=> lang('No entity type'),
+                               'lang_save'                                     
                => lang('save'),
+                               'lang_done'                                     
                => lang('done'),
+                               'value_id'                                      
                => $id,
+
+                               'lang_group_name'                               
        => lang('group name'),
+                               'value_group_name'                              
        => $values['group_name'],
+                               'lang_group_name_statustext'            => 
lang('enter the name for the group'),
+
+                               'lang_descr'                                    
        => lang('descr'),
+                               'value_descr'                                   
        => $values['descr'],
+                               'lang_descr_statustext'                         
=> lang('enter the input text for records'),
+
+                               'lang_remark'                                   
        => lang('remark'),
+                               'lang_remark_statustext'                        
=> lang('Enter a remark for the group'),
+                               'value_remark'                                  
        => $values['remark'],
+
+                               'lang_done_attribtext'                          
=> lang('Back to the list'),
+                               'lang_save_attribtext'                          
=> lang('Save the attribute')
                        );
+//_debug_array($values);
 
-                       $appname        = lang('attribute');
-                       $function_msg   = lang('list entity attribute');
+                       $appname = lang('entity');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib_group' => 
$data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
                }
 
                function edit_attrib()
@@ -877,6 +2241,9 @@
                        $cat_id         = phpgw::get_var('cat_id', 'int');
                        $id             = phpgw::get_var('id', 'int');
                        $values         = phpgw::get_var('values');
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::entity_{$entity_id}::entity_{$entity_id}_{$cat_id}";
+
                        if(!$values)
                        {
                                $values=array();
@@ -976,7 +2343,8 @@
                                'menuaction'    => 
'property.uiadmin_entity.edit_attrib',
                                'entity_id'     => $entity_id,
                                'cat_id'        => $cat_id,
-                               'id'            => $id
+                               'id'            => $id,
+                               'type'          => $this->type
                        );
 
                        if($values['column_info']['type']=='R' || 
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
@@ -1007,7 +2375,7 @@
 
                                'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute', 'entity_id'=> $entity_id, 'cat_id'=> 
$cat_id)),
+                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_attribute', 'entity_id'=> $entity_id, 'cat_id'=> 
$cat_id, 'type' => $this->type)),
                                'lang_id'                                       
                => lang('Attribute ID'),
                                'lang_entity_type'                              
        => lang('Entity type'),
                                'lang_no_entity_type'                           
=> lang('No entity type'),
@@ -1038,6 +2406,11 @@
                                'lang_no_datatype'                              
        => lang('No datatype'),
                                'datatype_list'                                 
        => $this->bocommon->select_datatype($values['column_info']['type']),
 
+                               'lang_group'                                    
        => lang('group'),
+                               'lang_group_statustext'                         
=> lang('Select a group'),
+                               'lang_no_group'                                 
=> lang('no group'),
+                               'attrib_group_list'                             
        => $this->bo->get_attrib_group_list($entity_id,$cat_id, 
$values['group_id']),
+
                                'lang_precision'                                
        => lang('Precision'),
                                'lang_precision_statustext'                     
=> lang('enter the record length'),
                                'value_precision'                               
        => $values['column_info']['precision'],
@@ -1080,7 +2453,7 @@
 
                        $appname = lang('entity');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
@@ -1097,6 +2470,374 @@
                        $id             = phpgw::get_var('id', 'int');
                        $resort         = phpgw::get_var('resort');
 
+                       if($resort)
+                       {
+                               $this->bo->resort_custom_function($id,$resort);
+                       }
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uiadmin_entity.list_custom_function',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'cat_id'        => $cat_id,
+                                       'type'          => $this->type
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_entity.list_custom_function',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."entity_id:'{$this->entity_id}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."type:'{$this->type}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uiadmin_entity.list_custom_function',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'entity_id'     => $entity_id,
+                                       'cat_id'        => $cat_id,
+                                       'type'          => $this->type
+                               );
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_entity.list_custom_function',
+                                                               'sort'          
=> $this->sort,
+                                                               'order'         
=> $this->order,
+                                                               'query'         
=> $this->query,
+                                                               'entity_id'     
=> $entity_id,
+                                                               'cat_id'        
=> $cat_id,
+                                                               'type'          
=> $this->type
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+                       $custom_function_list = 
$this->bo->read_custom_function($entity_id,$cat_id);
+                       $uicols['name'][0]      = 'name';
+                       $uicols['descr'][0]     = '';//FIXME
+                       $uicols['name'][1]      = 'id';
+                       $uicols['descr'][1]     = lang('id');
+                       $uicols['name'][2]      = 'descr';
+                       $uicols['descr'][2]     = lang('Descr');
+                       $uicols['name'][3]      = 'active';
+                       $uicols['descr'][3]     = lang('Active');
+                       $uicols['name'][4]      = 'sorting';
+                       $uicols['descr'][4]     = lang('sorting');
+                       $uicols['name'][5]      = 'up';
+                       $uicols['descr'][5]     = lang('up');
+                       $uicols['name'][6]      = 'down';
+                       $uicols['descr'][6]     = lang('down');
+                       $uicols['name'][7]      = 'file_name';
+                       $uicols['descr'][7]     = lang('Name');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($custom_function_list) AND 
is_array($custom_function_list))
+                       {
+                               foreach($custom_function_list as $custom_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$custom_entry[$uicols['name'][$k]];
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'up')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'resort'=> 'up', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $custom_entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'down')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'resort'=> 'down', 
'entity_id'=> $entity_id, 'cat_id'=> $cat_id, 'id'=> $custom_entry['id'], 
'allrows'=> $this->allrows, 'type' => $this->type)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
'custom_function_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('Edit'),
+                                               'text'                  => 
lang('Edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_entity.edit_custom_function',
+                                                               'entity_id'     
                => $entity_id,
+                                                               'cat_id'        
                => $cat_id,
+                                                               'type'          
                => $this->type
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('Delete'),
+                                               'text'                  => 
lang('Delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_entity.delete',
+                                                               'entity_id'     
                => $entity_id,
+                                                               'cat_id'        
                => $cat_id,
+                                                               'type'          
                => $this->type,
+                                                               'acl_location'  
        => ".{$this->type}.{$entity_id}.{$cat_id}"
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiadmin_entity.edit_custom_function',
+                                                                               
'entity_id'                     => $entity_id,
+                                                                               
'cat_id'                        => $cat_id,
+                                                                               
'type'                          => $this->type
+                                                                       ))
+                                               );
+
+                       unset($parameters);
+                       unset($parameters2);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       /*if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       }
+
+                                       if($uicols['name'][$i]=='name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }*/
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($custom_function_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname        = lang('custom function');
+                       $function_msg   = lang('list entity custom function');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'name'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
//$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='#' onclick='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                               // query parameters
+                               if(isset($current_Consult) && 
is_array($current_Consult))
+                               {
+                                       $json ['current_consult'] = 
$current_Consult;
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_entity.function_group', 'property' );
+
+                       /*if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $entity_id      = $this->entity_id;
+                       $cat_id         = $this->cat_id;
+                       $id             = phpgw::get_var('id', 'int');
+                       $resort         = phpgw::get_var('resort');
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
                                                                'admin_entity',
                                                                'nextmatchs',
@@ -1119,10 +2860,10 @@
                                                'descr'                         
        => $entry['descr'],
                                                'sorting'                       
        => $entry['sorting'],
                                                'active'                        
        => $entry['active']?'X':'',
-                                               'link_up'                       
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'resort'=>'up', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows)),
-                                               'link_down'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'resort'=>'down', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows)),
-                                               'link_edit'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_custom_function', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id, 'id'=> $entry['id'])),
-                                               'link_delete'                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.delete', 'entity_id'=> $entity_id, 'cat_id'=> $cat_id, 
'custom_function_id'=> $entry['id'])),
+                                               'link_up'                       
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'resort'=>'up', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)),
+                                               'link_down'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'resort'=>'down', 'entity_id'=> 
$entity_id, 'cat_id'=> $cat_id, 'id'=> $entry['id'], 'allrows'=> 
$this->allrows, 'type' => $this->type)),
+                                               'link_edit'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_custom_function', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id, 'id'=> $entry['id'], 'type' => $this->type)),
+                                               'link_delete'                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.delete', 'entity_id'=> $entity_id, 'cat_id'=> $cat_id, 
'custom_function_id'=> $entry['id'], 'type' => $this->type)),
                                                'lang_up_text'                  
        => lang('shift up'),
                                                'lang_down_text'                
        => lang('shift down'),
                                                'lang_edit_text'                
        => lang('edit the custom_function'),
@@ -1152,7 +2893,8 @@
                                                                                
        'extra' => array('menuaction'   => 
'property.uiadmin_entity.list_custom_function',
                                                                                
                                                'entity_id'     => $entity_id,
                                                                                
                                                'cat_id'        => $cat_id,
-                                                                               
                                                'allrows'       => 
$this->allrows)
+                                                                               
                                                'allrows'       => 
$this->allrows,
+                                                                               
                                                'type'          => $this->type)
                                                                                
)),
                                'sort_sorting'          => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
@@ -1162,7 +2904,8 @@
                                                                                
        'extra' => array('menuaction'   => 
'property.uiadmin_entity.list_custom_function',
                                                                                
                                                'entity_id'     =>$entity_id,
                                                                                
                                                'cat_id'        =>$cat_id,
-                                                                               
                                                'allrows'       
=>$this->allrows)
+                                                                               
                                                'allrows'       
=>$this->allrows,
+                                                                               
                                                'type'          => $this->type)
                                                                                
)),
                                'lang_name'             => lang('Name'),
                        );
@@ -1171,10 +2914,10 @@
                        (
                                'lang_add'                      => lang('add'),
                                'lang_add_custom_functiontext'  => lang('add a 
custom_function'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_custom_function', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id)),
+                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.edit_custom_function', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id,'type' => $this->type)),
                                'lang_done'                     => lang('done'),
                                'lang_done_custom_functiontext' => lang('back 
to admin'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.category', 'entity_id'=> $entity_id)),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.category', 'entity_id'=> $entity_id,'type' => 
$this->type)),
                        );
 
                        if(!$this->allrows)
@@ -1193,7 +2936,8 @@
                                'order'         => $this->order,
                                'query'         => $this->query,
                                'entity_id'     => $entity_id,
-                               'cat_id'        => $cat_id
+                               'cat_id'        => $cat_id,
+                               'type'          => $this->type
                        );
 
                        $entity = $this->bo->read_single($entity_id,false);
@@ -1226,10 +2970,10 @@
                        $appname        = lang('custom function');
                        $function_msg   = lang('list entity custom function');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_custom_function' => 
$data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+                       $this->save_sessiondata();*/
                }
 
                function edit_custom_function()
@@ -1304,7 +3048,8 @@
                                'menuaction'    => 
'property.uiadmin_entity.edit_custom_function',
                                'entity_id'     => $entity_id,
                                'cat_id'        => $cat_id,
-                               'id'            => $id
+                               'id'            => $id,
+                               'type'          => $this->type
                        );
 
 
@@ -1324,7 +3069,7 @@
 
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id)),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_entity.list_custom_function', 'entity_id'=> $entity_id, 
'cat_id'=> $cat_id, 'type' => $this->type)),
                                'lang_id'                                       
=> lang('Custom function ID'),
                                'lang_entity_type'                              
=> lang('Entity type'),
                                'lang_no_entity_type'                           
=> lang('No entity type'),
@@ -1351,7 +3096,7 @@
 
                        $appname = lang('entity');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_custom_function' => 
$data));
                }
        }

Modified: 
people/sigurdne/modules/property/trunk/inc/class.uiadmin_location.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiadmin_location.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiadmin_location.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -50,8 +51,10 @@
                        'view'                  => true,
                        'edit'                  => true,
                        'delete'                => true,
-                       'list_attribute'=> true,
+                       'list_attribute'                => true,
                        'edit_attrib'   => true,
+                       'list_attribute_group'  => true,
+                       'edit_attrib_group'             => true,
                );
 
                function property_uiadmin_location()
@@ -102,6 +105,325 @@
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::location';
 
                        $this->bocommon->reset_fm_cache();
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uiadmin_location.index'
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_location.index'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uiadmin_location.index'
+                               );
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_location.index'
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+                       $standard_list = $this->bo->read();
+                       $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('standard id');
+                       $uicols['name'][1]      = 'name';
+                       $uicols['descr'][1]     = lang('Name');
+                       $uicols['name'][2]      = 'descr';
+                       $uicols['descr'][2]     = lang('Descr');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($standard_list) AND is_array($standard_list))
+                       {
+                               foreach($standard_list as $standard_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $standard_entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'type_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'categories',
+                                               'statustext'    => 
lang('categories'),
+                                               'text'                  => 
lang('Categories'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uicategory.index',
+                                                                       'type'  
                => 'location'
+
+                                                               )),
+                                       'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'attribute_groups',
+                                               'statustext'    => 
lang('attribute groups'),
+                                               'text'                  => 
lang('attribute groups'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_location.list_attribute_group'
+                                                               )),
+                                       'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'attributes',
+                                               'statustext'    => 
lang('attributes'),
+                                               'text'                  => 
lang('Attributes'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_location.list_attribute'
+
+                                                               )),
+                                       'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('edit'),
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_location.edit'
+                                                               )),
+                                       'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('delete'),
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiadmin_location.delete'
+                                                               )),
+                                       'parameters'    => $parameters
+                                       );
+
+
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                       (
+                                               'menuaction'    => 
'property.uiadmin_location.edit'
+                                       )));
+
+                       unset($parameters);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
+                                       }
+                                       if($uicols['name'][$i]=='name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($standard_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                = lang('entity');
+                       $function_msg   = lang('list entity type');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_location.index', 'property' );
+                       /*if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::location';
+
+                       $this->bocommon->reset_fm_cache();
                        $GLOBALS['phpgw']->xslttpl->add_file(array(
                                                                
'admin_location',
                                                                'nextmatchs',
@@ -118,6 +440,7 @@
                                        'first'                                 
                => $standard['descr'],
                                        'link_categories'                       
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type'=>'location', 'type_id'=> $standard['id'])),
                                        'link_attribute'                        
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute', 'type_id'=> $standard['id'])),
+                                       'link_attribute_group'                  
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute_group', 'type_id'=> $standard['id'])),
                                        'link_edit'                             
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.edit' ,'id'=> $standard['id'])),
                                        'link_delete'                           
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.delete' ,'id'=> $standard['id'])),
                                        'lang_view_standardtext'                
=> lang('view the standard'),
@@ -127,6 +450,7 @@
                                        'lang_delete_standardtext'              
=> lang('delete the standard'),
                                        'text_categories'                       
        => lang('Categories'),
                                        'text_attribute'                        
        => lang('Attributes'),
+                                       'text_attribute_group'                  
=> lang('attribute groups'),
                                        'text_edit'                             
                => lang('edit'),
                                        'text_delete'                           
        => lang('delete')
                                );
@@ -199,7 +523,7 @@
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+                       $this->save_sessiondata();*/
                }
 
                function edit()
@@ -302,11 +626,27 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 8, 'acl_location'=> $this->acl_location));
                        }
 
+                       $group_id   = phpgw::get_var('group_id', 'int');
                        $attrib         = phpgw::get_var('attrib');
                        $type_id        = phpgw::get_var('type_id', 'int');
                        $id                     = phpgw::get_var('id', 'int');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $receipt =  
$this->bo->delete($type_id,$id,$attrib,$group_id);
+
+                               //FIXME
+                               if(isset($receipt['message']))
+                               {
+                                       return $receipt['message'][0]['msg'];
+                               }
+                               else
+                               {
+                                       return $receipt['error'][0]['msg'];
+                               }
+                       }
+                       
                        if($attrib)
                        {
                                $function='list_attribute';
@@ -321,12 +661,6 @@
                                'type_id' => $type_id
                        );
 
-                       if ($confirm)
-                       {
-                               $this->bo->delete($type_id,$id,$attrib);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array
@@ -348,8 +682,7 @@
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
-
-               function list_attribute()
+               function list_attribute_group()
                {
                        if(!$this->acl_read)
                        {
@@ -357,100 +690,517 @@
                        }
 
                        $type_id        = phpgw::get_var('type_id', 'int');
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::location::attribute_loc_{$type_id}";
+
+                       $location       = ".location.{$type_id}";
                        $id     = phpgw::get_var('id', 'int');
                        $resort = phpgw::get_var('resort');
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::location::attribute_loc_{$type_id}";
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                               
'admin_location',
-                                                               'nextmatchs',
-                                                               
'search_field'));
-
                        if($resort)
                        {
-                               
$this->bo->resort_attrib(array('resort'=>$resort,'type_id' => 
$type_id,'id'=>$id));
+                               $this->bo->resort_attrib_group($location, $id, 
$resort);
                        }
 
-                       $type = $this->bo->read_single($type_id);
+                       $datatable = array();
 
-                       $attrib_list = $this->bo->read_attrib($type_id);
-
-                       while (is_array($attrib_list) && list(,$attrib) = 
each($attrib_list))
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
-                               $content[] = array
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
                                (
-                                       'datatype'                              
        => $attrib['trans_datatype'],
-                                       'column_name'                           
=> $attrib['column_name'],
-                                       'input_text'                            
=> $attrib['input_text'],
-                                       'sorting'                               
        => $attrib['attrib_sort'],
-                                       'link_up'                               
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute', 'resort'=> 'up', 'id'=> 
$attrib['id'], 'type_id'=> $type_id, 'allrows'=> $this->allrows)),
-                                       'link_down'                             
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute', 'resort'=> 'down', 'id'=> 
$attrib['id'], 'type_id'=> $type_id, 'allrows'=> $this->allrows)),
-                                       'link_edit'                             
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.edit_attrib', 'id'=> $attrib['id'], 'type_id'=> 
$type_id)),
-                                       'link_delete'                           
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.delete', 'id'=> $attrib['id'], 'type_id'=> $type_id, 
'attrib'=>true)),
-                                       'lang_view_attribtext'          => 
lang('view the attrib'),
-                                       'lang_attribute_attribtext'     => 
lang('attributes for the attrib'). ' ' . lang('location'),
-                                       'lang_edit_attribtext'          => 
lang('edit the attrib'),
-                                       'lang_delete_attribtext'        => 
lang('delete the attrib'),
-                                       'text_attribute'                        
=> lang('Attributes'),
-                                       'text_up'                               
        => lang('up'),
-                                       'text_down'                             
        => lang('down'),
-                                       'text_edit'                             
        => lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
-                               );
-                       }
+                               'menuaction'    => 
'property.uiadmin_location.list_attribute',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'query'         => $this->query,
+                                       'type_id'       => $type_id
+                               ));
 
-//_debug_array($content);
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_location.list_attribute_group',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."type_id:'{$type_id}'";
 
-                       $table_header[] = array
-                       (
-                               'lang_descr'            => lang('Descr'),
-                               'lang_datatype'         => lang('Datatype'),
-                               'lang_sorting'          => lang('sorting'),
-                               'lang_edit'                     => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_sorting'          => 
$this->nextmatchs->show_sort_order(array
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
                                                                                
(
+                                       'menuaction'    => 
'property.uiadmin_location.list_attribute',
                                                                                
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'attrib_sort',
                                                                                
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 
'property.uiadmin_location.list_attribute',
+                                       'query'         => $this->query,
                                                                                
                                        'type_id'       => $type_id,
-                                                                               
                                        'allrows'       => $this->allrows)
-                                                                               
)),
+                               );
 
-                               'sort_name'                     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_location.list_attribute',
                                                                                
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'column_name',
                                                                                
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 
'property.uiadmin_location.list_attribute',
-                                                                               
                                                'type_id'       =>$type_id,
-                                                                               
                                                'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'lang_name'                     => lang('Name'),
+                                                               'query'         
=> $this->query,
+                                                               'type_id'       
=> $type_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
                        );
 
-                       $table_add[] = array
+                               $dry_run = true;
+                       }
+
+                       $attrib_list = $this->bo->read_attrib_group($location);
+                       $uicols['name'][0]      = 'name';
+                       $uicols['descr'][0]     = lang('Name');
+                       $uicols['name'][1]      = 'descr';
+                       $uicols['descr'][1]     = lang('Descr');
+                       $uicols['name'][2]      = 'group_sort';
+                       $uicols['descr'][2]     = lang('sorting');
+                       $uicols['name'][3]      = 'up';
+                       $uicols['descr'][3]     = lang('up');
+                       $uicols['name'][4]      = 'down';
+                       $uicols['descr'][4]     = lang('down');
+                       $uicols['name'][5]      = 'id';
+                       $uicols['descr'][5]     = lang('id');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($attrib_list) AND is_array($attrib_list))
+                       {
+                               foreach($attrib_list as $attrib_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$attrib_entry[$uicols['name'][$k]];
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'up')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'up';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute_group', 'resort'=> 'up', 'type_id'=> 
$type_id, 'id'=> $attrib_entry['id'], 'allrows'=> $this->allrows)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+
+                                               
if($datatable['rows']['row'][$j]['column'][$k]['name'] == 'down')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'down';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute_group', 'resort'=> 'down', 
'type_id'=> $type_id, 'id'=> $attrib_entry['id'], 'allrows'=> 
$this->allrows)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.')';
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
                        (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_attribtext'   => lang('add an 
attrib'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.edit_attrib', 'type_id'=> $type_id)),
-                               'lang_done'                             => 
lang('done'),
-                               'lang_done_attribtext'  => lang('back to 
admin'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.index')),
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
                        );
 
-                       if(!$this->allrows)
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'group_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('Edit'),
+                                               'text'                  => 
lang('Edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_location.edit_attrib_group',
+                                                               'type_id'       
                => $type_id
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('Delete'),
+                                               'text'                  => 
lang('Delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_location.delete',
+                                                               'type_id'       
                => $type_id
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiadmin_location.edit_attrib_group',
+                                                                               
'type_id'                               => $type_id
+                                                                       ))
+                                               );
+
+                       unset($parameters);
+                       unset($parameters2);
+
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       }
+
+                                       if($uicols['name'][$i]=='name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }
+                               }
                        }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($attrib_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname        = lang('attribute');
+                       $function_msg   = lang('list entity attribute');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'name'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='#' onclick='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                               // query parameters
+                               if(isset($current_Consult) && 
is_array($current_Consult))
+                               {
+                                       $json ['current_consult'] = 
$current_Consult;
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_location.attribute_group', 'property' );
+               }
+
+               function edit_attrib_group()
+               {
+                       if(!$this->acl_add)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $type_id        = phpgw::get_var('type_id', 'int');
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::location::attribute_loc_{$type_id}";
+                       $location       = ".location.{$type_id}";
+                       $id                     = phpgw::get_var('id', 'int');
+                       $values         = phpgw::get_var('values');
+                       if(!$values)
+                       {
+                               $values=array();
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
+
+                       if (isset($values['save']) && $values['save'])
+                       {
+                               if($id)
+                               {
+                                       $values['id']=$id;
+                                       $action='edit';
+                               }
+
+                               $values['location'] = $location;
+
+                               if (!$values['group_name'])
+                               {
+                                       $receipt['error'][] = 
array('msg'=>lang('group name not entered!'));
+                               }
+
+                               if (!$values['descr'])
+                               {
+                                       $receipt['error'][] = 
array('msg'=>lang('description not entered!'));
+                               }
+
+                               if (!$location)
+                               {
+                                       $receipt['error'][] = 
array('msg'=>lang('location not chosen!'));
+                               }
+
+
+                               if (!isset($receipt['error']))
+                               {
+                                       $receipt = 
$this->bo->save_attrib_group($values,$action);
+
+                                       if(!$id)
+                                       {
+                                               $id=$receipt['id'];
+                                       }
+                               }
+                               else
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('Attribute group has NOT been saved'));
+                               }
+                       }
+
+                       if ($id)
+                       {
+                               $values = 
$this->bo->read_single_attrib_group($location,$id);
+                               $type_name=$values['type_name'];
+                               $function_msg = lang('edit attribute group'). ' 
' . lang($type_name);
+                               $action='edit';
+                       }
+                       else
+                       {
+                               $function_msg = lang('add attribute group');
+                               $action='add';
+                       }
+
                        $link_data = array
                        (
+                               'menuaction'    => 
'property.uiadmin_location.edit_attrib_group',
+                               'type_id'       => $type_id,
+                               'id'            => $id
+                       );
+
+
+                       $type = $this->bo->read_single( $type_id,false);
+
+                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
+
+                       $data = array
+                       (
+                               'lang_entity'                                   
        => lang('location'),
+                               'entity_name'                                   
        => $type['name'],
+
+                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute_group', 'type_id'=> $type_id)),
+                               'lang_id'                                       
                => lang('Attribute group ID'),
+                               'lang_entity_type'                              
        => lang('Entity type'),
+                               'lang_no_entity_type'                           
=> lang('No entity type'),
+                               'lang_save'                                     
                => lang('save'),
+                               'lang_done'                                     
                => lang('done'),
+                               'value_id'                                      
                => $id,
+
+                               'lang_group_name'                               
        => lang('group name'),
+                               'value_group_name'                              
        => $values['group_name'],
+                               'lang_group_name_statustext'            => 
lang('enter the name for the group'),
+
+                               'lang_descr'                                    
        => lang('descr'),
+                               'value_descr'                                   
        => $values['descr'],
+                               'lang_descr_statustext'                         
=> lang('enter the input text for records'),
+
+                               'lang_remark'                                   
        => lang('remark'),
+                               'lang_remark_statustext'                        
=> lang('Enter a remark for the group'),
+                               'value_remark'                                  
        => $values['remark'],
+
+                               'lang_done_attribtext'                          
=> lang('Back to the list'),
+                               'lang_save_attribtext'                          
=> lang('Save the attribute')
+                       );
+
+                       $appname = lang('location');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib_group' => 
$data));
+               }
+
+
+               function list_attribute()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $type_id        = phpgw::get_var('type_id', 'int');
+                       $id     = phpgw::get_var('id', 'int');
+                       $resort = phpgw::get_var('resort');
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::location::attribute_loc_{$type_id}";
+
+                       if($resort)
+                       {
+                               
$this->bo->resort_attrib(array('resort'=>$resort,'type_id' => 
$type_id,'id'=>$id));
+                       }
+
+                       $type = $this->bo->read_single($type_id);
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uiadmin_location.list_attribute',
+                                       'sort'                  => $this->sort,
+                                       'order'                 => $this->order,
+                                       'query'                 => $this->query,
+                                       'type_id'               => $type_id,
+                                       'allrows'               => 
$this->allrows
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiadmin_location.list_attribute',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."type_id:'{$type_id}',"
+                                                                               
."allrows:'{$this->allrows}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                               (
                                'menuaction'    => 
'property.uiadmin_location.list_attribute',
                                'sort'                  => $this->sort,
                                'order'                 => $this->order,
@@ -458,34 +1208,310 @@
                                'type_id'               => $type_id
                        );
 
-                       $data = array
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiadmin_location.list_attribute',
+                                                               'sort'          
        => $this->sort,
+                                                               'order'         
        => $this->order,
+                               'query'                                         
        => $this->query,
+                                                               'type_id'       
        => $type_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 1
+                                                                               
    ),
+                                                                               
    array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 2
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 4
+                                                                       ),
+                                                                       array(
+                                                                           
'id' => 'txtcategory',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => 'Location type: '.$type['name'],
+                                                                           
'type' => 'label',
+                                                                           
'style' => 'filter'
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+                       $attrib_list = $this->bo->read_attrib($type_id);
+                       $uicols['name'][0]      = 'column_name';
+                       $uicols['descr'][0]     = lang('Name');
+                       $uicols['name'][1]      = 'input_text';
+                       $uicols['descr'][1]     = lang('Descr');
+                       $uicols['name'][2]      = 'trans_datatype';
+                       $uicols['descr'][2]     = lang('Datatype');
+                       $uicols['name'][3]      = 'group_id';
+                       $uicols['descr'][3]     = lang('group');
+                       $uicols['name'][4]      = 'attrib_sort';
+                       $uicols['descr'][4]     = lang('sorting');
+                       $uicols['name'][5]      = 'up';
+                       $uicols['descr'][5]     = lang('up');
+                       $uicols['name'][6]      = 'down';
+                       $uicols['descr'][6]     = lang('down');
+                       $uicols['name'][7]      = 'id';
+                       $uicols['descr'][7]     = lang('id');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($attrib_list) AND is_array($attrib_list))
+                       {
+                               foreach($attrib_list as $attrib_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                       //                      
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
isset($attrib_entry[$uicols['name'][$k]]) ? $attrib_entry[$uicols['name'][$k]] 
: '';
+                                               }
+
+                                               
if(isset($datatable['rows']['row'][$j]['column'][$k]['name']) && 
$datatable['rows']['row'][$j]['column'][$k]['name'] == 'up')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'up';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute', 'resort'=> 'up', 'id'=> 
$attrib_entry['id'], 'allrows'=> $this->allrows, 'type_id' => $type_id)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.',"' . $this->allrows . '")';
+                                               }
+
+                                               
if(isset($datatable['rows']['row'][$j]['column'][$k]['name']) && 
$datatable['rows']['row'][$j]['column'][$k]['name'] == 'down')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
'down';//$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                                       $url = 
'"'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiadmin_location.list_attribute', 'resort'=> 'down', 'id'=> 
$attrib_entry['id'], 'allrows'=> $this->allrows, 'type_id' => $type_id)).'"';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
'move_record('.$url.',"' . $this->allrows . '")';
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
                        (
-                               'value_type_name'                               
=> $type['name'],
-                               'lang_type'                                     
        => lang('Location type'),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
        => $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($attrib_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_attribtext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_attribtext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_attrib'                   => 
$table_header,
-                               'values_attrib'                                 
=> $content,
-                               'table_add'                                     
        => $table_add
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
                        );
 
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('Edit'),
+                                               'text'                  => 
lang('Edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_location.edit_attrib',
+                                                               'type_id'       
                        => $type_id
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('Delete'),
+                                               'text'                  => 
lang('Delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiadmin_location.delete',
+                                                               'type_id'       
                => $type_id,
+                                                               'attrib'        
                        => true
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiadmin_location.edit_attrib',
+                                                                               
'type_id'                       => $type_id,
+                                                                       ))
+                       );
+
+                       unset($parameters);
+
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+//                             if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
(!isset($uicols['formatter'][$i]) || !$uicols['formatter'][$i]?  '""' : 
$uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='column_name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'column_name';
+                                       }
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       }
+                                       if($uicols['name'][$i]=='attrib_sort')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'attrib_sort';
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($attrib_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
                        $appname        = lang('attribute');
-                       $function_msg   = lang('list location attribute');
+                       $function_msg   = lang('list entity attribute');
 
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'attrib_sort'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && isset($column['java_link']) && 
$column['java_link']==true)
+                                               {
+                                                       
//$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 //$json_row[$column['name']] 
= "<a href='".$column['link']."'>" .$column['value']."</a>";
+                                                 $json_row[$column['name']] = 
"<a href='#' onclick='".$column['link']."'>" .$column['value']."</a>";
+                                                 //$json_row[$column['name']] 
= '<a href="#" 
onclick="delete_record("/index.php?menuaction=property.uiasync.delete")">' 
.$column['value'].'</a>';
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'admin_location.attribute', 'property' );
+
+//                     $this->save_sessiondata();
                }
 
                function edit_attrib()
@@ -657,6 +1683,11 @@
                                'lang_no_datatype'                              
=> lang('No datatype'),
                                'datatype_list'                                 
=> $this->bocommon->select_datatype($values['column_info']['type']),
 
+                               'lang_group'                                    
=> lang('group'),
+                               'lang_group_statustext'                 => 
lang('Select a group'),
+                               'lang_no_group'                                 
=> lang('no group'),
+                               'attrib_group_list'                             
=> $this->bo->get_attrib_group_list($type_id, $values['group_id']),
+
                                'lang_precision'                                
=> lang('Precision'),
                                'lang_precision_statustext'             => 
lang('enter the record length'),
                                'value_precision'                               
=> $values['column_info']['precision'],

Modified: people/sigurdne/modules/property/trunk/inc/class.uiagreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiagreement.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiagreement.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -31,7 +31,7 @@
         * Description
         * @package property
         */
-
+       phpgw::import_class('phpgwapi.yui');
        class property_uiagreement
        {
                var $grants;
@@ -110,7 +110,7 @@
 
                function columns()
                {
-
+                       phpgwapi_yui::load_widget('tabview');
                        $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
 
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
@@ -122,7 +122,7 @@
                        {
 
                                
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-                               
$GLOBALS['phpgw']->preferences->read_repository();
+                               $GLOBALS['phpgw']->preferences->read();
                                
$GLOBALS['phpgw']->preferences->add('property','agreement_columns',$values['columns'],'user');
                                
$GLOBALS['phpgw']->preferences->save_repository();
 
@@ -174,195 +174,394 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::agreement::pricebook::agreement';
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('agreement',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs',
-                                                                               
'filter_member_of'));
-
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt','');
 
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::agreement::pricebook::agreement';
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'                    => 
'property.uiagreement.index',
+                               'sort'          =>$this->sort,
+                                       'order'         =>$this->order,
+                                       'cat_id'        =>$this->cat_id,
+                                       'filter'        =>$this->filter,
+                                       'query'         =>$this->query,
+                                       'role'          => $this->role,
+                                       'member_id'     => $this->member_id
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiagreement.index',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."cat_id: '{$this->cat_id}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."role:'{$this->role}',"
+                                                                               
."member_id:'{$this->member_id}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uiagreement.index',
+                                       'sort'          =>$this->sort,
+                                       'order'         =>$this->order,
+                                       'cat_id'        =>$this->cat_id,
+                                       'filter'        =>$this->filter,
+                                       'query'         =>$this->query,
+                                       'role'          => $this->role,
+                                       'member_id'     => $this->member_id
+                               );
+
+                               $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true,'link_data' =>$link_data));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no member'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'branch','order'=>'descr'));
+                               $default_value = array 
('id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $values_combo_box[2]  = 
$this->bo->select_vendor_list('filter',$this->vendor_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no vendor'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               //_debug_array($values_combo_box[0]);die;
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uiagreement.index',
+                                                               'sort'          
=>$this->sort,
+                                                               'order'         
=>$this->order,
+                                                               'cat_id'        
=>$this->cat_id,
+                                                               'filter'        
=>$this->filter,
+                                                               'query'         
=>$this->query,
+                                                               'role'          
=> $this->role,
+                                                               'member_id'     
=> $this->member_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
//boton  CATEGORY
+                                                                           
'id' => 'btn_member_id',
+                                                                           
'name' => 'member_id',
+                                                                           
'value'     => lang('Member'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//boton  STATUS
+                                                                           
'id' => 'btn_cat_id',
+                                                                           
'name' => 'category_id',
+                                                                           
'value'     => lang('Category'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                       array( 
//boton  HOUR CATEGORY
+                                                                           
'id' => 'btn_vendor_id',
+                                                                           
'name' => 'vendor_id',
+                                                                           
'value'     => lang('Vendor'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       ),
+                                                                       array(
+                                                                               
        'type' => 'link',
+                                                                               
        'id' => 'btn_columns',
+                                                                               
        'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                                                                                
                   array
+                                                                               
                                                                                
                      (
+                                                                               
                                                                                
                       'menuaction' => 'property.uiagreement.columns',
+                                                                               
                                                                                
                                   'role'               => $this->role
+                                                                               
                                                                                
                      ))."','','width=300,height=600,scrollbars=1')",
+                                                                               
                                        'value' => lang('columns'),
+                                                                               
                                        'tab_index' => 9
+                                                                               
                                )
+                                                                               
),
+                                                       'hidden_value' => array(
+                                                                               
        array( //div values  combo_box_0
+                                                                               
                            'id' => 'values_combo_box_0',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id')
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_1
+                                                                               
                            'id' => 'values_combo_box_1',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
                      ),
+                                                                               
                                                 array( //div values  
combo_box_2
+                                                                               
                            'id' => 'values_combo_box_2',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
                      )
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
                        $list = $this->bo->read();
 
                        $uicols         = $this->bo->uicols;
-                       $content = array();
-                       $j=0;
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
                        if (isset($list) AND is_array($list))
                        {
-                               foreach($list as $entry)
+                               foreach($list as $list_entry)
                                {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       for ($k=0;$k<$count_uicols_name;$k++)
                                        {
-                                               
if($uicols['input_type'][$i]!='hidden')
+                                               
if($uicols['input_type'][$k]!='hidden')
                                                {
-                                                       
$content[$j]['row'][$i]['value']        = $entry[$uicols['name'][$i]];
-                                                       
$content[$j]['row'][$i]['name']         = $uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $list_entry[$uicols['name'][$k]];
                                                }
                                        }
+                                       $j++;
+                                               }
+                                       }
 
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
'agreement_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
                                        if($this->acl_read)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']           = lang('view the entity');
-                                               $content[$j]['row'][$i]['text'] 
                = lang('view');
-                                               
$content[$j]['row'][$i++]['link']               = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiagreement.view','id'=> $entry['id'], 'role'=> $this->role));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'view',
+                                                       'statustext'    => 
lang('view this entity'),
+                                                       'text'                  
=> lang('view'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiagreement.view',
+                                                                               
'role'                  => $this->role
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
                                        }
+
                                        if($this->acl_edit)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']           = lang('edit the agreement');
-                                               $content[$j]['row'][$i]['text'] 
                = lang('edit');
-                                               
$content[$j]['row'][$i++]['link']               = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiagreement.edit','id'=> $entry['id'], 'role'=> $this->role));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'    => 
lang('edit this entity'),
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiagreement.edit',
+                                                                               
'role'                  => $this->role
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
                                        }
+
                                        if($this->acl_delete)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']           = lang('delete the agreement');
-                                               $content[$j]['row'][$i]['text'] 
                = lang('delete');
-                                               
$content[$j]['row'][$i++]['link']               = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiagreement.delete', 'agreement_id'=> $entry['id'], 'role'=> 
$this->role));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'delete',
+                                                       'statustext'    => 
lang('delete this entity'),
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiagreement.delete',
+                                                                               
'role'                  => $this->role
+                                                                       )),
+                                               'parameters'    => $parameters2
+                                               );
                                        }
 
-                                       $j++;
-                               }
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add an entity'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiagreement.edit',
+                                                                               
'role'                  => $this->role
+                                                                       ))
+                                               );
                        }
 
-//_debug_array($content);
-                       for ($i=0;$i<count($uicols['descr']);$i++)
+                       unset($parameters);
+                       unset($parameters2);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
                                if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['datatype'][$i]!='T' && 
$uicols['datatype'][$i]!='CH')
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id' || 
$uicols['name'][$i]=='name' || $uicols['name'][$i]=='org_name' || 
$uicols['name'][$i]=='category' || $uicols['name'][$i]=='start_date' || 
$uicols['name'][$i]=='end_date' || $uicols['name'][$i]=='status')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                       (
-                                                               'sort'  => 
$this->sort,
-                                                               'var'   => 
$uicols['name'][$i],
-                                                               'order' => 
$this->order,
-                                                               'extra' => 
array('menuaction'   => 'property.uiagreement.index',
-                                                                               
                        'query'         => $this->query,
-                                                                               
                        'role'          => $this->role,
-                                                                               
                        'member_id'     => $this->member_id,
-                                                                               
                        'allrows'       => $this->allrows
-                                                                               
                        )
-                                                       ));
-                                       }
-                               }
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                        }
 
-                       if($this->acl_read)
+                                       if($uicols['name'][$i]=='category')
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
-                               $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'org_name';
                        }
-                       if($this->acl_edit)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('edit');
-                               $i++;
                        }
-                       if($this->acl_delete)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('delete');
-                               $i++;
                        }
 
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       if($this->acl_add)
-                       {
-                               $table_add = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add an 
agreement'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'role'=> $this->role))
-                               );
-                       }
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uiagreement.index',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'cat_id'        =>$this->cat_id,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query,
-                               'role'          => $this->role,
-                               'member_id'     => $this->member_id
-                       );
+                       $appname                                        = 
lang('agreement');
+                       $function_msg           = lang('List') . ' ' . 
lang($this->role);
 
-                       if(!$this->allrows)
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $link_columns = array
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 
'property.uiagreement.columns',
-                               'role'          => $this->role
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true,'link_data' =>$link_data));
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_columns'                                  
=> lang('columns'),
-                               'link_columns'                                  
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
-                               'lang_columns_help'                             
=> lang('Choose columns'),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
        => $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the agreement belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
        => 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'branch','order'=>'descr')),
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
 
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'lang_no_vendor'                                
=> lang('no vendor'),
-                               'lang_vendor_statustext'                => 
lang('Select the vendor the agreement belongs to.'),
-                               'vendor_list'                                   
=> $this->bo->select_vendor_list('filter',$this->vendor_id),
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
 
-                               'lang_no_member'                                
=> lang('no member'),
-                               'member_of_name'                                
=> 'member_id',
-                               'member_of_list'                                
=> $member_of_data['cat_list'],
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
 
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
        => $content,
-                               'table_add'                                     
        => $table_add
-                       );
-                       $this->save_sessiondata();
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('agreement') . ': ' . lang('list ' . $this->role);
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'agreement.index', 'property' );
                }
 
                function list_content($list,$uicols,$edit_item='',$view_only='')
@@ -480,12 +679,12 @@
                                        if ($values['save'])
                                        {
                                                
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id));
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id, 'tab' => 'items'));
                                        }
                                }
                                else
                                {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id, 'tab' => 'items'));
 
                                }
                        }
@@ -539,31 +738,31 @@
 
                function edit()
                {
+
                        if(!$this->acl_add)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
                        }
-
-
                        $id     = phpgw::get_var('id', 'int');
                        $values         = phpgw::get_var('values');
+//return _debug_array($values);
                        $delete_item    = phpgw::get_var('delete_item', 'bool');
                        $activity_id    = phpgw::get_var('activity_id', 'int');
+                       $active_tab             = phpgw::get_var('tab', 
'string', 'REQUEST', 'general');
 
                        $config         = 
CreateObject('phpgwapi.config','property');
                        $boalarm        = CreateObject('property.boalarm');
                        $receipt        = array();
+                       $get_items              = false;
 
                        if($delete_item && $id && $activity_id)
                        {
                                $this->bo->delete_item($id,$activity_id);
+                               $get_items = true;
                        }
-
                        $values_attribute  = phpgw::get_var('values_attribute');
-
                        $insert_record_agreement = 
$GLOBALS['phpgw']->session->appsession('insert_record_values.agreement','property');
 
-//_debug_array($insert_record_agreement);
                        if(isset($insert_record_agreement) && 
is_array($insert_record_agreement))
                        {
                                for 
($j=0;$j<count($insert_record_agreement);$j++)
@@ -679,6 +878,7 @@
                                        if(!$receipt['error'])
                                        {
                                                $receipt = 
$this->bo->update($values);
+                                               $get_items = true;
                                        }
 
                                }
@@ -697,6 +897,7 @@
                                        if(!isset($receipt['error']) || 
!$receipt['error'])
                                        {
                                                $receipt = 
$boalarm->enable_alarm('agreement',$values['alarm'],isset($values['enable_alarm'])?$values['enable_alarm']:'');
+
                                        }
 
                                }
@@ -869,34 +1070,6 @@
                                                'account_id'=> 
isset($account_id)?$account_id:''
                                                ));
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $table_add[] = array
@@ -941,10 +1114,257 @@
 
                        
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
                        
$GLOBALS['phpgw']->js->validate_file('core','check','property');
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
 
+                       if (isset($agreement['attributes']) && 
is_array($agreement['attributes']))
+                       {
+
+               /*              foreach ($values['attributes'] as & $attribute)
+                               {
+                                       if($attribute['history'] == true)
+                                       {
+                                               $link_history_data = array
+                                               (
+                                                       'menuaction'    => 
'property.uis_agreement.attrib_history',
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'id'            => $id,
+                                                       'edit'          => true
+                                               );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
+                               }
+               */
+
+                               phpgwapi_yui::tabview_setup('edit_tabview');
+                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
+
+                               $location = $this->acl_location;
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $agreement['attributes']);
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($agreement['attributes']);
+
+                               $tabs['items']  = array('label' => 
lang('items'), 'link' => '#items');
+                       }
+
+//------JSON code-------------------
+
+                       //---GET ITEMS
+                       if( phpgw::get_var('phpgw_return_as') == 'json' &&  
$get_items )
+                       {
+                               if(count($content))
+                               {
+                                       return json_encode($content);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+
+                       //-- ALARMS ---
+                       else if( phpgw::get_var('phpgw_return_as') == 'json' && 
!$get_items )
+                       {
+                               
$alarm_data=$this->bocommon->initiate_ui_alarm(array(
+                                               
'acl_location'=>$this->acl_location,
+                                               'alarm_type'=> 'agreement',
+                                               'type'          => 'form',
+                                               'text'          => 'Email 
notification',
+                                               'times'         => 
isset($times)?$times:'',
+                                               'id'            => $id,
+                                               'method'        => 
isset($method)?$method:'',
+                                               'data'          => 
isset($data)?$data:'',
+                                               'account_id'=> 
isset($account_id)?$account_id:''
+                                               ));
+                               //$alarm_data['values'] = array();
+                               if(count($alarm_data['values']))
+                               {
+                                       return 
json_encode($alarm_data['values']);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+
+                       //---datatable0 
settings---------------------------------------------------
+
+
+                       $datavalues[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                => 
json_encode($alarm_data['values']),
+                               'total_records' => count($alarm_data['values']),
+                               'permission'    => "''",
+                               'is_paginator'  => 0,
+                               'footer'                => 0
+                       );
+                       $myColumnDefs[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array(key => time,      
label=>$alarm_data['header'][0]['lang_time'],   
sortable=>true,resizeable=>true,width=>140),
+                                                                               
                        array(key => text,      
label=>$alarm_data['header'][0]['lang_text'],   
sortable=>true,resizeable=>true,width=>340),
+                                                                               
                        array(key => user,      
label=>$alarm_data['header'][0]['lang_user'],   
sortable=>true,resizeable=>true,width=>200),
+                                                                               
                array(key => 
enabled,label=>$alarm_data['header'][0]['lang_enabled'],sortable=>true,resizeable=>true,formatter=>FormatterCenter,width=>60),
+                                                                               
                array(key => 
alarm_id,label=>"dummy",sortable=>true,resizeable=>true,hidden=>true),
+                                                                               
                array(key => 
select,label=>$alarm_data['header'][0]['lang_select'],     
sortable=>false,resizeable=>false,formatter=>myFormatterCheck,width=>60)))
+                       );
+
+                       $myButtons[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array(id =>'values[enable_alarm]',type=>buttons,        
value=>Enable,  label=>$alarm_data[alter_alarm][0][lang_enable],        funct=> 
onActionsClick , classname=> actionButton, value_hidden=>""),
+                                                                               
                                array(id 
=>'values[disable_alarm]',type=>buttons,       value=>Disable, 
label=>$alarm_data[alter_alarm][0][lang_disable],       funct=> onActionsClick 
, classname=> actionButton, value_hidden=>""),
+                                                                               
                                array(id 
=>'values[delete_alarm]',type=>buttons,        value=>Delete,  
label=>$alarm_data[alter_alarm][0][lang_delete],        funct=> onActionsClick 
, classname=> actionButton, value_hidden=>""),
+                                                                               
                                ))
+                       );
+                       $myButtons[1] = array
+                       (
+                               'name'                  => "1",
+                               'values'                =>      
json_encode(array(      array(id =>'values[time][days]',        type=>menu,     
        
value=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['day_list'],"1_0",'values[time][days]'
 ),       label=>"0", classname=> actionsFilter, value_hidden=>"0"),
+                                                                               
                                array(id =>'values[time][hours]',       
type=>menu,             
value=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['hour_list'],"1_1",'values[time][hours]'),
      label=>"0", classname=> actionsFilter, value_hidden=>"0"),
+                                                                               
                                array(id =>'values[time][mins]',        
type=>menu,             
value=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['minute_list'],"1_2",'values[time][mins]'),
 label=>"0", classname=> actionsFilter, value_hidden=>"0"),
+                                                                               
                                array(id =>'values[user_id]',           
type=>menu,             
value=>$this->bocommon->make_menu_user($alarm_data['add_alarm']['user_list'],"1_3",'values[user_id]'),
  
label=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"name"),classname=>
 actionsFilter, 
value_hidden=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"id")),
+
+                                                                               
                                array(id =>'values[add_alarm]',         
type=>buttons,  value=>Add,             
label=>$alarm_data[add_alarm][lang_add],                        funct=> 
onAddClick , classname=> actionButton, value_hidden=>"")
+                                                                               
                                ))
+                       );
+//_debug_array($alarm_data['add_alarm']['user_list']);die;
+
+//---datatable1 settings---------------------------------------------------
+                       $parameters['view'] = array('parameter' => array(
+                                       array('name'  => 
'agreement_id','source' => 'agreement_id'),
+                                       array('name'  => 'id',                  
'source' => 'id')));
+
+                       $parameters['edit'] = array('parameter' => array(
+                                       array('name'  => 
'agreement_id','source' => 'agreement_id'),
+                                       array('name'  => 'id',                  
'source' => 'id')));
+
+                       $parameters['delete'] = array('parameter' => array(
+                                       array('name'  => 'delete_item', 
'source' => 1,  'ready'  => 1),
+                                       array('name'  => 'id',                  
'source' => 'agreement_id'),
+                                       array('name'  => 'activity_id', 
'source' => 'activity_id')));
+
+                       $permission_update = false;
+                       if($this->acl_read && (!isset($edit_item) || 
!$edit_item) && (!isset($view_only) || !$view_only))
+                       {
+                               $permissions['rowactions'][] = array(
+                                       'text'    => lang('view'),
+                                       'action'  => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiagreement.view_item')),
+                                       'parameters' => $parameters['view']
+                               );
+                       }
+                       if($this->acl_edit && (!isset($edit_item) || 
!$edit_item) && (!isset($view_only) || !$view_only))
+                       {
+                               $permissions['rowactions'][] = array(
+                                       'text'    => lang('edit'),
+                                       'action'  => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiagreement.edit_item')),
+                                       'parameters' => $parameters['edit']
+                               );
+                       }
+                       if($this->acl_delete && (!isset($edit_item) || 
!$edit_item) && (!isset($view_only) || !$view_only))
+                       {
+                               $permissions['rowactions'][] = array(
+                                       'text'          => lang('delete'),
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiagreement.edit' )),
+                                       'confirm_msg'=> lang('do you really 
want to delete this entry'),
+                                       'parameters'=> $parameters['delete']
+                               );
+                       }
+                       if($this->acl_manage && (!isset($edit_item) || 
!$edit_item) && (!isset($view_only) || !$view_only))
+                       {
+                               $permission_update = true;
+                       }
+
+                       $datavalues[1] = array
+                       (
+                               'name'                  => "1",
+                               'values'                => 
json_encode($content),
+                               'total_records' => count($content),
+                               'permission'    => 
json_encode($permissions['rowactions']),
+                               'is_paginator'  => 0,
+                               'footer'                => 1
+                       );
+
+
+
+              $myColumnDefs[1] = array
+              (
+              'name'                   => "1",
+              'values'         =>      json_encode(array(      array(key => 
id,                        label=>$table_header[0]['header'],      
sortable=>true,resizeable=>true),
+                                                                               
        array(key => num,                       
label=>$table_header[1]['header'],      sortable=>true,resizeable=>true),
+                                                                               
        array(key => descr,                     
label=>$table_header[2]['header'],      sortable=>true,resizeable=>true),
+                                                                               
        array(key => unit,                      
label=>$table_header[3]['header'],      sortable=>true,resizeable=>true, 
formatter=>FormatterCenter),
+                                                                               
        array(key => m_cost,            label=>$table_header[4]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight),
+                                                                               
        array(key => w_cost,            label=>$table_header[5]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight),
+                                                                               
        array(key => total_cost,        label=>$table_header[6]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight),
+                                                                               
        array(key => this_index,        label=>$table_header[7]['header'],      
sortable=>true,resizeable=>true),
+                                                                               
        array(key => index_count,       label=>$table_header[8]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterCenter),
+                                                                               
        array(key => index_date,        label=>$table_header[9]['header'],      
sortable=>true,resizeable=>true),
+                                                                               
        $permission_update?array(key => select,         
label=>$table_header[13]['header'],     
sortable=>false,resizeable=>false,formatter=>FormatterCheckItems):"",
+                                                                               
        array(key => activity_id,       hidden=>true),
+                                                                               
        array(key => agreement_id,      hidden=>true)
+              )));
+
+
+
+
+
+
+                       $myButtons[2] = array
+                       (
+                               'name'                  => "2",
+                               'values'                =>      
json_encode(array(      array(type=>text, label=>' New index:', classname=> 
'index-opt'),
+                                                                               
                                array(id =>'values[new_index]', 
type=>inputText, size=>12, classname=> 'mybottonsUpdates'),
+                                                                               
                                array(id =>'values[update]',    type=>buttons,  
        value=>Update,  label=>lang('update'),  funct=> onUpdateClick , 
classname=> '')
+                                                                               
                                )));
+
+
+                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+
+                       for($z=0; $z<count($agreement['files']); $z++)
+                       {
+                               $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$agreement['files'][$z]['name'].'</a>';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$agreement['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'" style="cursor:help">';
+                       }
+
+                       $datavalues[2] = array
+                       (
+                                       'name'                                  
=> "2",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'permission'                    => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[2] = array
+                       (
+                               'name'          => "2",
+                               'values'        =>      json_encode(array(      
array(key => 
file_name,label=>lang('Filename'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => delete_file,label=>lang('Delete 
file'),sortable=>false,resizeable=>true,formatter=>FormatterCenter)))
+                       );
+
+
+                       
//----------------------------------------------datatable settings--------
+
                        $data = array
                        (
+                               'property_js'                                   
                => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                                 
                => json_encode(array(menuaction => 
"property.uiagreement.edit",id=>$id)),
+                               'datatable'                                     
                        => $datavalues,
+                               'myColumnDefs'                                  
                => $myColumnDefs,
+                               'myButtons'                                     
                        => $myButtons,
+
+                               'img_cal'                                       
                        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
                                'allow_allrows'                                 
                => true,
                                'allrows'                                       
                        => $this->allrows,
                                'start_record'                                  
                => $this->start,
@@ -993,16 +1413,10 @@
                                'member_of_name'                                
                => 'member_id',
                                'member_of_list'                                
                => $member_of_data['cat_list'],
 
-                               'lang_dateformat'                               
                => lang(strtolower($dateformat)),
-                               'dateformat_validate'                           
        => $dateformat_validate,
-                               'onKeyUp'                                       
                        => $onKeyUp,
-                               'onBlur'                                        
                        => $onBlur,
-                               'lang_attributes'                               
                => lang('Attributes'),
-                               'attributes_values'                             
                => $agreement['attributes'],
+                               'attributes_group'                              
                => $attributes,
                                'lookup_functions'                              
                => 
isset($agreement['lookup_functions'])?$agreement['lookup_functions']:'',
                                'dateformat'                                    
                => $dateformat,
 
-                               'img_cal'                                       
                        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
                                'lang_datetitle'                                
                => lang('Select date'),
 
                                'lang_start_date_statustext'                    
=> lang('Select the estimated end date for the agreement'),
@@ -1042,13 +1456,31 @@
                                'status_name'                                   
                => 'values[status]',
                                'lang_no_status'                                
                => lang('Select status'),
                                'textareacols'                                  
                => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                                  
                => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
+                               'textarearows'                                  
                => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               'tabs'                                          
                        => phpgwapi_yui::tabview_generate($tabs, $active_tab)
                        );
+//_debug_array($data);die;
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'agreement.edit', 'property' );
+                       //-----------------------datatable settings---
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('agreement') . ': ' . ($id?lang('edit') . ' ' . 
lang($this->role):lang('add') . ' ' . lang($this->role));
-
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
                function download()
@@ -1098,7 +1530,7 @@
                                                if ($values['save'])
                                                {
                                                        
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
-                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id));
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id, 'tab' => 'items'));
                                                }
                                        }
                                }
@@ -1121,7 +1553,7 @@
                                }
                                elseif (!$values['save'] && !$values['apply'] 
&& !$values['update']):
                                {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiagreement.edit', 'id'=> $agreement_id, 'tab' => 'items'));
                                }
                                endif;
                        }
@@ -1138,34 +1570,6 @@
                        );
 
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
                        $jscal = CreateObject('phpgwapi.jscalendar');
                        $jscal->add_listener('values_date');
 
@@ -1207,11 +1611,108 @@
                                'lang_update_statustext'        => lang('update 
selected investments')
                        );
 
+                       if( phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+
+                               $content_values = array();
+
+                               $hidden = '';
+                               for($y=0;$y<count($content);$y++)
+                               {
+                                       
for($z=0;$z<=count($content[$y]['row']);$z++)
+                                       {
+                                               
if($content[$y]['row'][$z]['name']!='')
+                                               {
+                                                       
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                               }
+                                       }
+                               }
+
+                               $hidden .= " <input name='values[select][0]' 
type='hidden' value='".$content_values[$y - 1]['activity_id']."'/>";
+                               $hidden .= " <input 
name='values[total_cost][".$content_values[$y - 1]['activity_id']."]'  
type='hidden' value='".$content_values[$y - 1]['total_cost']."'/>";
+                               $hidden .= " <input 
name='values[w_cost][".$content_values[$y - 1]['activity_id']."]'  
type='hidden' value='".$content_values[$y - 1]['w_cost']."'/>";
+                               $hidden .= " <input 
name='values[m_cost][".$content_values[$y - 1]['activity_id']."]'  
type='hidden' value='".$content_values[$y - 1]['m_cost']."'/>";
+                               $hidden .= " <input 
name='values[id][".$content_values[$y - 1]['activity_id']."]'  type='hidden' 
value='".$content_values[$y - 1]['index_count']."'/>";
+
+                               $content_values[$y - 1]['index_date'] .= 
$hidden;
+
+                               if(count($content_values))
+                               {
+                                       return json_encode($content_values);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+
+                       $hidden = '';
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<=count($content[$y]['row']);$z++)
+                               {
+                                       if($content[$y]['row'][$z]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                       }
+                               }
+                       }
+
+                       $hidden .= " <input name='values[select][0]'  
type='hidden' value='".$content_values[$y - 1]['activity_id']."'/>";
+                       $hidden .= " <input 
name='values[total_cost][".$content_values[$y - 1]['activity_id']."]'  
type='hidden' value='".$content_values[$y - 1]['total_cost']."'/>";
+                       $hidden .= " <input 
name='values[w_cost][".$content_values[$y - 1]['activity_id']."]'  
type='hidden' value='".$content_values[$y - 1]['w_cost']."'/>";
+                       $hidden .= " <input 
name='values[m_cost][".$content_values[$y - 1]['activity_id']."]'  
type='hidden' value='".$content_values[$y - 1]['m_cost']."'/>";
+                       $hidden .= " <input 
name='values[id][".$content_values[$y - 1]['activity_id']."]'  type='hidden' 
value='".$content_values[$y - 1]['index_count']."'/>";
+
+                       $content_values[$y - 1]['index_date'] .= $hidden;
+
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($content_values),
+                                       'total_records'                 => 
count($content_values),
+                                       'is_paginator'                  => 0,
+                                       'permission'                    => '""',
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array(key => activity_id,label=>lang('Activity 
ID'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => 
m_cost,label=>lang('m_cost'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => 
w_cost,label=>lang('w_cost'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => total_cost,label=>lang('Total 
Cost'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => 
this_index,label=>lang('index'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => 
index_count,label=>lang('index_count'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => 
index_date,label=>lang('Date'),sortable=>false,resizeable=>true)))
+
+
+                       );
+
+                       $myButtons[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array(type=>text, label=>'New index', classname=> 
'index-opt'),
+                                                                               
                                array(id =>'values[update]',type=>buttons,      
value=>Update,  label=>lang('Update'),  funct=> onUpdateClick , classname=> ''),
+                                                                               
                                array(id =>'delete',type=>buttons,      
value=>Delete,  label=>lang('delete last index'),       funct=> onDeleteClick , 
classname=> ''),
+                                                                               
                                array(id =>'values[new_index]', 
type=>inputText, size=>12, classname=> 'index-opt')
+
+
+
+                                                                               
                                ))
+                       );
+
                        
$GLOBALS['phpgw']->js->validate_file('core','check','property');
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
 
                        $data = array
                        (
+                               'property_js'                                   
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                                 
        => json_encode(array(menuaction => "property.uiagreement.edit_item", 
agreement_id=>$agreement_id, id=>$id, role=>$this->role)),
+                               'datatable'                                     
                => $datavalues,
+                               'myColumnDefs'                                  
        => $myColumnDefs,
+                               'myButtons'                                     
                => $myButtons,
+
                                'activity_descr'                        => 
$activity_descr,
                                'lang_descr'                            => 
lang('Descr'),
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -1228,14 +1729,10 @@
                                'lang_cancel_statustext'                => 
lang('Leave the agreement untouched and return back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the agreement and return back to the list'),
 
-                               'lang_dateformat'                       => 
lang(strtolower($dateformat)),
-                               'dateformat_validate'                   => 
$dateformat_validate,
-                               'onKeyUp'                               => 
$onKeyUp,
-                               'onBlur'                                => 
$onBlur,
-                               'lang_attributes'                       => 
lang('Attributes'),
                                'attributes_values'                     => 
$values['attributes'],
                                'lookup_functions'                      => 
$values['lookup_functions'],
                                'dateformat'                            => 
$dateformat,
+                               'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
 
                                'lang_agreement'                        => 
lang('Agreement'),
                                'agreement_name'                        => 
$agreement['name'],
@@ -1269,9 +1766,25 @@
                                'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
                        );
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('agreement') . ': ' . ($values['id']?lang('edit item') . ' ' . 
$agreement['name']:lang('add item') . ' ' . $agreement['name']);
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_item' => $data));
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'agreement.edit_item', 'property' );
+
+
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
@@ -1318,8 +1831,47 @@
 
                        
$GLOBALS['phpgw']->js->validate_file('core','check','property');
 
+//---datatable1 settings---------------------------------------------------
+                       //Prepare array for $datavalues[0]
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<=count($content[$y]['row']);$z++)
+                               {
+                                       if($content[$y]['row'][$z]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                       }
+                               }
+                       }
+
+                       $datavalues[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                => 
json_encode($content_values),
+                               'total_records' => count($content_values),
+                               'is_paginator'  => 0,
+                               'footer'                => 0
+                       );
+
+              $myColumnDefs[0] = array
+              (
+              'name'                   => "0",
+              'values'         =>      json_encode(array(      array(key => 
activity_id,       label=>$table_header[0]['header'],      
sortable=>true,resizeable=>true ),
+                                                                               
        array(key => m_cost,            label=>$table_header[2]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight ),
+                                                                               
        array(key => w_cost,            label=>$table_header[3]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight ),
+                                                                               
        array(key => total_cost,        label=>$table_header[4]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight ),
+                                                                               
        array(key => this_index,        label=>$table_header[5]['header'],      
sortable=>true,resizeable=>true ),
+                                                                               
        array(key => index_count,       label=>$table_header[6]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterCenter ),
+                                                                               
        array(key => index_date,        label=>$table_header[7]['header'],      
sortable=>true,resizeable=>true )
+              )));
+
                        $data = array
                        (
+                               'property_js'                           => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                         => 
json_encode(array(menuaction => "property.uiagreement.view_item")),
+                               'datatable'                                     
=> $datavalues,
+                               'myColumnDefs'                          => 
$myColumnDefs,
+
                                'activity_descr'                        => 
$activity_descr,
                                'lang_descr'                            => 
lang('Descr'),
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -1355,13 +1907,31 @@
                                'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
                        );
 
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'agreement.view_item', 'property' );
+                       //-----------------------datatable settings---
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('agreement') . ': ' . lang('view item') . ' ' . $agreement['name'];
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view_item' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
-
                function delete()
                {
                        if(!$this->acl_delete)
@@ -1379,10 +1949,10 @@
                                'role'          => $this->role
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
                                $this->bo->delete($agreement_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               return "agreement_id ".$agreement_id." 
".lang("has been deleted");
                        }
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
@@ -1413,12 +1983,10 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
+                       $this->bo->allrows      = 1;
                        $agreement_id   = phpgw::get_var('id', 'int');
                        $config         = 
CreateObject('phpgwapi.config','property');
-
                        $GLOBALS['phpgw']->xslttpl->add_file(array('agreement', 
'nextmatchs', 'attributes_view', 'files'));
-
-
                        $agreement = 
$this->bo->read_single(array('agreement_id'=>$agreement_id));
 
 
@@ -1446,15 +2014,15 @@
                                                'type'          => 'view'));
 
                        $alarm_data=$this->bocommon->initiate_ui_alarm(array(
-                                               
'acl_location'=>$this->acl_location,
-                                               'alarm_type'=> 'agreement',
+                                               'acl_location'  
=>$this->acl_location,
+                                               'alarm_type'    => 'agreement',
                                                'type'          => 'view',
                                                'text'          => 'Email 
notification',
                                                'times'         => $times,
                                                'id'            => 
$agreement_id,
                                                'method'        => $method,
                                                'data'          => $data,
-                                               'account_id'=> $account_id
+                                               'account_id'    => $account_id
                                                ));
 
 
@@ -1471,7 +2039,7 @@
 
                        $link_file_data = array
                        (
-                               'menuaction'    => 
'property.uiagreement.view_file',
+                               'menuaction'=> 'property.uiagreement.view_file',
                                'id'            =>$agreement_id
                        );
 
@@ -1501,13 +2069,112 @@
                                'id'            => $agreement_id,
                        );
 
+//---datatable0 settings---------------------------------------------------
+
+                       $datavalues[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                => 
json_encode($alarm_data['values']),
+                               'total_records' => count($alarm_data['values']),
+                               'permission'    => "''",
+                               'is_paginator'  => 0,
+                               'footer'                => 0
+                       );
+                       $myColumnDefs[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array(key => time,      
label=>$alarm_data['header'][0]['lang_time'],   
sortable=>true,resizeable=>true,width=>140),
+                                                                               
                        array(key => text,      
label=>$alarm_data['header'][0]['lang_text'],   
sortable=>true,resizeable=>true,width=>340),
+                                                                               
                        array(key => user,      
label=>$alarm_data['header'][0]['lang_user'],   
sortable=>true,resizeable=>true,width=>200),
+                                                                               
                array(key => 
enabled,label=>$alarm_data['header'][0]['lang_enabled'],sortable=>true,resizeable=>true,formatter=>FormatterCenter,width=>60)))
+                       );
+
+//---datatable1 settings---------------------------------------------------
+                       //Prepare array for $datavalues[1]
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<=count($content[$y]['row']);$z++)
+                               {
+                                       if($content[$y]['row'][$z]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                       }
+                               }
+                       }
+
+                       $datavalues[1] = array
+                       (
+                               'name'                  => "1",
+                               'values'                => 
json_encode($content_values),
+                               'total_records' => count($content_values),
+                               'permission'    => "''",
+                               'is_paginator'  => 1,
+                               'footer'                => 0
+                       );
+
+              $myColumnDefs[1] = array
+              (
+              'name'                   => "1",
+              'values'         =>      json_encode(array(      array(key => 
activity_id,       label=>$table_header[0]['header'],      
sortable=>true,resizeable=>true),
+                                                                               
        array(key => num,                       
label=>$table_header[1]['header'],      sortable=>true,resizeable=>true),
+                                                                               
        array(key => descr,                     
label=>$table_header[2]['header'],      sortable=>true,resizeable=>true),
+                                                                               
        array(key => unit,                      
label=>$table_header[3]['header'],      sortable=>true,resizeable=>true, 
formatter=>FormatterCenter),
+                                                                               
        array(key => m_cost,            label=>$table_header[4]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight),
+                                                                               
        array(key => w_cost,            label=>$table_header[5]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight),
+                                                                               
        array(key => total_cost,        label=>$table_header[6]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterRight),
+                                                                               
        array(key => this_index,        label=>$table_header[7]['header'],      
sortable=>true,resizeable=>true),
+                                                                               
        array(key => index_count,       label=>$table_header[8]['header'],      
sortable=>true,resizeable=>true, formatter=>FormatterCenter),
+                                                                               
        array(key => index_date,        label=>$table_header[9]['header'],      
sortable=>true,resizeable=>true)
+              )));
+
+//---datatable2 settings---------------------------------------------------
+
+                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+
+                       for($z=0; $z<count($agreement['files']); $z++)
+                       {
+                               if ($link_to_files != '')
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$agreement['files'][$z]['directory'].'/'.$agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$agreement['files'][$z]['name'].'</a>';
+                               }
+                               else
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$agreement['files'][$z]['name'].'</a>';
+                               }
+                       }
+
+                       $datavalues[2] = array
+                       (
+                                       'name'                                  
=> "2",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'permission'                    => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[2] = array
+                       (
+                               'name'          => "2",
+                               'values'        =>      
json_encode(array(array(key => 
file_name,label=>lang('Filename'),sortable=>false,resizeable=>true)))
+                       );
+
+
+
+
                        $data = array
                        (
+                               'property_js'                           => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                         => 
json_encode(array(menuaction => "property.uiagreement.view")),
+                               'datatable'                                     
=> $datavalues,
+                               'myColumnDefs'                          => 
$myColumnDefs,
+
                                'allow_allrows'                                 
=> true,
                                'allrows'                                       
=> $this->allrows,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $record_limit,
                                'num_records'                                   
=> count($content),
+                               'lang_total_records'            => 
lang('Total'),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data2),
                                'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
@@ -1566,6 +2233,26 @@
                                'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
                        );
 
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'agreement.view', 'property' );
+                       //-----------------------datatable settings---
+
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('agreement') . ': ' . lang('view');
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));

Modified: people/sigurdne/modules/property/trunk/inc/class.uialarm.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uialarm.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uialarm.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -31,7 +31,7 @@
         * Description
         * @package property
         */
-
+       phpgw::import_class('phpgwapi.yui');
        class property_uialarm
        {
                var $grants;
@@ -48,7 +48,7 @@
                        'view'          => true,
                        'edit'          => true,
                        'delete'        => true,
-                       'list_alarm'    => true,
+                       'list_alarm'=> true,
                );
 
                function property_uialarm()
@@ -56,8 +56,6 @@
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'admin::property::admin_async';
 
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo               = 
CreateObject('property.boalarm',true);
@@ -90,28 +88,128 @@
 
                function index()
                {
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('alarm',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs'));
-
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt');
-                       
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt','');
+                       //$receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt');
+                       
//$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt','');
                        $values         = phpgw::get_var('values');
-                       if($values['delete_alarm'] && count($values['alarm'])):
+                       
+                       if($values['delete_alarm'] && count($values['alarm']))
                        {
                                $receipt = 
$this->bo->delete_alarm('fm_async',$values['alarm']);
                        }
-                       elseif(($values['enable_alarm'] || 
$values['disable_alarm']) && count($values['alarm'])):
+                       else if(($values['enable_alarm'] || 
$values['disable_alarm']) && count($values['alarm']))
                        {
                                $receipt = 
$this->bo->enable_alarm('fm_async',$values['alarm'],$values['enable_alarm']);
                        }
-                       elseif($values['test_cron']):
+                       else if(isset($values['test_cron']) && 
$values['test_cron'] && isset($values['alarm']) && $values['alarm'])
                        {
                                        $this->bo->test_cron();
                        }
-                       endif;
 
+                       $datatable = array();
+                       $values_combo_box = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                               $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'    =>      
'property.uialarm.index',
+                                                       'sort'                  
=>      $this->sort,
+                                                       'order'                 
=>      $this->order,
+                                                       'cat_id'                
=>      $this->cat_id,
+                                                       'filter'                
=>      $this->filter,
+                                                       'query'                 
=>      $this->query
+
+                                       ));
+
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uialarm.index',"
+                                                                               
                                ."sort:'{$this->sort}',"
+                                                                               
                                ."order:'{$this->order}',"      
+                                                                               
                                ."cat_id:'{$this->cat_id}',"
+                                                                               
                                ."filter:'{$this->filter}',"                    
                                                                                
                                                                                
                                                
+                                                                               
                                ."query:'{$this->query}'";
+
+                               $datatable['actions']['form'] = array(array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                                       array(
+                                                                               
        'menuaction'            => 'property.uialarm.index'
+                                                                       )
+                                               ),                              
        
+                                       'fields'        =>      array('field' 
=> array(
+                                                                               
                        array( //boton TEST_CROM
+                                                                   'id'        
        => 'btn_test_cron',
+                                                                   'name'      
        => 'test_cron',
+                                                                   'value'     
        => lang('test cron'),
+                                                                   'type'      
        => 'button',
+                                                                               
                                'style'         => 'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                                               
                        array( //boton ENABLE
+                                                                   'id'        
        => 'btn_enable',
+                                                                   'name'      
        => 'enable',
+                                                                   'value'     
        => lang('Enable'),
+                                                                   'type'      
        => 'button',
+                                                                               
                                'style'         => 'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                        array( //boton DISABLE
+                                                                   'id'        
        => 'btn_disable',
+                                                                   'name'      
        => 'disable',
+                                                                   'value'     
        => lang('Disable'),
+                                                                   'type'      
        => 'button',
+                                                                               
                                'style'         => 'filter',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                                               
                        array( //boton SEARCH
+                                                                   'id'        
        => 'btn_delete',
+                                                                   'name'      
        => 'delete',
+                                                                   'value'     
        => lang('Delete'),
+                                                                   'type'      
        => 'button',
+                                                                       'style' 
        => 'filter',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                              array( //boton 
ADD
+                                                                   'id'        
        => 'btn_new',
+                                                                   'name'      
        => 'add',
+                                                                   'value'     
        => lang('add'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 7
+                                                               ),              
                        
+                                                                               
                        array( //boton SEARCH
+                                                                   'id'        
        => 'btn_search',
+                                                                   'name'      
        => 'search',
+                                                                   'value'     
        => lang('search'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 6
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'      
        => 'query',
+                                                                   'id'        
        => 'txt_query',
+                                                                   'value'     
        => $this->query,
+                                                                   'type'      
        => 'text',
+                                                                   'size'      
        => 28,
+                                                                   
'onkeypress'=> 'return pulsar(event)',
+                                                                       
'tab_index'     => 5
+                                                               ),
+                                                               array( //boton 
hidden actions for button
+                                                                   'id'        
        => 'values[action_button]',
+                                                                   'name'      
        => 'values[action_button]',
+                                                                   'value'     
        => '',
+                                                                   'type'      
        => 'hidden'
+                                                                               
                        ),
+                                                               array( 
//container of  control's Form
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'controlsForm_container',
+                                                                               
                                'value' => ''
+                                                                               
                        ),
+                                                                       ),
+                                               'hidden_value' => array()
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+                       $list = array();
                        $list = $this->bo->read();
 
                        foreach ($list as $alarm)
@@ -125,7 +223,6 @@
                                        {
                                                $times .= "{$key} => {$value} ";
                                        }
-
                                }
                                else
                                {
@@ -137,7 +234,6 @@
                                        {
                                                $data .= "{$key} => {$value} ";
                                        }
-
                                }
 
                                $link_edit                              = '';
@@ -147,160 +243,208 @@
                                if (substr($alarm['id'],0,8)=='fm_async')
                                {
                                        $link_edit                              
= $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uialarm.edit', 'async_id'=> urlencode($alarm['id'])));
-                                       $lang_edit_statustext   = lang('edit 
the alarm');
                                        $text_edit                              
= lang('edit');
+                                       $link_edit                              
= "<a href=\"$link_edit\">$text_edit</a>";
                                }
+                               else
+                               {
+                                       $link_edit                              
= "-";
+                               }
 
+                               $check_box = "<input type=\"checkbox\" 
name=\"values[alarm][".$alarm[id]."]\" value=\"".$alarm[id]."\" 
class=\"myValuesForPHP\">";
+
                                $content[] = array
                                (
                                        'id'                                    
=> $alarm['id'],
                                        'next_run'                              
=> $GLOBALS['phpgw']->common->show_date($alarm['next']),
+                                       'times'                                 
=> $times,
                                        'method'                                
=> $alarm['method'],
-                                       'times'                                 
=> $times,
                                        'data'                                  
=> $data,
                                        'enabled'                               
=> $alarm['enabled'],
                                        'user'                                  
=> $alarm['user'],
-                                       'link_edit'                             
=> $link_edit,
-                                       'lang_edit_statustext'  => 
$lang_edit_statustext,
-                                       'text_edit'                             
=> $text_edit
+                                       'check_box'                             
=> $check_box,
+                                       'link_edit'                             
=> $link_edit                                                   
                                );
                        }
 
-                       $table_header = array
-                       (
-                               'lang_next_run'         => lang('Next run'),
-                               'lang_times'            => lang('Times'),
-                               'lang_method'           => lang('Method'),
-                               'lang_user'             => lang('User'),
-                               'lang_data'             => lang('Data'),
-                               'lang_select'           => lang('select'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_alarm_id'         => lang('alarm id'),
-                               'lang_enabled'          => lang('enabled'),
-                               'sort_user'             => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'account_lid',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
)),
-                               'sort_method'           => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'method',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
)),
-                               'sort_next_run'         => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'next',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
)),
-                               'sort_alarm_id'         => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
))
+                       $uicols = array (
+                               array(
+                                       'col_name'=>alarm_id,   
'input_type'=>varchar,  'name'=>'id',           'descr'=>lang('alarm id'),      
'className'=>'centerClasss',    'sortable'=>true ,'formatter'=>'',              
'sort_field'=>'id'),
+                               array(
+                                       'col_name'=>next_run,   
'input_type'=>varchar,  'name'=>'next_run',     'descr'=>lang('Next run'),      
'className'=>'centerClasss',    'sortable'=>true ,'formatter'=>'',              
'sort_field'=>'next'),
+                               array(
+                                       'col_name'=>times,              
'input_type'=>varchar,  'name'=>'times',        'descr'=>lang('Times'),         
'className'=>'centerClasss',    'sortable'=>false ,'formatter'=>'',             
'sort_field'=>''),
+                               array(
+                                       'col_name'=>method,             
'input_type'=>varchar,  'name'=>'method',       'descr'=>lang('Method'),        
'className'=>'leftClasss',              'sortable'=>true ,'formatter'=>'',      
'       sort_field'=>'method'),
+                               array(
+                                       'col_name'=>data,               
'input_type'=>varchar,  'name'=>'data',         'descr'=>lang('Data'),          
'className'=>'leftClasss',              'sortable'=>false ,'formatter'=>'',     
'       sort_field'=>''),
+                               array(
+                                       'col_name'=>enable,             
'input_type'=>varchar,  'name'=>'enabled',      'descr'=>lang('enabled'),       
'className'=>'centerClasss',    'sortable'=>false ,'formatter'=>'',             
'sort_field'=>''),
+                               array(
+                                       'col_name'=>user,               
'input_type'=>varchar,  'name'=>'user',         'descr'=>lang('User'),          
'className'=>'centerClasss',    'sortable'=>true ,'formatter'=>'',              
'sort_field'=>'account_lid'),
+                               array(
+                                       'col_name'=>select,             
'input_type'=>imput,    'name'=>'check_box','descr'=>lang('select'),    
'className'=>'centerClasss',    'sortable'=>false ,'formatter'=>'',             
'sort_field'=>''),
+                               array(
+                                       'col_name'=>edit,               
'input_type'=>link,             'name'=>'link_edit','descr'=>lang('edit'),      
        'className'=>'centerClasss',    'sortable'=>false ,'formatter'=>'',     
        'sort_field'=>'')
                        );
 
-                       $alter_alarm = array
-                       (
-                               'lang_enable'           => lang('Enable'),
-                               'lang_disable'          => lang('Disable'),
-                               'lang_delete'           => lang('Delete'),
-                               'lang_test_cron'        => lang('test cron')
-                               );
+                       $j=0;
+                       if (isset($content) && is_array($content))
+                       {
+                               foreach($content as $alarm)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']             = 
$uicols[$i]['col_name'];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']            = 
$alarm[$uicols[$i]['name']];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['format']           = 
$uicols[$i]['input_type'];
+                                       }
+                                       $j++;
+                               }
+                       }
 
-                       $table_add = array
+                       $datatable['rowactions']['action'] = array();
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_add'              => lang('add'),
-                               'lang_add_statustext'   => lang('add an alarm'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uialarm.edit'))
+                                                                               
'menuaction'    => 'property.uialarm.edit',
+                                                                       ))
                        );
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uialarm.index',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'cat_id'        =>$this->cat_id,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query
-                       );
+                       for ($i=0;$i<count($uicols);$i++)
+                       {
+                               
$datatable['headers']['header'][$i]['formatter']        = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
+                               $datatable['headers']['header'][$i]['name']     
        = $uicols[$i]['col_name'];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols[$i]['descr'];
+                               $datatable['headers']['header'][$i]['sortable'] 
        = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols[$i]['sort_field'];
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols[$i]['className'];
+                               $datatable['headers']['header'][$i]['visible']  
        = true;
 
-                       if(!$this->allrows)
+                               if($uicols[$i]['input_type']=='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['visible']  = false;
+                               }
+                       }
+               
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               //avoid ,in the last page, reformate paginator 
when records are lower than records_returned
+                               if(count($content) <= 
$datatable['pagination']['records_limit'])
+                               {
+                                       
$datatable['pagination']['records_returned']= count($content);
+                               }
+                               else
+                       {
+                                       
$datatable['pagination']['records_returned']= 
$datatable['pagination']['records_limit'];
+                               }
+                               $datatable['sorting']['currentPage']    = 1;
+                               $datatable['sorting']['order']                  
= $uicols[0]["col_name"]; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                       
+                               $datatable['sorting']['currentPage']            
= phpgw::get_var('currentPage');
+                               $datatable['sorting']['order']                  
        = phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
        = phpgw::get_var('sort', 'string'); // ASC / DESC
+                               $datatable['pagination']['records_returned']= 
phpgw::get_var('recordsReturned', 'int');
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');         
 
-                       $data = array
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       $json = array
                        (
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the alarm belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
=> '',//$this->bo->select_category_list('filter',$this->cat_id),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
-                               'lang_filter_statustext'                        
=> lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
=> $content,
-                               'table_add'                                     
=> $table_add,
-                               'alter_alarm'                                   
=> $alter_alarm,
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                               'currentPage'           => 
$datatable['sorting']['currentPage'],
+                                       'records'                       => 
array()
                        );
-                       $this->save_sessiondata();
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('alarm') . ': ' . lang('list alarm');
-//_debug_array($data);
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
+                       {
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               $json_row[$column['name']] = 
$column['value'];
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               
+                               return $json;                   
+                               
+                       }
+//-------------------- JSON CODE ----------------------                
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
                }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
 
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('alarm') . ': ' . lang('list alarm');
 
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'alarm.index', 'property' );
+
+                       
+
+                       //$this->save_sessiondata();            
+       }
+
                function list_alarm()
                {
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::agreement::alarm';
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('alarm',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs'));
-
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt','');
+
                        $values         = phpgw::get_var('values');
                        if($values['delete_alarm'] && count($values['alarm'])):
                        {
@@ -316,9 +460,64 @@
                        }
                        endif;
 
+
+                       $datatable = array();
+                       $values_combo_box = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uialarm.list_alarm',
+                                               'query'                         
=> $this->query
+
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uialarm.list_alarm',"
+                                                                               
                        ."query:'{$this->query}'";
+
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uialarm.list_alarm',
+                                                                       'query' 
                        => $this->query
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
   SEARCH
+                                                                   'id'        
        => 'btn_search',
+                                                                   'name'      
        => 'search',
+                                                                   'value'     
        => lang('search'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'      
        => 'query',
+                                                                   'id'        
        => 'txt_query',
+                                                                   'value'     
        => $this->query,
+                                                                   'type'      
        => 'text',
+                                                                   'size'      
        => 28,
+                                                                   
'onkeypress'=> 'return pulsar(event)',
+                                                                       
'tab_index'     => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array()
+                                                                               
                )
+                                                                               
  )
+                               );
+                               //cramirez: $dry_run is use "$this->bo->read"
+                               //$dry_run=true;
+
+                       }
+
+                       $list = array();
+                       //cramirez: $dry_run avoid to load all data the first 
time
                        $list = $this->bo->read();
-//_debug_array($list);
-
+//die(_debug_array($list));
                        while (is_array($list) && list($id,$alarm) = 
each($list))
                        {
                                if(is_array($alarm['times']))
@@ -359,6 +558,7 @@
 
                                $content[] = array
                                (
+                                       'id_cod'                        => 
$id[1],
                                        'id'                            => 
$alarm['id'],
                                        'next_run'                      => 
$GLOBALS['phpgw']->common->show_date($alarm['next']),
                                        'method'                        => 
$alarm['method'],
@@ -366,9 +566,9 @@
                                        'data'                          => 
$data,
                                        'enabled'                       => 
$alarm['enabled'],
                                        'user'                          => 
$alarm['user'],
-                                       'link_edit'                     => 
$link_edit,
-                                       'lang_edit_statustext'          => 
$lang_edit_statustext,
-                                       'text_edit'                     => 
$text_edit
+//                                     'link_edit'                     => 
$link_edit,
+//                                     'lang_edit_statustext'          => 
$lang_edit_statustext,
+//                                     'text_edit'                     => 
$text_edit
                                );
                                unset($alarm);
                                unset($data);
@@ -378,123 +578,188 @@
                                unset($text_edit);
                        }
 
-                       $table_header = array
-                       (
-                               'lang_next_run'         => lang('Next run'),
-                               'lang_times'            => lang('Times'),
-                               'lang_method'           => lang('Method'),
-                               'lang_user'             => lang('User'),
-                               'lang_data'             => lang('Data'),
-                               'lang_select'           => lang('select'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_alarm_id'         => lang('alarm id'),
-                               'lang_enabled'          => lang('enabled'),
-                               'sort_user'             => 
$this->nextmatchs->show_sort_order(array
+
+//die(_debug_array($content));
+
+
+
+                       $uicols = array (
+                               array(
+                                       'col_name'=>id,                 
'input_type'=>hidden,   'name'=>'id_cod',       'descr'=>'',                    
        'className'=>'',                                'sortable'=>false 
,'formatter'=>'',             'sort_field'=>''),
+                               array(
+                                       'col_name'=>alarm_id,   
'input_type'=>varchar,  'name'=>'id',           'descr'=>lang('alarm id'),      
'className'=>'centerClasss',    'sortable'=>true ,'formatter'=>'',              
'sort_field'=>'id'),
+                               array(
+                                       'col_name'=>next_run,   
'input_type'=>varchar,  'name'=>'next_run',     'descr'=>lang('Next run'),      
'className'=>'centerClasss',    'sortable'=>true ,'formatter'=>'',              
'sort_field'=>'next'),
+                               array(
+                                       'col_name'=>data,               
'input_type'=>varchar,  'name'=>'data',         'descr'=>lang('Data'),          
'className'=>'leftClasss',              'sortable'=>false ,'formatter'=>'',     
'       sort_field'=>''),
+                               array(
+                                       'col_name'=>enable,             
'input_type'=>varchar,  'name'=>'enabled',      'descr'=>lang('enabled'),       
'className'=>'centerClasss',    'sortable'=>false ,'formatter'=>'',             
'sort_field'=>''),
+                               array(
+                                       'col_name'=>user,               
'input_type'=>varchar,  'name'=>'user',         'descr'=>lang('User'),          
'className'=>'centerClasss',    'sortable'=>true ,'formatter'=>'',              
'sort_field'=>'account_lid')
+                               );
+
+                       $j=0;
+                       if (isset($content) && is_array($content))
+                       {
+                               foreach($content as $alarm)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']             = 
$uicols[$i]['col_name'];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']            = 
$alarm[$uicols[$i]['name']];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['format']           = 
$uicols[$i]['input_type'];
+                                       }
+                                       $j++;
+                               }
+                       }
+
+//die(_debug_array($datatable['rows']));
+                       $datatable['rowactions']['action'] = array();
+                       $parameters = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'account_lid',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.list_alarm',
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
)),
-                               'sort_method'           => 
$this->nextmatchs->show_sort_order(array
+                               'parameter' => array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'method',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.list_alarm',
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
)),
-                               'sort_next_run'         => 
$this->nextmatchs->show_sort_order(array
+                                       array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'next',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.list_alarm',
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
)),
-                               'sort_alarm_id'         => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uialarm.list_alarm',
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'allrows'       => 
$this->allrows)
-                                                                               
))
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
                        );
 
-                       $alter_alarm = array
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'edit',
+                                       'text'                  => lang('edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_enable'           => lang('Enable'),
-                               'lang_disable'          => lang('Disable'),
-                               'lang_delete'           => lang('Delete'),
-                               'lang_test_cron'        => lang('test cron')
+                                                                               
'menuaction'    => 'property.uis_agreement.edit',
+                                                                       )),
+                                       'parameters'    => $parameters
                                );
+                       unset($parameters);
 
-                       $table_add = array
-                       (
-                               'lang_add'              => lang('add'),
-                               'lang_add_statustext'   => lang('add an alarm'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uialarm.edit'))
-                       );
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uialarm.list_alarm',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query
-                       );
+                       for ($i=0;$i<count($uicols);$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
 
-                       if(!$this->allrows)
+                               $datatable['headers']['header'][$i]['name']     
        = $uicols[$i]['col_name'];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols[$i]['descr'];
+                               $datatable['headers']['header'][$i]['sortable'] 
        = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols[$i]['sort_field'];
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols[$i]['className'];
+
+                               if($uicols[$i]['input_type']!='hidden')
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                                       
$datatable['headers']['header'][$i]['visible']  = true;
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                                       
$datatable['headers']['header'][$i]['visible']  = false;
+                               }
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+//die(_debug_array($datatable['headers']));
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $data = array
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= $uicols[0]['col_name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the alarm belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
=> '',//$this->bo->select_category_list('filter',$this->cat_id),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
-                               'lang_filter_statustext'                        
=> lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_alarm'                            
=> $table_header,
-                               'values_alarm'                                  
=> $content,
-                               'alter_alarm'                                   
=> $alter_alarm,
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
-                       $this->save_sessiondata();
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               $json_row[$column['name']] = 
$column['value'];
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('alarm') . ': ' . lang('list alarm');
-//_debug_array($data);
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_alarm' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'alarm.list_alarm', 'property' );
+
+                       //$this->save_sessiondata();
                }
 
                function edit()

Modified: people/sigurdne/modules/property/trunk/inc/class.uiasync.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiasync.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiasync.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -55,8 +56,6 @@
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'admin::property::async';
 
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                               = 
CreateObject('property.boasync',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
@@ -73,7 +72,7 @@
                        $this->query                            = 
$this->bo->query;
                        $this->sort                             = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
-       //              $this->allrows                          = 
$this->bo->allrows;
+                       $this->allrows                          = 
$this->bo->allrows;
 
                        if(!$this->acl_manage)
                        {
@@ -97,11 +96,381 @@
 
                function index()
                {
+                       $datatable = array();
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('async','nextmatchs','search_field'));
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 'property.uiasync.index',
+                               'order'                 => $this->order,
+                                       'query'         => $this->query,
+                                       'sort'          => $this->sort
+                               ));
 
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiasync.index',"
+                                                                               
                                ."order:'{$this->order}',"
+                                                                               
                                ."query:'{$this->query}',"
+                                                                               
                                ."sort:'{$this->sort}'";
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uiasync.index',
+                                       'order'                 => $this->order,
+                                       'query'         => $this->query,
+                                       'sort'          => $this->sort
+                               );
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uiasync.index',
+                                                               'order'         
        => $this->order,
+                                                               'query'         
=> $this->query,
+                                                               'sort'          
=> $this->sort
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array
+                                                               (
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 9
+                                                                               
    ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       )
+                                                                               
)
+                                                                               
)
+                                        )
+                               );
+                               $dry_run = true;
+                       }
+
                        $method_list = $this->bo->read();
+                       $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('method ID');
+                       $uicols['className'][0] = 'rightClasss';
+                       $uicols['name'][1]      = 'name';
+                       $uicols['descr'][1]     = lang('Name');
+                       $uicols['name'][2]      = 'data';
+                       $uicols['descr'][2]     = lang('Data');
+                       $uicols['name'][3]      = 'descr';
+                       $uicols['descr'][3]     = lang('Description');
+                       $uicols['name'][4]      = 'url';
+                       $uicols['descr'][4]     = lang('URL');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
+                       if (isset($method_list) AND is_array($method_list))
+                       {
+                               foreach($method_list as $method_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $method_entry[$uicols['name'][$k]];
+                                                       if($uicols['name'][$k] 
== 'data')
+                                                       {
+                                                               $data_set = 
unserialize($method_entry[$uicols['name'][$k]]);
+                                                               
$method_data=array();
+                                                               foreach 
($data_set as $key => $value)
+                                                               {
+                                                                       
$method_data[] = $key . '=' . $value;
+                                                               }
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= @implode (',',$method_data);
+                                                       }
+                                                       if($uicols['name'][$k] 
== 'url')
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                               $run_link_data 
= array();
+                                                               
$run_link_data['menuaction']    = $method_entry['name'];
+                                                               
$run_link_data['data']                  = urlencode($method_entry['data']);
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['value']                    =       
$run_link_data['menuaction']."&data=".urlencode($run_link_data['data']);
+                                                       }
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       //_debug_array($datatable);die;
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'menuaction',
+                                               'source'        => 'url'
+                                       ),
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'method_id',
+                                               'source'        => 'id'
+                                       )
+                               )
+                       );
+
+                       $parameters3 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       )
+                               )
+                       );
+
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'run',
+                                               'statustext'    => lang('Run 
Now'),
+                                               'text'                  => 
lang('Run Now'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               //'menuaction'  
        => 'property.uiasync.edit'
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'schedule',
+                                               'statustext'    => 
lang('Schedule'),
+                                               'text'                  => 
lang('Schedule'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uialarm.edit'
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters2
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'edit',
+                                               'statustext'    => lang('Edit'),
+                                               'text'                  => 
lang('Edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiasync.edit'
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters3
+                                       );
+
+                       $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'                       
=> 'delete',
+                                               'statustext'    => 
lang('Delete'),
+                                               'text'                  => 
lang('Delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link
+                                               (
+                                                       '/index.php',array
+                                                       (
+                                                               'menuaction'    
        => 'property.uiasync.delete'
+                                                       )
+                                               ),
+                                               'parameters'    => $parameters3
+                                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiasync.edit'
+                                                                       ))
+                                               );
+
+
+                       unset($parameters);
+                       unset($parameters2);
+                       unset($parameters3);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['className']                = 
$uicols['className'][$i];
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='url')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']          = false;
+                                       }
+
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
+                                       }
+
+                                       if($uicols['name'][$i]=='name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($method_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname        = lang('method');
+                       $function_msg   = lang('list async method');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uiasync.index', 'property' );
+
+                       $this->save_sessiondata();
+
+                       
/*$GLOBALS['phpgw']->xslttpl->add_file(array('async','nextmatchs','search_field'));
+
+                       $method_list = $this->bo->read();
+
                        foreach ($method_list as $method)
                        {
                                $data_set = unserialize($method['data']);
@@ -202,7 +571,7 @@
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+                       $this->save_sessiondata();*/
                }
 
                function edit()
@@ -311,17 +680,17 @@
                        $id             = phpgw::get_var('id', 'int');
                        $confirm                = phpgw::get_var('confirm', 
'bool', 'POST');
 
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id);
+                               return "id ".$id." ".lang("has been deleted");
+                       }
+
                        $link_data = array
                        (
                                'menuaction' => 'property.uiasync.index'
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               $this->bo->delete($id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array

Modified: people/sigurdne/modules/property/trunk/inc/class.uib_account.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uib_account.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uib_account.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -54,8 +55,6 @@
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::invoice::budget';
 
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs               = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo                       = 
CreateObject('property.bob_account',true);
@@ -95,6 +94,265 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'                    => 
'property.uib_account.index'//,
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uib_account.index'";
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uib_account.index'//,
+                                       //'id'          => $id
+                               );
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uib_account.index'//,
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array
+                                                               (
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       )
+                                                                               
)
+                                                                               
)
+                                        )
+                               );
+                       }
+
+                       $b_account_list = $this->bo->read($type);
+
+                       $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('Budget account');
+                       $uicols['name'][1]      = 'descr';
+                       $uicols['descr'][1]     = lang('Description');
+
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($b_account_list) AND 
is_array($b_account_list))
+                       {
+                               foreach($b_account_list as $account_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $account_entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'    => 
lang('edit the account'),
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uib_account.edit'
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
+                       }
+
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'delete',
+                                                       'statustext'    => 
lang('delete the actor'),
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uib_account.delete'
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
+                       }
+
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                       (
+                                               'menuaction'    => 
'property.uib_account.edit'
+                                       )));
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($b_account_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                                        = 
lang('budget account');
+                       $function_msg                           = lang('list 
budget account');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'account.index', 'property' );
+
+
+
+                       //_debug_array($datatable);die;
+                       /*if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array('b_account', 
'nextmatchs', 'search_field'));
 
                        $b_account_list = $this->bo->read($type);
@@ -190,7 +448,7 @@
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+                       $this->save_sessiondata();*/
                }
 
                function edit()
@@ -298,18 +556,19 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
                        }
 
-                       $id             = phpgw::get_var('id', 'int');
-                       $confirm                = phpgw::get_var('confirm', 
'bool', 'POST');
+                       $id             = phpgw::get_var('id'); // string
+                       //$confirm              = phpgw::get_var('confirm', 
'bool', 'POST');
 
                        $link_data = array
                        (
                                'menuaction' => 'property.uib_account.index'
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
                                $this->bo->delete($id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               return "id ".$id." ".lang("has been deleted");
+                               
//$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));

Modified: people/sigurdne/modules/property/trunk/inc/class.uibudget.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uibudget.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uibudget.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -31,7 +31,7 @@
         * Description
         * @package property
         */
-
+       phpgw::import_class('phpgwapi.yui');
        class property_uibudget
        {
                var $grants;
@@ -54,32 +54,30 @@
                        'delete'                => true,
                        'delete_basis'          => true
                );
-
                function property_uibudget()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::budget';
 
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo                       = 
CreateObject('property.bobudget',true);
                        $this->bocommon         = & $this->bo->bocommon;
                        $this->cats                     = & $this->bo->cats;
 
-
                        $this->start            = $this->bo->start;
                        $this->query            = $this->bo->query;
                        $this->sort             = $this->bo->sort;
                        $this->order            = $this->bo->order;
                        $this->filter           = $this->bo->filter;
                        $this->cat_id           = $this->bo->cat_id;
+                       $this->dimb_id          = $this->bo->dimb_id;
                        $this->allrows          = $this->bo->allrows;
                        $this->district_id      = $this->bo->district_id;
                        $this->year             = $this->bo->year;
                        $this->grouping         = $this->bo->grouping;
                        $this->revision         = $this->bo->revision;
+                       $this->details          = $this->bo->details;
 
                        $this->acl                      = & 
$GLOBALS['phpgw']->acl;
 
@@ -95,7 +93,8 @@
                                'order'                 => $this->order,
                                'filter'                => $this->filter,
                                'cat_id'                => $this->cat_id,
-                               'this->allrows' => $this->allrows
+                               'dimb_id'               => $this->dimb_id,
+                               'allrows'               => $this->allrows
                        );
                        $this->bo->save_sessiondata($data);
                }
@@ -113,198 +112,409 @@
                        $acl_add        = $this->acl->check($acl_location, 
PHPGW_ACL_ADD, 'property');
                        $acl_edit       = $this->acl->check($acl_location, 
PHPGW_ACL_EDIT, 'property');
                        $acl_delete     = $this->acl->check($acl_location, 
PHPGW_ACL_DELETE, 'property');
+                       
                        $revision_list  = 
$this->bo->get_revision_filter_list($this->revision); // reset year
                        $this->year     = $this->bo->year;
                        $this->revision = $this->bo->revision;
-
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::budget';
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('budget',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs'));
+                       $datatable = array();
+                       $values_combo_box = array();
 
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','budget_receipt');
-                       
$GLOBALS['phpgw']->session->appsession('session_data','budget_receipt','');
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                                       'menuaction'    
=>'property.uibudget.index',
+                                                       'sort'                  
=>$this->sort,
+                                                       'order'                 
=>$this->order,
+                                                       'cat_id'                
=>$this->cat_id,
+                                                       'dimb_id'               
=>$this->dimb_id,
+                                                       'filter'                
=>$this->filter,
+                                                       'query'                 
=>$this->query,
+                                                       'district_id'   
=>$this->district_id,
+                                                       'year'                  
=>$this->year,
+                                                       'grouping'              
=>$this->grouping,
+                                                       'revision'              
=>$this->revision
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
 
-                       $list = $this->bo->read();
-                       if (isset($list) AND is_array($list))
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uibudget.index',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."cat_id: '{$this->cat_id}',"
+                                                                               
."dimb_id: '{$this->dimb_id}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."district_id:'{$this->district_id}',"
+                                                                               
."year:'{$this->year}',"
+                                                                               
."grouping:'{$this->grouping}',"
+                                                                               
."revision:'{$this->revision}'";
+
+                               $values_combo_box[0]  = 
$this->bo->get_year_filter_list($this->year);
+                               $default_value = array 
('id'=>'','name'=>lang('no year'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+                               
+                               $values_combo_box[1]  = 
$this->bo->get_revision_filter_list($this->revision);
+                               $default_value = array 
('id'=>'','name'=>lang('no revision')); 
+                               if (count($values_combo_box[1]))
                        {
-                               $sum = 0;
-                               foreach($list as $entry)
+                                       array_unshift 
($values_combo_box[1],$default_value);
+                               }
+                               else
                                {
+                                       $values_combo_box[1][] = $default_value;
+                               }
 
-                                       $content[] = array
-                                       (
-                                               'year'                          
=> $entry['year'],
-                                               'b_account_id'                  
=> $entry['b_account_id'],
-                                               'b_account_name'                
=> $entry['b_account_name'],
-                                               'grouping'                      
=> $entry['grouping'],
-                                               'district_id'                   
=> $entry['district_id'],
-                                               'revision'                      
=> $entry['revision'],
-                                               'budget_cost'                   
=> $entry['budget_cost'],
-                                               'link_edit'                     
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.edit', 'budget_id'=> $entry['budget_id'])),
-                                               'link_delete'                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.delete', 'budget_id'=> $entry['budget_id'])),
-                                               'lang_edit_text'                
=> lang('edit the budget record'),
-                                               'lang_delete_text'              
=> lang('delete the budget record'),
-                                               'text_edit'                     
=> lang('edit'),
-                                               'text_delete'                   
=> lang('delete')
-                                       );
-                                       $sum = $sum + $entry['budget_cost'];
+                               $values_combo_box[2]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               if(count($values_combo_box[2]))
+                               {
+                                       $default_value = array 
('id'=>'','name'=>lang('no district'));
+                                       array_unshift 
($values_combo_box[2],$default_value);
                                }
+                               
+
+                       $values_combo_box[3] =  
$this->bo->get_grouping_filter_list($this->grouping);
+                               $default_value = array 
('id'=>'','name'=>lang('no grouping'));
+                               if (count($values_combo_box[3]))
+                               {
+                                       array_unshift 
($values_combo_box[3],$default_value);
+                               }
+                               else
+                               {
+                                       $values_combo_box[3][] = $default_value;
                        }
 
-                       $table_header[] = array
-                       (
-                               'lang_year'             => lang('year'),
-                               'lang_revision'         => lang('revision'),
-                               'lang_b_account'        => lang('budget 
account'),
-                               'lang_name'             => lang('name'),
-                               'lang_budget_cost'      => lang('budget_cost'),
-                               'lang_grouping'         => lang('grouping'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'lang_district_id'      => lang('district_id'),
+                               $values_combo_box[4] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => True));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[4]['cat_list'],$default_value);
 
-                               'sort_district_id'      => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'district_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.index',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'       
=>$this->allrows)
-                                                                               
)),
+                               $values_combo_box[5]  = 
$this->bocommon->select_category_list(array('type'=>'dimb'));
+                               $default_value = array 
('id'=>'','name'=>lang('no dimb'));
+                               array_unshift 
($values_combo_box[5],$default_value);
 
-                               'sort_b_account_id'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'b_account_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.index',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uibudget.index',
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
YEAR
+                                                                   'id'        
        => 'btn_year',
+                                                                   'name'      
        => 'year',
+                                                                   'value'     
        => lang('year'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array( //boton  
REVISION
+                                                                   'id'        
        => 'btn_revision',
+                                                                   'name'      
        => 'revision',
+                                                                   'value'     
        => lang('revision'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                               array( //boton  
DISTRICT
+                                                                   'id'        
        => 'btn_district_id',
+                                                                   'name'      
        => 'district_id',
+                                                                   'value'     
        => lang('district_id'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                               array( //boton  
GROUPING
+                                                                   'id'        
        => 'btn_grouping',
+                                                                   'name'      
        => 'grouping',
+                                                                   'value'     
        => lang('grouping'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                               array( //boton  
GROUPING
+                                                                   'id'        
        => 'btn_cat_id',
+                                                                   'name'      
        => 'cat_id',
+                                                                   'value'     
        => lang('category'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 5
+                                                               ),
+                                                               array( //boton  
GROUPING
+                                                                   'id'        
        => 'btn_dimb_id',
+                                                                   'name'      
        => 'dimb_id',
+                                                                   'value'     
        => lang('dimb'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 6
+                                                               ),
+                                                               array( //boton  
   add
+                                                                   'id'        
        => 'btn_new',
+                                                                   'name'      
        => 'new',
+                                                                   'value'     
=> lang('add'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 9
+                                                               ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id'        
        => 'btn_search',
+                                                                   'name'      
        => 'search',
+                                                                   'value'     
=> lang('search'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 8
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'      
=> 'query',
+                                                                   'id'        
=> 'txt_query',
+                                                                   'value'     
=> $this->query,
+                                                                   'type'      
        => 'text',
+                                                                   'size'      
=> 28,
+                                                                   
'onkeypress'=> 'return pulsar(event)',
+                                                                       
'tab_index' => 7
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
              ),
+                                                                               
                                         array( //div values  combo_box_2
+                                                                               
                    'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_3
+                                                                               
                    'id' => 'values_combo_box_3',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[3])
+                                                                               
              ),
+                                                                               
    array( //div values  combo_box_4
+                                                                               
                        'id' => 'values_combo_box_4',
+                                                                               
                        'value' => 
$this->bocommon->select2String($values_combo_box[4]['cat_list'], 'cat_id') 
//i.e.  id,value/id,vale/
+                                                                               
                 ),
+                                                                               
        array( //div values  combo_box_5
+                                                                               
                    'id' => 'values_combo_box_5',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[5])
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                               $dry_run=true;
 
-                               'sort_grouping' => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'category',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.index',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
+                       }
 
-                               'sort_budget_cost'      => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'budget_cost',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.index',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
+                       $location_list = array();
+                       $location_list = $this->bo->read();
+                       $uicols = array (
+                               array(
+                                       'visible'=>false,       
'name'=>'budget_id',            'label'=>'dummy',                               
'className'=>'',                        'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'visible'=>true,        'name'=>'year', 
                'label'=>lang('year'),                  
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',               
        'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'revision',             'label'=>lang('revision'),              
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',               
        'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'b_account_id', 'label'=>lang('budget 
account'),'className'=>'rightClasss', 'sortable'=>false,  'sort_field'=>'',     
                  'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'b_account_name',       'label'=>lang('name'),                  
'className'=>'leftClasss',      'sortable'=>false,      'sort_field'=>'',       
                'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'grouping',             'label'=>lang('grouping'),              
'className'=>'rightClasss', 'sortable'=>true,   'sort_field'=>'category',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'district_id',  'label'=>lang('district_id'),   
'className'=>'rightClasss', 'sortable'=>true,   
'sort_field'=>'district_id','formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'ecodimb',      'label'=>lang('dimb'),  'className'=>'rightClasss', 
'sortable'=>true,   'sort_field'=>'fm_budget.ecodimb','formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'category',     'label'=>lang('category'),      
'className'=>'rightClasss', 'sortable'=>false,  
'sort_field'=>'','formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'budget_cost',  'label'=>lang('budget_cost'),   
'className'=>'rightClasss', 'sortable'=>true,   
'sort_field'=>'budget_cost','formatter'=>myFormatDate),
+                       );                      
+
+                       $content = array();
+                       $j = 0;
+                       if (isset($location_list) && is_array($location_list))
+                       {
+                               foreach($location_list as $location)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols[$i]['name'];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$location[$uicols[$i]['name']];
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array('parameter' => array(array( 
'name'=> 'budget_id',
+                                                                               
                                        'source'=> 'budget_id')));
+
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'               => 'edit',
+                               'text'                  => lang('edit'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'      => 
'property.uibudget.edit')),
+                               'parameters'    => $parameters
                        );
 
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'               => 'delete',
+                               'text'                  => lang('delete'),
+                               'confirm_msg'   => lang('do you really want to 
delete this entry'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'      => 
'property.uibudget.delete')),
+                               'parameters'    => $parameters
+                       );
+
                        if($acl_add)
                        {
-                               $table_add = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
budget query'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.edit'))
+                               $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.edit'))
                                );
                        }
+                       unset($parameters);
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uibudget.index',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'cat_id'        =>$this->cat_id,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query,
-                               'district_id'   =>$this->district_id,
-                               'year'          =>$this->year,
-                               'grouping'      =>$this->grouping,
-                               'revision'      =>$this->revision
-                       );
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
 
-                       if(!$this->allrows)
+                       for ($i=0;$i<count($uicols);$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols[$i]['name'];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols[$i]['label'];
+                               $datatable['headers']['header'][$i]['visible']  
        = $uicols[$i]['visible'];
+                               $datatable['headers']['header'][$i]['sortable'] 
        = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols[$i]['sort_field'];
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols[$i]['className'];
+                               
$datatable['headers']['header'][$i]['formatter']        = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
                        }
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($location_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= $uicols[0]['name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $data = array
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'sum'                                           
=> $sum,
-                               'lang_sum'                                      
=> lang('sum'),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_budget'                           
=> $table_header,
-                               'values_budget'                                 
=> $content,
-                               'table_add'                                     
=> $table_add,
-                               'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'                              
=> lang('no district'),
-                               'lang_district_statustext'                      
=> lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                          
=> 'district_id',
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
 
-                               'year_list'                                     
=> $this->bo->get_year_filter_list($this->year),
-                               'lang_no_year'                                  
=> lang('no year'),
-                               'lang_year_statustext'                          
=> lang('Select the year the selection belongs to'),
+                               // values for datatable
+                               $json_row = array();
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
+                       {
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               $json_row[$column['name']] = 
$column['value'];
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+                               //Depended select: REVISION
+                       $opt_cb_depend  = 
$this->bo->get_revision_filter_list($this->revision);
+                               $default_value = array 
('id'=>'','name'=>lang('no revision')); 
+                               if (count($opt_cb_depend))
+                               {
+                                       array_unshift 
($opt_cb_depend,$default_value);
+                               }
+                               else
+                               {
+                                       $opt_cb_depend[] = $default_value;
+                               }
+                               $json['hidden']['dependent'][] = array ('id'    
=> $this->revision,
+                                                                               
                                'value' => 
$this->bocommon->select2String($opt_cb_depend)
+                                                                               
                                );
 
-                               'grouping_list'                                 
=> $this->bo->get_grouping_filter_list($this->grouping),
-                               'lang_no_grouping'                              
=> lang('no grouping'),
-                               'lang_grouping_statustext'                      
=> lang('Select the grouping the selection belongs to'),
-
-                               'revision_list'                                 
=> $this->bo->get_revision_filter_list($this->revision),
-                               'lang_no_revision'                              
=> lang('no revision'),
-                               'lang_revision_statustext'                      
=> lang('Select the revision the selection belongs to'),
+                               //Depended select: GROPING
+                       $opt_cb_depend  = 
$this->bo->get_grouping_filter_list($this->grouping);
+                               $default_value = array 
('id'=>'','name'=>lang('no grouping'));
+                               if (count($opt_cb_depend))
+                               {
+                                       array_unshift 
($opt_cb_depend,$default_value);
+                               }
+                               else
+                               {
+                                       $opt_cb_depend[] = $default_value;
+                               }
+                               $json['hidden']['dependent'][] = array ('id'    
=> $this->grouping,
+                                                                               
                                'value' => 
$this->bocommon->select2String($opt_cb_depend)
                        );
 
-                       $this->save_sessiondata();
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . lang('list budget');
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               
+                               $json ['revision'] = $this->revision;
+                               //_debug_array($json);
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
                }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
 
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . lang('list budget');
 
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'budget.index', 'property' );
+               }
                function basis()
                {
                        $acl_location   = '.budget';
@@ -318,199 +528,380 @@
                        $acl_add        = $this->acl->check($acl_location, 
PHPGW_ACL_ADD, 'property');
                        $acl_edit       = $this->acl->check($acl_location, 
PHPGW_ACL_EDIT, 'property');
                        $acl_delete     = $this->acl->check($acl_location, 
PHPGW_ACL_DELETE, 'property');
+                       
                        $revision_list  = 
$this->bo->get_revision_filter_list($this->revision,$basis=true); // reset year
                        $this->year     = $this->bo->year;
                        $this->revision = $this->bo->revision;
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::basis';
 
+                       $datatable = array();
+                       $values_combo_box = array();
 
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::basis';
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                                       'menuaction'    
=>'property.uibudget.basis',
+                                                       'sort'                  
=>$this->sort,
+                                                       'order'                 
=>$this->order,
+                                                       'cat_id'                
=>$this->cat_id,
+                                                       'filter'                
=>$this->filter,
+                                                       'query'                 
=>$this->query,
+                                                       'district_id'   
=>$this->district_id,
+                                                       'year'                  
=>$this->year,
+                                                       'grouping'              
=>$this->grouping,
+                                                       'revision'              
=>$this->revision
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('budget',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs'));
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uibudget.basis',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."cat_id: '{$this->cat_id}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."district_id:'{$this->district_id}',"
+                                                                               
."year:'{$this->year}',"
+                                                                               
."grouping:'{$this->grouping}',"
+                                                                               
."revision:'{$this->revision}'";
 
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_basis_data','budget_receipt');
-                       
$GLOBALS['phpgw']->session->appsession('session_data','budget_receipt','');
-
-                       $list = $this->bo->read_basis();
-                       if (isset($list) AND is_array($list))
+                               $values_combo_box[0]  = 
$this->bo->get_year_filter_list($this->year,$basis=true);
+                               if(count($values_combo_box[0]))
+                               {
+                                       $default_value = array 
('id'=>'','name'=>lang('no year'));
+                                       array_unshift 
($values_combo_box[0],$default_value);
+                               }
+                               
+                               $values_combo_box[1]  = 
$this->bo->get_revision_filter_list($this->revision,$basis=true);
+                               $default_value = array 
('id'=>'','name'=>lang('no revision')); 
+                               if (count($values_combo_box[1]))
                        {
-                               $sum = 0;
-                               foreach($list as $entry)
+                                       array_unshift 
($values_combo_box[1],$default_value);
+                               }
+                               else
                                {
+                                       $values_combo_box[1][] = $default_value;
+                               }
 
-                                       $content[] = array
-                                       (
-                                               'year'                          
=> $entry['year'],
-                                               'grouping'                      
=> $entry['grouping'],
-                                               'district_id'                   
=> $entry['district_id'],
-                                               'revision'                      
=> $entry['revision'],
-                                               'budget_cost'                   
=> $entry['budget_cost'],
-                                               'link_edit'                     
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.edit_basis', 'budget_id'=> $entry['budget_id'])),
-                                               'link_delete'                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.delete_basis', 'budget_id'=> $entry['budget_id'])),
-                                               'lang_edit_text'                
=> lang('edit the budget record'),
-                                               'lang_delete_text'              
=> lang('delete the budget record'),
-                                               'text_edit'                     
=> lang('edit'),
-                                               'text_delete'                   
=> lang('delete')
-                                       );
-                                       $sum = $sum + $entry['budget_cost'];
+                               $values_combo_box[2]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               if(count($values_combo_box[2]))
+                               {
+                                       $default_value = array 
('id'=>'','name'=>lang('no district'));
+                                       array_unshift 
($values_combo_box[2],$default_value);
                                }
+                               
+
+                       $values_combo_box[3] =  
$this->bo->get_grouping_filter_list($this->grouping,$basis=true);
+                               $default_value = array 
('id'=>'','name'=>lang('no grouping'));
+                               if (count($values_combo_box[3]))
+                               {
+                                       array_unshift 
($values_combo_box[3],$default_value);
+                               }
+                               else
+                               {
+                                       $values_combo_box[3][] = $default_value;
                        }
 
-                       $table_header[] = array
-                       (
-                               'lang_year'             => lang('year'),
-                               'lang_revision'         => lang('revision'),
-                               'lang_budget_cost'      => lang('budget_cost'),
-                               'lang_grouping'         => lang('grouping'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'lang_district_id'      => lang('district_id'),
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uibudget.basis',
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
YEAR
+                                                                   'id'        
        => 'btn_year',
+                                                                   'name'      
        => 'year',
+                                                                   'value'     
        => lang('year'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array( //boton  
REVISION
+                                                                   'id'        
        => 'btn_revision',
+                                                                   'name'      
        => 'revision',
+                                                                   'value'     
        => lang('revision'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                               array( //boton  
DISTRICT
+                                                                   'id'        
        => 'btn_district_id',
+                                                                   'name'      
        => 'district_id',
+                                                                   'value'     
        => lang('district_id'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                               array( //boton  
GROUPING
+                                                                   'id'        
        => 'btn_grouping',
+                                                                   'name'      
        => 'grouping',
+                                                                   'value'     
        => lang('grouping'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                               array( //boton  
   add
+                                                                   'id'        
        => 'btn_new',
+                                                                   'name'      
        => 'new',
+                                                                   'value'     
=> lang('add'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 7
+                                                               ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id'        
        => 'btn_search',
+                                                                   'name'      
        => 'search',
+                                                                   'value'     
=> lang('search'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 6
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'      
=> 'query',
+                                                                   'id'        
=> 'txt_query',
+                                                                   'value'     
=> $this->query,
+                                                                   'type'      
        => 'text',
+                                                                   'size'      
=> 28,
+                                                                   
'onkeypress'=> 'return pulsar(event)',
+                                                                       
'tab_index' => 5
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
              ),
+                                                                               
                                         array( //div values  combo_box_2
+                                                                               
                    'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_3
+                                                                               
                    'id' => 'values_combo_box_3',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[3])
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                               $dry_run=true;
 
-                               'sort_district_id'      => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'district_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.basis',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'       
=>$this->allrows)
-                                                                               
)),
+                       }
 
-                               'sort_b_account_id'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'b_account_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.basis',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
+                       $location_list = array();
+                       $location_list = $this->bo->read_basis();
+                       //_debug_array($location_list);
 
-                               'sort_grouping' => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'b_group',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.basis',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
+                       $uicols = array (
+                               array(
+                                       'visible'=>false,       
'name'=>'budget_id',            'label'=>'dummy',                               
'className'=>'',                        'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'visible'=>true,        'name'=>'year', 
                'label'=>lang('year'),                  
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',               
        'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'revision',             'label'=>lang('revision'),              
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',               
        'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'grouping',             'label'=>lang('grouping'),              
'className'=>'rightClasss', 'sortable'=>true,   'sort_field'=>'b_group',        
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'district_id',  'label'=>lang('district_id'),   
'className'=>'rightClasss', 'sortable'=>true,   
'sort_field'=>'district_id','formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'ecodimb',      'label'=>lang('dimb'),  'className'=>'rightClasss', 
'sortable'=>true,   'sort_field'=>'fm_budget.ecodimb','formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'category',     'label'=>lang('category'),      
'className'=>'rightClasss', 'sortable'=>false,  
'sort_field'=>'','formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>'budget_cost',  'label'=>lang('budget_cost'),   
'className'=>'rightClasss', 'sortable'=>true,   
'sort_field'=>'budget_cost','formatter'=>myFormatDate),
+                               );                      
 
-                               'sort_budget_cost'      => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'budget_cost',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.basis',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'revision'      
=>$this->revision,
-                                                                               
                                                'allrows'=>$this->allrows)
-                                                                               
)),
+                       $content = array();
+                       $j = 0;
+                       if (isset($location_list) && is_array($location_list))
+                       {
+                               foreach($location_list as $location)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols[$i]['name'];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$location[$uicols[$i]['name']];
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array('parameter' => array(array( 
'name'=> 'budget_id',
+                                                                               
                                        'source'=> 'budget_id')));
+
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'               => 'edit',
+                               'text'                  => lang('edit'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'      => 
'property.uibudget.edit_basis')),
+                               'parameters'    => $parameters
                        );
 
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'               => 'delete',
+                               'text'                  => lang('delete'),
+                               'confirm_msg'   => lang('do you really want to 
delete this entry'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'      => 
'property.uibudget.delete_basis')),
+                               'parameters'    => $parameters
+                       );
 
-
                        if($acl_add)
                        {
-                               $table_add = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
budget query'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.edit_basis'))
-                               );
+                               $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.edit_basis'))
+                       );
                        }
+                       unset($parameters);
+                       
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
 
-                       $link_data = array
+                       for ($i=0;$i<count($uicols);$i++)
+                       {
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols[$i]['name'];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols[$i]['label'];
+                               $datatable['headers']['header'][$i]['visible']  
        = $uicols[$i]['visible'];
+                               $datatable['headers']['header'][$i]['sortable'] 
        = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols[$i]['sort_field'];
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols[$i]['className'];
+                               
$datatable['headers']['header'][$i]['formatter']        = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
+                       }
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($location_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= $uicols[3]['name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 'property.uibudget.basis',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'cat_id'        =>$this->cat_id,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query,
-                               'district_id'   =>$this->district_id,
-                               'year'          =>$this->year,
-                               'grouping'      =>$this->grouping,
-                               'revision'      =>$this->revision
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       if(!$this->allrows)
+                               // values for datatable
+                               $json_row = array();
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               $json_row[$column['name']] = 
$column['value'];
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+                               //Depended select: REVISION
+                       $opt_cb_depend  = 
$this->bo->get_revision_filter_list($this->revision,$basis=true);
+                               $default_value = array 
('id'=>'','name'=>lang('no revision')); 
+                               if (count($opt_cb_depend))
+                               {
+                                       array_unshift 
($opt_cb_depend,$default_value);
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                                       $opt_cb_depend[] = $default_value;
                        }
+                               $json['hidden']['dependent'][] = array ('id'    
=> $this->revision,
+                                                                               
                                'value' => 
$this->bocommon->select2String($opt_cb_depend)
+                                                                               
                                );
 
+                               //Depended select: GROPING
+                       $opt_cb_depend  = 
$this->bo->get_grouping_filter_list($this->grouping,$basis=true);
+                               $default_value = array 
('id'=>'','name'=>lang('no grouping'));
+                               if (count($opt_cb_depend))
+                               {
+                                       array_unshift 
($opt_cb_depend,$default_value);
+                               }
+                               else
+                               {
+                                       $opt_cb_depend[] = $default_value;
+                               }
+                               $json['hidden']['dependent'][] = array ('id'    
=> $this->grouping,
+                                                                               
                                'value' => 
$this->bocommon->select2String($opt_cb_depend)
+                                                                               
                                );                                              
                                
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'sum'                                           
=> $sum,
-                               'lang_sum'                                      
=> lang('sum'),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_budget_basis'                     
=> $table_header,
-                               'values_budget_basis'                           
=> $content,
-                               'table_add'                                     
=> $table_add,
-                               'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'                              
=> lang('no district'),
-                               'lang_district_statustext'                      
=> lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                          
=> 'district_id',
+                               $json ['revision'] = $this->revision;
+                               //_debug_array($json);
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
-                               'year_list'                                     
=> $this->bo->get_year_filter_list($this->year,$basis=true),
-                               'lang_no_year'                                  
=> lang('no year'),
-                               'lang_year_statustext'                          
=> lang('Select the year the selection belongs to'),
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'grouping_list'                                 
=> $this->bo->get_grouping_filter_list($this->grouping,$basis=true),
-                               'lang_no_grouping'                              
=> lang('no grouping'),
-                               'lang_grouping_statustext'                      
=> lang('Select the grouping the selection belongs to'),
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
 
-                               'revision_list'                                 
=> $revision_list,
-                               'lang_no_revision'                              
=> lang('no revision'),
-                               'lang_revision_statustext'                      
=> lang('Select the revision the selection belongs to'),
-                       );
-
-                       $this->save_sessiondata();
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . lang('list budget');
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_basis' => $data));
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'budget.basis', 'property' );
                }
 
                function obligations()
                {
+                       //$this->allrows = 1;
                        $acl_location   = '.budget.obligations';
                        $acl_read       = $this->acl->check($acl_location, 
PHPGW_ACL_READ, 'property');
 
@@ -525,157 +916,343 @@
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::obligations';
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('budget',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs'));
+                       $datatable = array();
+                       $values_combo_box = array();
 
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                                       'menuaction'    
=>'property.uibudget.obligations',
+                                                       'cat_id'                
=>$this->cat_id,
+                                                       'filter'                
=>$this->filter,
+                                                       'query'                 
=>$this->query,
+                                                       'district_id'   
=>$this->district_id,
+                                                       'grouping'              
=>$this->grouping,
+                                               'year'                  
=>$this->year,
+                                                       'details'               
=> $this->details,
+                                                       'allrows'               
=> $this->allrows
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
 
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_obligations_data','budget_receipt');
-                       
$GLOBALS['phpgw']->session->appsession('session_data','budget_receipt','');
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uibudget.obligations',"
+                                                                               
                        ."cat_id: '{$this->cat_id}',"
+                                                                               
        ."filter:'{$this->filter}',"
+                                                                               
        ."query:'{$this->query}',"
+                                                                               
        ."district_id:'{$this->district_id}',"
+                                                                               
        ."grouping:'{$this->grouping}',"
+                                                                               
        ."year:'{$this->year}',"
+                                                                               
        ."details:'{$this->details}',"
+                                                                               
        ."allrows:'{$this->allrows}'";
 
-                       $list = $this->bo->read_obligations();
-                       if (isset($list) AND is_array($list))
+                               $values_combo_box[0]  = 
$this->bo->get_year_filter_list($this->year,$basis=false);
+                               $default_value = array 
('id'=>'','name'=>lang('no year'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+                               
+                               $values_combo_box[1]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no district'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                       $cat_filter =  
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data));
+                       $values_combo_box[2] =  $cat_filter[cat_list];
+                       $default_value = array ('cat_id'=>'','name'=>lang('no 
category'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+                               
+                       $values_combo_box[3] =  
$this->bo->get_b_group_list($this->grouping);
+                               $default_value = array 
('id'=>'','name'=>lang('no grouping'));
+                               array_unshift 
($values_combo_box[3],$default_value);
+                                                       
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uibudget.obligations',
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
YEAR
+                                                                   'id'        
        => 'btn_year',
+                                                                   'name'      
        => 'year',
+                                                                   'value'     
        => lang('year'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array( //boton  
DISTRICT
+                                                                   'id'        
        => 'btn_district_id',
+                                                                   'name'      
        => 'district_id',
+                                                                   'value'     
        => lang('district_id'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                               array( //boton  
CATEGORY
+                                                                   'id'        
        => 'btn_cat_id',
+                                                                   'name'      
        => 'cat_id',
+                                                                   'value'     
        => lang('Category'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 3
+                                                               ),              
                                                
+                                                               array( //boton  
GROUPING
+                                                                   'id'        
        => 'btn_grouping',
+                                                                   'name'      
        => 'grouping',
+                                                                   'value'     
        => lang('grouping'),
+                                                                   'type'      
        => 'button',
+                                                                   'style'     
=> 'filter',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id'        
        => 'btn_search',
+                                                                   'name'      
        => 'search',
+                                                                   'value'     
=> lang('search'),
+                                                                   'type'      
        => 'button',
+                                                                   'tab_index' 
=> 6
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'      
=> 'query',
+                                                                   'id'        
=> 'txt_query',
+                                                                   'value'     
=> $this->query,
+                                                                   'type'      
        => 'text',
+                                                                   'size'      
=> 28,
+                                                                   
'onkeypress'=> 'return pulsar(event)',
+                                                                       
'tab_index' => 5
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
              ),
+                                                                               
                                         array( //div values  combo_box_2
+                                                                               
                    'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2],'cat_id','name')
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_3
+                                                                               
                    'id' => 'values_combo_box_3',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[3])
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+
+                       $uicols = array (
+                               
+                               array(
+                                       'col_name'=>grouping,           
'visible'=>false,       'label'=>'',                            
'className'=>'',                                'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>b_account,          
'visible'=>true,        'label'=>lang('grouping'),      
'className'=>'centerClasss',    'sortable'=>true,       
'sort_field'=>'b_account',      'formatter'=>myformatLinkPGW),
+                               array(
+                                       'col_name'=>district_id,        
'visible'=>true,        
'label'=>lang('district_id'),'className'=>'centerClasss',       
'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>''),
+                               array(
+                                       'col_name'=>hits_ex,            
'visible'=>false,       'label'=>'',                            
'className'=>'rightClasss',             'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>hits,                       
'visible'=>true,        'label'=>lang('hits'),          
'className'=>'rightClasss',             'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>budget_cost_ex,     
'visible'=>false,       'label'=>'',                            
'className'=>'rightClasss',             'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>budget_cost,        
'visible'=>true,        'label'=>lang('budget'),        
'className'=>'rightClasss',             'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>obligation_ex,      
'visible'=>false,       'label'=>''                                     
,'className'=>'rightClasss',    'sortable'=>false,      'sort_field'=>'',       
                'formatter'=>''),
+                               array(
+                                       'col_name'=>obligation,         
'visible'=>true,        'label'=>lang('sum orders'),'className'=>'rightClasss', 
'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>myFormatLink_Count),
+                               array(
+                                       
'col_name'=>link_obligation,'visible'=>false,   'label'=>'',                    
        'className'=>'',                                'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>actual_cost_ex,     
'visible'=>false,       'label'=>'',                            
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
                'formatter'=>''),
+                               array(
+                                       'col_name'=>actual_cost,        
'visible'=>true,        'label'=>lang('paid'),          
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
                'formatter'=>myFormatLink_Count),
+                               array(
+                                       
'col_name'=>link_actual_cost,'visible'=>false,  'label'=>'',                    
        'className'=>'rightClasss',     'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>diff_ex,            
'visible'=>false,       'label'=>'',                            
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
                'formatter'=>''),
+                               array(
+                                       'col_name'=>diff,                       
'visible'=>true,        'label'=>lang('difference'),'className'=>'rightClasss', 
        'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>'')
+                               );      
+                               
+                       $location_list = array();
+                       
+                       $location_list = $this->bo->read_obligations(); 
+//_debug_array($location_list);
+                       $entry = $content = array();
+                       $j = 0;
+                       //cramirez: add this code because  "mktime" functions 
fire an error
+                       if($this->year == "")
                        {
-                               $start_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,1,1,date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                               $end_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,12,31,date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                               $sum = 0;
-                               foreach($list as $entry)
-                               {
+                               $today = getdate();
+                               $this->year = $today[year];
+                       }
+                                       
+                       if (isset($location_list) && is_array($location_list))
+                       {
+                               $details = $this->details ? false : true;
 
+                               $start_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,1,1,$this->year),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $end_date       = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,12,31,$this->year),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
 
+
+                               $sum_obligation = $sum_hits = $sum_budget_cost 
= $sum_actual_cost = 0;  
+                               foreach($location_list as $entry)
+                       {
+//_debug_array($entry);
                                        $content[] = array
                                        (
-                                               'budget_cost'                   
=> number_format($entry['budget_cost'], 0, ',', ' '),
                                                'grouping'                      
=> $entry['grouping'],
+                                               'b_account'                     
=> $entry['b_account'], 
                                                'district_id'                   
=> $entry['district_id'],
+                                               'hits_ex'                       
=> $entry['hits'],
+                                               'hits'                          
=> number_format($entry['hits'], 0, ',', ' '),
+                                               'budget_cost_ex'        => 
$entry['budget_cost'],
+                                               'budget_cost'           => 
number_format($entry['budget_cost'], 0, ',', ' '),
+                                               'obligation_ex'         => 
$entry['obligation'],
                                                'obligation'                    
=> number_format($entry['obligation'], 0, ',', ' '),
-                                               'link_obligation'               
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.index', 'filter'=>'all', 'paid'=>1, 'district_id'=> 
$entry['district_id'], 'b_group'=> $entry['grouping'])),
+                                               'link_obligation'       => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.index', 'filter'=>'all', 'paid'=>1, 'district_id'=> 
$entry['district_id'], 'b_group'=> $entry['grouping'], 'b_account' 
=>$b_account, 'start_date'=> $start_date, 'end_date'=> $end_date)),
+                                               'actual_cost_ex'        => 
$entry['actual_cost'],
                                                'actual_cost'                   
=> number_format($entry['actual_cost'], 0, ',', ' '),
-                                               'link_actual_cost'              
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.consume', 'district_id'=> $entry['district_id'], 
'b_account_class'=> $entry['grouping'], 'start_date'=> $start_date, 
'end_date'=> $end_date, 'submit_search'=>true)),
-                                               'diff'                          
=> number_format($entry['budget_cost'] - $entry['actual_cost'] - 
$entry['obligation'], 0, ',', ' '),
-                                               'hits'                          
=> number_format($entry['hits'], 0, ',', ' '),
-
+                                               'link_actual_cost'      => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.consume', 'district_id'=> $entry['district_id'], 
'b_account_class'=> $entry['grouping'], 'b_account' =>$b_account,  
'start_date'=> $start_date, 'end_date'=> $end_date, 'submit_search'=>true)),
+                                               'diff_ex'                       
=> $entry['budget_cost'] - $entry['actual_cost'] - $entry['obligation'],
+                                               'diff'                          
=> number_format($entry['budget_cost'] - $entry['actual_cost'] - 
$entry['obligation'], 0, ',', ' ')
                                        );
-                                       $sum_obligation = $sum_obligation + 
$entry['obligation'];
-                                       $sum_hits = $sum_hits + $entry['hits'];
-                                       $sum_budget_cost = $sum_budget_cost + 
$entry['budget_cost'];
-                                       $sum_actual_cost = $sum_actual_cost + 
$entry['actual_cost'];
+                                       
+//                                     $sum_obligation += $entry['obligation'];
+//                                     $sum_hits += $entry['hits'];
+//                                     $sum_budget_cost += 
$entry['budget_cost'];
+//                                     $sum_actual_cost += 
$entry['actual_cost'];                                      
                                }
+                               
+//                             $sum_diff = $sum_budget_cost - $sum_actual_cost 
- $sum_obligation;
                        }
-//_debug_array($content);
-                       $sum_diff = number_format($sum_budget_cost - 
$sum_actual_cost - $sum_obligation, 0, ',', ' ');
-                       $sum_obligation = number_format($sum_obligation, 0, 
',', ' ');
-                       $sum_hits = number_format($sum_hits, 0, ',', ' ');
-                       $sum_budget_cost = number_format($sum_budget_cost, 0, 
',', ' ');
-                       $sum_actual_cost = number_format($sum_actual_cost, 0, 
',', ' ');
 
-                       $table_header[] = array
-                       (
-                               'lang_diff'             => lang('difference'),
-                               'lang_actual_cost'      => lang('paid'),
-                               'lang_budget_cost'      => lang('budget'),
-                               'lang_obligations'      => lang('obligations'),
-                               'lang_grouping'         => lang('grouping'),
-                               'lang_hits'             => lang('hits'),
-                               'lang_district_id'      => lang('district_id'),
+                       $j=0;
+                       if (isset($content) && is_array($content))
+                       {
+                               foreach($content as $budget)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']             = 
$uicols[$i]['col_name'];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']            = 
$budget[$uicols[$i]['col_name']];
+                                       }
+                                       $j++;
+                               }
+                       }
 
-                               'sort_grouping' => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'b_group',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uibudget.obligations',
-                                                                               
                                                'district_id'   
=>$this->district_id,
-                                                                               
                                                'year'          =>$this->year,
-                                                                               
                                                'period'        =>$this->period,
-                                                                               
                                                'grouping'      
=>$this->grouping,
-                                                                               
                                                'allrows'       
=>$this->allrows)
-                                                                               
)),
-                       );
+                       $datatable['rowactions']['action'] = array();
 
-                       if($acl_add)
+                       for ($i=0;$i<count($uicols);$i++)
                        {
-                               $table_add = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
budget query'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uibudget.edit_obligations'))
-                               );
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols[$i]['col_name'];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols[$i]['label'];
+                               $datatable['headers']['header'][$i]['visible']  
        = $uicols[$i]['visible'];
+                               $datatable['headers']['header'][$i]['sortable'] 
        = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols[$i]['sort_field'];
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols[$i]['className'];
+                               
$datatable['headers']['header'][$i]['formatter']        = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
                        }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uibudget.obligations',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'cat_id'        =>$this->cat_id,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query,
-                               'district_id'   =>$this->district_id,
-                               'grouping'      =>$this->grouping
-                       );
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $this->allrows = true;
-                       if(!$this->allrows)
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($location_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= $uicols[1]['col_name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $data = array
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menu'                                          
                => $this->bocommon->get_menu(),
-                               'sum_actual_cost'                               
        => $sum_actual_cost,
-                               'sum_diff'                                      
                => $sum_diff,
-                               'sum_obligation'                                
        => $sum_obligation,
-                               'sum_hits'                                      
                => $sum_hits,
-                               'sum_budget_cost'                               
        => $sum_budget_cost,
-                               'lang_sum'                                      
                => lang('sum'),
-                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
        => false,
-                               'allrows'                                       
                => $this->allrows,
-                               'start_record'                                  
        => $this->start,
-                               'record_limit'                                  
        => $record_limit,
-                               'num_records'                                   
        => count($list),
-                               'all_records'                                   
        => $this->bo->total_records,
-                               'link_url'                                      
                => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
                => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                                 
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                         
                => $this->query,
-                               'lang_search'                                   
        => lang('search'),
-                               'table_header_budget_obligations'       => 
$table_header,
-                               'values_budget_obligations'                     
=> $content,
-                               'table_add'                                     
                => $table_add,
-                               'district_list'                                 
        => $this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'                              
        => lang('no district'),
-                               'lang_district_statustext'                      
=> lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                          
=> 'district_id',
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
 
-                               'grouping_list'                                 
        => $this->bo->get_b_group_list($this->grouping),
-                               'lang_no_grouping'                              
        => lang('no grouping'),
-                               'lang_grouping_statustext'                      
=> lang('Select the grouping the selection belongs to'),
+                               // values for datatable
+                               $json_row = array();
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
+                       {
+                               foreach( $datatable['rows']['row'] as $row )
+                       {
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               $json_row[$column['name']] = 
$column['value'];
+                                       }
+                                       $json['records'][] = $json_row;
+                       }
+                       }
+                               // right in datatable
+                               $json ['rights'] = 
$datatable['rowactions']['action'];
 
-                               'year_list'                                     
        => $this->bo->get_year_filter_list($this->year,$basis=true),
-                               'lang_no_year'                                  
        => lang('no year'),
-                               'lang_year_statustext'                          
=> lang('Select the year the selection belongs to'),
+//                             $json ['sum_hits']                      = 
number_format($sum_hits, 0, ',', ' ');
+//                             $json ['sum_budget_cost']       = 
number_format($sum_budget_cost, 0, ',', ' ');
+//                             $json ['sum_obligation']        = 
number_format($sum_obligation, 0, ',', ' ');
+//                             $json ['sum_actual_cost']       = 
number_format($sum_actual_cost, 0, ',', ' ');
+//                             $json ['sum_diff']                      = 
number_format($sum_diff, 0, ',', ' ');
 
-                               'lang_no_cat'                                   
        => lang('no category'),
-                               'cat_filter'                                    
        => $this->cats->formatted_xslt_list(array('select_name' => 
'cat_id','selected' => $this->cat_id,'globals' => True,'link_data' => 
$link_data)),
-                       );
+//_debug_array($json);
 
-                       $this->save_sessiondata();
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . lang('list obligations');
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_obligations' => $data));
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'budget.obligations', 'property' );
                }
 
-
                function edit()
                {
                        $acl_location   = '.budget';
@@ -698,6 +1275,7 @@
                        {
                                $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int', 'POST');
                                $values['b_account_name']       = 
phpgw::get_var('b_account_name', 'string', 'POST');
+                               $values['ecodimb']                      = 
phpgw::get_var('ecodimb');
 
                                if(!$values['b_account_id'] > 0)
                                {
@@ -707,7 +1285,7 @@
 
                                if(!$values['district_id'] && !$budget_id > 0)
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select a district !'));
+               //                      
$receipt['error'][]=array('msg'=>lang('Please select a district !'));
                                }
 
                                if(!$values['budget_cost'])
@@ -763,8 +1341,16 @@
                                                'b_account_name'        => 
isset($values['b_account_name'])?$values['b_account_name']:'',
                                                'type'                  => 
isset($values['b_account_id']) && $values['b_account_id'] > 0 ?'view':'form'));
 
+                       
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array(
+                                               'ecodimb'                       
=> $values['ecodimb'],
+                                               'ecodimb_descr'         => 
$values['ecodimb_descr']));
+                       
                        $data = array
                        (
+                               'ecodimb_data'                                  
        =>      $ecodimb_data,
+                               'lang_category'                                 
        => lang('category'),
+                               'lang_no_cat'                                   
        => lang('Select category'),
+                               'cat_select'                                    
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'])),
                                'b_account_data'                        => 
$b_account_data,
                                'value_b_account'                       => 
$values['b_account_id'],
                                'lang_revision'                         => 
lang('revision'),
@@ -826,6 +1412,8 @@
 
                        if ((isset($values['save']) && $values['save'])|| 
(isset($values['apply']) && $values['apply']))
                        {
+                               $values['ecodimb']      = 
phpgw::get_var('ecodimb');
+
                                if(!$values['b_group'] && !$budget_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a budget group !'));
@@ -891,8 +1479,17 @@
                        $year[2]['id'] = date(Y) +2;
                        $year[3]['id'] = date(Y) +3;
 
+                       
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array(
+                                               'ecodimb'                       
=> $values['ecodimb'],
+                                               'ecodimb_descr'         => 
$values['ecodimb_descr']));
+                       
+
                        $data = array
                        (
+                               'ecodimb_data'                                  
        =>      $ecodimb_data,
+                               'lang_category'                                 
        => lang('category'),
+                               'lang_no_cat'                                   
        => lang('Select category'),
+                               'cat_select'                                    
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'])),
                                'lang_distribute'                       => 
lang('distribute'),
                                'lang_distribute_year'                  => 
lang('distribute year'),
                                'lang_distribute_year_statustext'       => 
lang('of years'),
@@ -938,19 +1535,22 @@
                                'lang_apply_statustext'                 => 
lang('Apply the values'),
                                'lang_cancel_statustext'                => 
lang('Leave the budget untouched and return to the list'),
                                'lang_save_statustext'                  => 
lang('Save the budget and return to the list'),
-
-
                        );
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . ($budget_id?lang('edit budget'):lang('add budget'));
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_basis' => $data));
 
                }
-
-
                function delete()
                {
                        $budget_id      = phpgw::get_var('budget_id', 'int');
+                       //cramirez add JsonCod for Delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       $this->bo->delete($budget_id);
+                       return "budget_id ".$budget_id." ".lang("has been 
deleted");
+                       }
+                       
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
                        $link_data = array
@@ -988,6 +1588,15 @@
                function delete_basis()
                {
                        $budget_id      = phpgw::get_var('budget_id', 'int');
+                       //JsonCod for Delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       $this->bo->delete_basis($budget_id);
+                               return "budget_id ".$budget_id." ".lang("has 
been deleted");
+                       }
+                       
+                       
+                       
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
                        $link_data = array
@@ -1021,8 +1630,6 @@
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
 
                }
-
-
                function view()
                {
                        $budget_id      = phpgw::get_var('budget_id', 'int', 
'GET');

Modified: people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free 
Software Foundation, Inc. http://www.fsf.org/
        * This file is part of phpGroupWare.
        *
        * phpGroupWare is free software; you can redistribute it and/or modify
@@ -26,6 +26,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -41,6 +42,7 @@
                var $order;
                var $sub;
                var $currentapp;
+               var $location_info;
 
                var $public_functions = array
                (
@@ -50,18 +52,18 @@
                        'delete' => true
                );
 
-               function property_uicategory()
+               function __construct()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
phpgw::get_var('menu_selection');
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                               = 
CreateObject('property.bocategory',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->custom                           = & 
$this->bo->custom;
 
+                       $this->location_info            = 
$this->bo->location_info;
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
$this->location_info['menu_selection'];
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location                     = '.admin';
+                       $this->acl_location                     = 
$this->location_info['acl_location'];
                        $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
                        $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
                        $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
@@ -73,7 +75,6 @@
                        $this->sort                             = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                        $this->allrows                          = 
$this->bo->allrows;
-
                }
 
                function save_sessiondata()
@@ -98,99 +99,312 @@
 
                        $type           = phpgw::get_var('type');
                        $type_id        = phpgw::get_var('type_id', 'int');
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data', 
"general_receipt_{$type}_{$type_id}");
+                       $this->save_sessiondata();
 
-                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
"category.index.{$type}";
+                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
"general.index.{$type}";
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('category','nextmatchs',
-                                                                               
'search_field'));
+                       $datatable = array();
 
-                       $category_list = $this->bo->read($type,$type_id);
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 'property.uicategory.index',
+                                       'type'          => $type,
+                                       'type_id'               => $type_id
+                               ));
 
-                       while (is_array($category_list) && list(,$category) = 
each($category_list))
-                       {
-                               $content[] = array
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uicategory.index',"
+                                                                               
                        ."type:'{$type}',"
+                                                                               
                        ."type_id:'{$type_id}'";
+
+                               $link_data = array
                                (
-                                       'id'                            => 
$category['id'],
-                                       'first'                         => 
$category['descr'],
-                                       'link_edit'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.edit', 'id'=> $category['id'], 'type'=> $type, 'type_id'=> 
$type_id, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                       'link_delete'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.delete', 'id'=> $category['id'], 'type'=> $type, 
'type_id'=> $type_id, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                       'lang_view_categorytext'        => 
lang('view the category'),
-                                       'lang_edit_categorytext'        => 
lang('edit the category'),
-                                       'lang_delete_categorytext'      => 
lang('delete the category'),
-                                       'text_view'                     => 
lang('view'),
-                                       'text_edit'                     => 
lang('edit'),
-                                       'text_delete'                   => 
lang('delete')
+                                       'menuaction'    => 
'property.uicategory.index',
+                                       'type'          => $type,
+                                       'type_id'               => $type_id
                                );
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array
+                               (
+                                       array
+                                       (
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array
+                                                               (
+                                                                       
'menuaction'    => 'property.uicategory.index',
+                                                                       'type'  
                => $type,
+                                                                       
'type_id'               => $type_id
+                                                               )
+                                                       ),
+                                       'fields'        => array
+                                       (
+                                       'field' => array
+                                       (
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_done',
+                                                                       'value' 
=> lang('done'),
+                                                                       
'tab_index' => 9
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_new',
+                                                                       'value' 
=> lang('add'),
+                                                                       
'tab_index' => 8
+                                                               ),
+                                                               array
+                                                               ( //button     
SEARCH
+                                                                       'id' => 
'btn_search',
+                                                                       'name' 
=> 'search',
+                                                                       'value' 
   => lang('search'),
+                                                                       'type' 
=> 'button',
+                                                                       
'tab_index' => 7
+                                                               ),
+                                                               array
+                                                               ( // TEXT INPUT
+                                                                       'name'  
   => 'query',
+                                                                       'id'    
 => 'txt_query',
+                                                                       'value' 
   => $this->query,
+                                                                       'type' 
=> 'text',
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'size'  
  => 28,
+                                                                       
'tab_index' => 6
+                                                               )
+                                                       )
+                                               )
+                                       )
+                               );
+                               $dry_run = true;
                        }
 
-//_debug_array($content);
+                       $values = $this->bo->read();
+                       $uicols = $this->bo->uicols;
 
-                       $table_header[] = array
+/*                     $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('category ID');
+                       $uicols['name'][1]      = 'descr';
+                       $uicols['descr'][1]     = lang('Descr');
+*/
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($values) AND is_array($values))
+                       {
+                               foreach($values as $category_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $category_entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
                        (
+                               'parameter' => array
+                               (
+                                       array
+                       (
+                                               'name'          => 
$this->location_info['id']['name'],
+                                               'source'        =>  
$this->location_info['id']['name']
+                                       ),
+                               )
+                       );
 
-                               'lang_descr'            => lang('Descr'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_id'               => 
$this->nextmatchs->show_sort_order(array
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uicategory.index',
+                                       'my_name'               => 'edit',
+                                       'statustext'    => lang('edit the 
actor'),
+                                       'text'                  => lang('edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uicategory.edit',
+                                                                               
        'type'                          => $type,
+                                                                               
        'type_id'                       => $type_id
+                                                                               
)),
+                                       'parameters'    => $parameters
+                               );
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'               => 'edit',
+                                       'text'                  => lang('open 
edit in new window'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uicategory.edit',
                                                                                
                                                        'type'  => $type,
                                                                                
                                                        'type_id' => $type_id,
-                                                                               
                                                        'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                        )
+                                                                               
        'target'                        => '_blank'
                                                                                
)),
-                               'lang_id'               => lang('category id'),
+                                       'parameters'    => $parameters
                        );
+                       }
 
-                       $table_add[] = array
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array
                        (
-                               'lang_add'              => lang('add'),
-                               'lang_add_categorytext' => lang('add a 
category'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.edit', 'type'=> $type,  'type_id'=> $type_id, 
'menu_selection' => $GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_done'             => lang('done'),
-                               'lang_done_categorytext'=> lang('back to 
admin'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/admin/index.php')
+                                       'my_name'               => 'delete',
+                                       'statustext'    => lang('delete the 
actor'),
+                                       'text'                  => 
lang('delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uicategory.delete',
+                                                                               
        'type'                  => $type,
+                                                                               
        'type_id'               => $type_id
+                                                                               
)),
+                                       'parameters'    => $parameters
                        );
+                       }
+                       unset($parameters);
 
-                       if(!$this->allrows)
+                       if($this->acl_add)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'                       => 
'add',
+                                       'statustext'    => lang('add'),
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uicategory.edit',
+                                                                               
        'type'                  => $type,
+                                                                               
        'type_id'               => $type_id
+                                                                               
))
+                               );
                        }
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']                 = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($values);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                        =  
$this->location_info['name'];
+                       $function_msg           = lang('list %1', $appname);
+
+                       if ( ($this->start == 0) && (!$this->order))
+                       {
+                               $datatable['sorting']['order']                  
=  $this->location_info['id']['name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= $this->order; // name of column of Database
+                               $datatable['sorting']['sort']                   
= $this->sort; // ASC / DESC
                        }
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($category_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type'=> $type, 'type_id'=> 
$type_id,'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_categorytext'                 
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_categorytext'                
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
=> $content,
-                               'table_add'                                     
=> $table_add
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $appname        = lang($type). ' ' . $type_id;
-;
-                       $function_msg   = lang('list %1 category',$type);
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-                       $this->save_sessiondata();
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'category.index', 'property' );
                }
 
                function edit()
@@ -202,21 +416,57 @@
 
                        $type   = phpgw::get_var('type');
                        $type_id        = phpgw::get_var('type_id', 'int');
-                       $id     = phpgw::get_var('id', 'int');
+                       $id                     = phpgw::get_var('id');
                        $values                 = phpgw::get_var('values');
 
-                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
'category.edit.' . $type;
+                       $values_attribute  = phpgw::get_var('values_attribute');
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('category'));
+                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
'general.edit.' . $type;
 
-                       if ($values['save'])
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('category','attributes_form'));
+                       $receipt = array();
+
+                       if (is_array($values))
+                       {
+                               $insert_record_values = 
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",'property');
+                               
+                               if(is_array($insert_record_values))
+                               {
+                                       foreach($insert_record_values as $field)
+                                       {
+                                               $values['extra'][$field] =      
phpgw::get_var($field);
+                                       }
+                               }
+
+                               if ((isset($values['save']) && $values['save']) 
|| (isset($values['apply']) && $values['apply']))
                        {
-                               if(!$id && !ctype_digit($values['id']))
+                                       
if($GLOBALS['phpgw']->session->is_repost())
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+                                       }
+
+                                       if(!$id && 
!$values[$this->location_info['id']['name']] && 
$this->location_info['id']['type'] !='auto')
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please enter an id!'));                  
                                                
+                                       }
+
+                                       if($values['id'] && 
$this->location_info['id']['type'] == 'int' && !ctype_digit($values['id']))
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
                                        unset($values['id']);
                                }
 
+                                       if(isset($values_attribute) && 
is_array($values_attribute))
+                                       {
+                                               foreach ($values_attribute as 
$attribute )
+                                               {
+                                                       
if($attribute['nullable'] != 1 && !$attribute['value'])
+                                                       {
+                                                               
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                                       }
+                                               }
+                                       }
+
                                if($id)
                                {
                                        $values['id']=$id;
@@ -229,56 +479,129 @@
 
                                if(!$receipt['error'])
                                {
-                                       $receipt = 
$this->bo->save($values,$action,$type,$type_id);
+                                               $receipt = 
$this->bo->save($values,$action,$values_attribute);
+
+                                               if (isset($values['save']) && 
$values['save'])
+                                               {
+                                                       
$GLOBALS['phpgw']->session->appsession('session_data', 
"general_receipt_{$type}_{$type_id}", $receipt);
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type'=> $type, 'type_id' => $type_id));
+                                               }
+                                               $id = $receipt['id'];
+                                       }
+                                       else
+                                       {
+                                               unset($values['id']);
+                                               $id = '';
+                                       }
+                                       
+                               }
+                               else
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type'=> $type, 'type_id' => $type_id));
                                }
                        }
 
                        if ($id)
                        {
-                               $category = 
$this->bo->read_single($id,$type,$type_id);
-                               $function_msg = lang('edit category');
+                               $values = $this->bo->read_single(array('id' => 
$id));
+                               $function_msg = 
$this->location_info['edit_msg'];
                                $action='edit';
                        }
                        else
                        {
-                               $function_msg = lang('add category');
+                               $values = $this->bo->read_single();
+                               $function_msg = $this->location_info['add_msg'];
                                $action='add';
                        }
 
+                       /* Preserve attribute values from post */
+                       if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
+                       {
+                               $values = 
$this->custom->preserve_attribute_values($values,$values_attribute);
+                       }
 
+
                        $link_data = array
                        (
                                'menuaction'    => 'property.uicategory.edit',
                                'id'            => $id,
                                'type'          => $type,
-                               'type_id'       => $type_id,
-                               'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
+                               'type_id'               => $type_id
                        );
 //_debug_array($link_data);
 
+                       $tabs = array();
+
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
+                       {
+                               foreach ($values['attributes'] as & $attribute)
+                               {
+                                       if($attribute['history'] == true)
+                                       {
+                                               $link_history_data = array
+                                               (
+                                                       'menuaction'    => 
'property.uiactor.attrib_history',
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'actor_id'      => 
$actor_id,
+                                                       'role'          => 
$this->role,
+                                                       'edit'          => true
+                                               );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
+                               }
+
+                               
phpgwapi_yui::tabview_setup('general_edit_tabview');
+                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
+
+                               $attributes_groups = 
$this->custom->get_attribute_groups('property', $this->acl_location, 
$values['attributes']);
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $tabs[str_replace(' ', '_', 
$group['name'])] = array('label' => $group['name'], 'link' => '#' . 
str_replace(' ', '_', $group['name']));
+                                               $group['link'] = str_replace(' 
', '_', $group['name']);
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($values['attributes']);
+                       }
+
+                       foreach ($this->location_info['fields'] as & $field)
+                       {
+                               $field['value'] =       
isset($values[$field['name']]) ? $values[$field['name']] : '';
+                       }
+
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
                        (
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type'=> $type, 'type_id'=> 
$type_id,'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_id'                                       
=> lang('category ID'),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.index', 'type'=> $type, 'type_id'=> $type_id)),
                                'lang_descr'                                    
=> lang('Descr'),
                                'lang_save'                                     
=> lang('save'),
-                               'lang_done'                                     
=> lang('done'),
-                               'value_id'                                      
=> $id,
-                               'lang_id_categorytext'                          
=> lang('Enter the category ID'),
-                               'lang_descr_categorytext'                       
=> lang('Enter a description the category'),
-                               'lang_done_categorytext'                        
=> lang('Back to the list'),
-                               'lang_save_categorytext'                        
=> lang('Save the category'),
-                               'type_id'                                       
=> $category['type_id'],
-                               'value_descr'                                   
=> $category['descr']
+                               'lang_cancel'                                   
=> lang('cancel'),
+                               'lang_apply'                                    
=> lang('apply'),
+                               'value_id'                                      
        => isset($values['id']) ? $values['id'] : '',
+                               'value_descr'                                   
=> $values['descr'],
+
+                               'attributes_group'                              
=> $attributes,
+                               'lookup_functions'                              
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
+                               'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 10,
+                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, 'general'),
+                               'id_name'                                       
        => $this->location_info['id']['name'],
+                               'id_type'                                       
        => $this->location_info['id']['type'],
+                               'fields'                                        
        => $this->location_info['fields']
                        );
 
-                       $appname        = lang($type). ' ' . $type_id;
+                       $appname        =  $this->location_info['name'];
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                }
 
@@ -286,46 +609,16 @@
                {
                        if(!$this->acl_delete)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 8, 'acl_location'=> $this->acl_location));
+                               return lang('no access');
                        }
 
-                       $type           = phpgw::get_var('type');
-                       $type_id        = phpgw::get_var('type_id', 'int');
-                       $id             = phpgw::get_var('id', 'int');
-                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+                       $id     = 
phpgw::get_var($this->location_info['id']['name']);
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uicategory.index',
-                               'type'          => $type,
-                               'type_id'       => $type_id,
-                               'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                       );
-
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
-                               $this->bo->delete($id,$type,$type_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               $this->bo->delete($id);
+                               return lang('id %1 has been deleted', $id);
                        }
-
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
-                       $data = array
-                       (
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicategory.delete', 'id'=> $id, 'type'=> $type, 'type_id'=> 
$type_id,'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
-                               'lang_yes'                      => lang('yes'),
-                               'lang_yes_categorytext'         => lang('Delete 
the entry'),
-                               'lang_no_categorytext'          => lang('Back 
to the list'),
-                               'lang_no'                       => lang('no')
-                       );
-
-                       $appname        = lang($type). ' ' . $type_id;
-                       $function_msg   = lang('delete '.$type.' category');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
                }
        }
 

Added: people/sigurdne/modules/property/trunk/inc/class.uicommon.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uicommon.inc.php           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.uicommon.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,943 @@
+<?php
+       phpgw::import_class('phpgwapi.yui');
+       
+       /**
+        * Cherry pick selected values into a new array
+        * 
+        * @param array $array    input array
+        * @param array $keys     array of keys to pick
+        *
+        * @return array containg values from $array for the keys in $keys.
+        */
+       function extract_values($array, $keys, $options = array())
+       {
+               static $default_options = array(
+                       'prefix' => '',
+                       'suffix' => '', 
+                       'preserve_prefix' => false,
+                       'preserve_suffix' => false
+               );
+               
+               $options = array_merge($default_options, $options);
+               
+               $result = array();
+               foreach($keys as $write_key)
+               {
+                       $array_key = 
$options['prefix'].$write_key.$options['suffix'];
+                       if(isset($array[$array_key]))
+                       {
+                               $result[($options['preserve_prefix'] ? 
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ? 
$options['suffix'] : '')] = $array[$array_key];
+                       }
+               }
+               return $result;
+       }
+       
+       function array_set_default(&$array, $key, $value)
+       {
+               if(!isset($array[$key])) $array[$key] = $value;
+       }
+
+       /**
+        * Reformat an ISO timestamp into norwegian format
+        * 
+        * @param string $date    date
+        *
+        * @return string containg timestamp in norwegian format
+        */
+       function pretty_timestamp($date)
+       {
+               if(is_array($date) && is_object($date[0]) && $date[0] 
instanceof DOMNode)
+               {
+                       $date = $date[0]->nodeValue;
+               }
+               preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})( 
([0-9]{2}):([0-9]{2}))?/', $date, $match);
+               $text = "{$match[3]}.{$match[2]}.{$match[1]}";
+               if($match[4])
+                       $text .= " {$match[5]}:{$match[6]}";
+               return $text;
+       }
+
+       /**
+        * Generates a javascript translator object/hash for the specified 
fields.
+        */
+       function js_lang()
+       {
+               $keys = func_get_args();
+               $strings = array();
+               foreach($keys as $key) { $strings[$key] = is_string($key) ? 
lang($key) : call_user_func_array('lang', $key); }
+               return json_encode($strings);
+       }
+       
+       /**
+        * Creates an array of translated strings.
+        */
+       function lang_array()
+       {
+               $keys = func_get_args();
+               foreach($keys as &$key) $key = lang($key);
+               return $keys;
+       }
+       
+       abstract class property_uicommon
+       {
+               const UI_SESSION_FLASH = 'flash_msgs';
+               
+               protected       
+                       $filesArray;
+                       
+               protected static 
+                       $old_exception_handler;
+                       
+               private 
+                       $ui_session_key,
+                       $flash_msgs;
+               
+               public function __construct()
+               {
+                       $this->ui_session_key = 
$this->current_app().'_uicommon';
+                       $this->restore_flash_msgs();
+                       
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       self::set_active_menu('property');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/calendar/assets/skins/sam/calendar.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/autocomplete/assets/skins/sam/autocomplete.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
self::add_stylesheet('phpgwapi/js/yahoo/treeview/assets/skins/sam/treeview.css');
+                       
self::add_stylesheet('booking/templates/base/css/base.css');
+                       self::add_javascript('booking', 'booking', 'common.js');
+                       $this->tmpl_search_path = array();
+                       array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT . 
'/phpgwapi/templates/base');
+                       array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT . 
'/phpgwapi/templates/' . $GLOBALS['phpgw_info']['server']['template_set']);
+                       array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT . 
'/property/templates/base');
+                       array_push($this->tmpl_search_path, PHPGW_SERVER_ROOT . 
'/' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '/templates/base');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('history');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('calendar');
+                       phpgwapi_yui::load_widget('autocomplete');
+                       phpgwapi_yui::load_widget('animation');
+                       $this->url_prefix = str_replace('_', '.', 
get_class($this));
+                       
+               }
+               
+               private function get_ui_session_key()
+               {
+                       return $this->ui_session_key;
+               }
+               
+               private function restore_flash_msgs()
+               {
+                       if (($flash_msgs = 
$this->session_get(self::UI_SESSION_FLASH)))
+                       {
+                               if (is_array($flash_msgs))
+                               {
+                                       $this->flash_msgs = $flash_msgs;
+                                       
$this->session_set(self::UI_SESSION_FLASH, array());
+                                       return true;
+                               }
+                       }
+                       
+                       $this->flash_msgs = array();
+                       return false;
+               }
+               
+               private function store_flash_msgs()
+               {
+                       return $this->session_set(self::UI_SESSION_FLASH, 
$this->flash_msgs);
+               }
+               
+               private function reset_flash_msgs()
+               {
+                       $this->flash_msgs = array();
+                       $this->store_flash_msgs();
+               }
+               
+               private function session_set($key, $data)
+               {
+                       return 
phpgwapi_cache::session_set($this->get_ui_session_key(), $key, $data);
+               }
+               
+               private function session_get($key)
+               {
+                       return 
phpgwapi_cache::session_get($this->get_ui_session_key(), $key);
+               }
+               
+               /**
+                * Provides a private session cache setter per ui class.
+                */
+               protected function ui_session_set($key, $data)
+               {
+                       return $this->session_set(get_class($this).'_'.$key, 
$data);
+               }
+               
+               /**
+                * Provides a private session cache getter per ui class .
+                */
+               protected function ui_session_get($key)
+               {
+                       return $this->session_get(get_class($this).'_'.$key);
+               }
+               
+               public function add_js_event($event, $js)
+               {
+                       $GLOBALS['phpgw']->js->add_event($event, $js);
+               }
+               
+               public function add_js_load_event($js)
+               {
+                       $this->add_js_event('load', $js);
+               }
+               
+               public static function encoding()
+               {
+                       return 'UTF-8';
+               }
+               
+               public static function process_booking_unauthorized_exceptions()
+               {
+                       if (!self::$old_exception_handler)
+                       {
+                               self::$old_exception_handler = 
set_exception_handler(array(__CLASS__, 
'handle_booking_unauthorized_exception'));
+                               if (!self::$old_exception_handler)
+                               {
+                                       //The exception handler of phpgw has 
probably not been activated, 
+                                       //so taking that as a hint to not 
enable any of our own either.
+                                       restore_exception_handler();
+                               }
+                       }
+               }
+               
+               public static function 
handle_booking_unauthorized_exception(Exception $e)
+               {
+                       if ($e instanceof booking_unauthorized_exception)
+                       {
+                               $message = htmlentities('HTTP/1.0 401 
Unauthorized - '.$e->getMessage(), null, self::encoding());
+                               header($message);
+                               echo 
"<html><head><title>$message</title></head><body><strong>$message</strong></body></html>";
+                       }
+                       else
+                       {
+                               if (self::$old_exception_handler)
+                               {
+                                       
call_user_func(self::$old_exception_handler, $e);
+                               }
+                       }
+               }
+               
+               protected function current_app()
+               {
+                       return $GLOBALS['phpgw_info']['flags']['currentapp'];
+               }
+               
+               public function in_frontend()
+               {
+                       return $this->current_app() == 'bookingfrontend';
+               }
+
+               public static function link($data)
+               {
+                       if($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'bookingfrontend')
+                               return 
$GLOBALS['phpgw']->link('/bookingfrontend/', $data);
+                       else
+                               return $GLOBALS['phpgw']->link('/index.php', 
$data);
+               }
+
+               public function redirect($link_data)
+               {
+                       $this->store_flash_msgs();
+                       
+                       if($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'bookingfrontend')
+                               
$GLOBALS['phpgw']->redirect_link('/bookingfrontend/', $link_data);
+                       else
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+               }
+
+               public function flash($msg, $type='success')
+               {
+                       $this->flash_msgs[$msg] = $type == 'success';
+               }
+
+               public function create_error_stack($errors = array())
+               {
+                       return CreateObject('booking.errorstack', $errors);
+               }
+
+               public function flash_form_errors($errors)
+               {
+                       $error_stack = $this->create_error_stack($errors);
+                       $this->flash_msgs = $error_stack->to_flash_error_msgs();
+               }
+
+               public function add_stylesheet($path)
+               {
+                       $GLOBALS['phpgw']->css->add_external_file($path);
+               }
+
+               public function add_javascript($app, $pkg, $name)
+               {
+                       return $GLOBALS['phpgw']->js->validate_file($pkg, 
str_replace('.js', '', $name), $app);
+               }
+
+        public function set_active_menu($item)
+               {
+            $GLOBALS['phpgw_info']['flags']['menu_selection'] = $item;
+               }
+
+               /**
+               * A more flexible version of xslttemplate.add_file
+               */
+               public function add_template_file($tmpl)
+               {
+                       if(is_array($tmpl))
+                       {
+                               foreach($tmpl as $t)
+                               {
+                                       $this->add_template_file($t);
+                               }
+                               return;
+                       }
+                       foreach(array_reverse($this->tmpl_search_path) as $path)
+                       {
+                               $filename = $path . '/' . $tmpl . '.xsl';
+                               if (file_exists($filename))
+                               {
+                                       
$GLOBALS['phpgw']->xslttpl->xslfiles[$tmpl] = $filename;
+                                       return;
+                               }
+                       }
+                       echo "Template $tmpl not found in search path: ";
+                       print_r($this->tmpl_search_path);
+                       die;
+               }
+               
+               public function add_yui_translation(&$data)
+               {
+                       $this->add_template_file('yui_property_i18n');
+                       $previous = lang('prev');
+                       $next = lang('next');
+                                                       
+                       $data['yui_property_i18n'] = array(
+                               'Calendar' => array(
+                                       'WEEKDAYS_SHORT' => 
json_encode(lang_array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa')),
+                                       'WEEKDAYS_FULL' => 
json_encode(lang_array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 
'Friday', 'Saturday')),
+                                       'MONTHS_LONG' => 
json_encode(lang_array('January', 'February', 'March', 'April', 'May', 'June', 
'July', 'August', 'September', 'October', 'November', 'December')),
+                               ),
+                               'DataTable' => array(
+                                       'MSG_EMPTY' => json_encode(lang('No 
records found.')),
+                                       'MSG_LOADING' => 
json_encode(lang("Loading...")),
+                                       'MSG_SORTASC' => 
json_encode(lang('Click to sort ascending')),
+                                       'MSG_SORTDESC' => 
json_encode(lang('Click to sort descending')),
+                               ),
+                               'setupDatePickerHelper' => array(
+                                       'LBL_CHOOSE_DATE' => 
json_encode(lang('Choose a date')),
+                               ),
+                               'setupPaginator' => array(
+                               'pageReportTemplate' => 
json_encode(lang("Showing items {startRecord} - {endRecord} of 
{totalRecords}")),
+                                       'previousPageLinkLabel' => 
json_encode("&lt; {$previous}"),
+                                       'nextPageLinkLabel' => 
json_encode("{$next} &gt;"),
+                               ),
+                               'common' => array(
+                                       'LBL_NAME' => json_encode(lang('Name')),
+                                       'LBL_TIME' => json_encode(lang('Time')),
+                                       'LBL_WEEK' => json_encode(lang('Week')),
+                                       'LBL_RESOURCE' => 
json_encode(lang('Resource')),
+                               ),
+                       );
+               }
+
+        public function render_template($files, $data)
+               {
+                       if($this->flash_msgs)
+                       {
+                               $data['msgbox_data'] = 
$GLOBALS['phpgw']->common->msgbox($this->flash_msgs);
+                       }
+                       else
+                       {
+                               $this->add_template_file('msgbox');
+                       }
+                       
+                       $this->reset_flash_msgs();
+                       
+                       $this->add_yui_translation($data);
+                       
+                       $output = phpgw::get_var('output', 'string', 'REQUEST', 
'html');
+                       $GLOBALS['phpgw']->xslttpl->set_output($output);
+                       //$GLOBALS['phpgw']->xslttpl->add_file(array($files));
+                       $this->add_template_file($files);
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
+        }
+
+               public function send_file($file_path, $options = array())
+               {
+                       if (!is_readable($file_path))
+                       {
+                               throw new InvalidArgumentException('File is not 
readable');
+                       }
+                       
+                       $base_name = basename($file_path);
+                       $file_type = 
self::get_file_type_from_extension($base_name);
+                       
+                       $options = array_merge(
+                               array('filename' => $base_name),
+                               $options
+                       );
+                       
+                       $options['latin1_filename'] = 
utf8_decode($options['filename']);
+                       $options['utf8_filename'] = 
rawurlencode($options['filename']);
+                       
+                       #Below only seems to work for firefox. RE: 
http://www.ietf.org/rfc/rfc2047.txt
+                       #header("Content-Disposition: attachment; 
filename*=utf-8'en-us'{$options['filename']}");
+                       
+                       //The behaviour of sending both the filename both in 
traditional format and in utf-8 RFC2231 encoded is undefined. 
+                       //However, in reality (where most of us live), UAs pick 
one of the two values that it understands. 
+                       header("Content-Disposition: attachment; 
filename={$options['latin1_filename']}");
+                       #header("Content-Description: {$options['filename']}");
+                       header("Content-Type: $file_type");
+                       # IE6 needs this one
+               header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0");
+                       readfile($file_path, false);
+                       exit;
+               }
+
+               // Add link key to a result array
+               public function _add_links(&$value, $key, $menuaction)
+               {
+                       $unset = 0;
+                       // FIXME: Fugly workaround
+                       // I cannot figure out why this variable isn't set, but 
it is needed 
+                       // by the ->link() method, otherwise we wind up in the 
phpgroupware 
+                       // errorhandler which does lot of weird things and 
breaks the output
+                       if 
(!isset($GLOBALS['phpgw_info']['server']['webserver_url']))
+                       {
+                               
$GLOBALS['phpgw_info']['server']['webserver_url'] = "/";
+                               $unset = 1;
+                       }
+
+                       $value['link'] = self::link(array('menuaction' => 
$menuaction, 'id' => $value['id']));
+
+                       // FIXME: Fugly workaround
+                       // I kid you not my friend. There is something very 
wonky going on 
+                       // in phpgroupware which I cannot figure out.
+                       // If this variable isn't unset() (if it wasn't set 
before that is) 
+                       // then it will contain extra slashes and break URLs
+                       if ($unset)
+                       {
+                               
unset($GLOBALS['phpgw_info']['server']['webserver_url']);
+                       }
+               }
+
+               // Build a YUI result style array
+               public function yui_results($results)
+               {
+                       if (!$results)
+                       {
+                               $results['total_records'] = 0;
+                               $result['results'] = array();
+                       }
+                       
+                       return array(   
+                               'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$results['total_records'], 
+                                       'startIndex' => $results['start'], 
+                                       'sortKey' => $results['sort'], 
+                                       'sortDir' => $results['dir'], 
+                                       'Result' => $results['results']
+                               )   
+                       );  
+               }
+               
+        public function check_active($url)
+               {
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+                               $activate = extract_values($_POST, 
array("status", "activate_id"));
+                               
$this->bo->set_active(intval($activate['activate_id']), 
intval($activate['status']));
+                               $this->redirect(array('menuaction' => $url, 
'id' => $activate['activate_id']));
+                       }
+               }
+               
+               
+               /**
+                * Returns a human-readable string from a lower case and 
underscored word by replacing underscores
+                * with a space, and by upper-casing the initial characters.
+                *
+                * @param  string $lower_case_and_underscored_word String to 
make more readable.
+                *
+                * @return string Human-readable string.
+                */
+               public static function 
humanize($lower_case_and_underscored_word)
+               {
+                       if (substr($lower_case_and_underscored_word, -3) === 
'_id')
+                       {
+                               $lower_case_and_underscored_word = 
substr($lower_case_and_underscored_word, 0, -3);
+                       }
+
+                       return ucfirst(str_replace('_', ' ', 
$lower_case_and_underscored_word));
+               }
+               
+         /**
+          * Retrieves an array of files from $_FILES
+          *
+          * @param  string $key        A key
+          * @return array              An associative array of files
+          */
+               public function get_files($key = null)
+               {
+                       if (!$this->filesArray)
+                       {
+                               $this->filesArray = 
self::convert_file_information($_FILES);
+                       }
+
+                       return is_null($key) ? $this->filesArray : 
(isset($this->filesArray[$key]) ? $this->filesArray[$key] : array());
+               }
+
+               public function toggle_show_inactive()
+               {
+                       if(isset($_SESSION['showall']) && 
!empty($_SESSION['showall']))
+                       {
+                               $this->bo->unset_show_all_objects();
+                       }else{
+                               $this->bo->show_all_objects();
+                       }
+                       $this->redirect(array('menuaction' => 
$this->url_prefix.'.index'));
+               }
+               
+               public function use_yui_editor()
+               {
+                       
self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css');
+                       self::add_javascript('yahoo', 'yahoo/editor', 
'simpleeditor-min.js');
+               }
+
+               static protected function fix_php_files_array($data)
+               {
+                       $fileKeys = array('error', 'name', 'size', 'tmp_name', 
'type');
+                       $keys = array_keys($data);
+                       sort($keys);
+
+                       if ($fileKeys != $keys || !isset($data['name']) || 
!is_array($data['name']))
+                       {
+                               return $data;
+                       }
+
+                       $files = $data;
+                       foreach ($fileKeys as $k)
+                       {
+                               unset($files[$k]);
+                       }
+                       foreach (array_keys($data['name']) as $key)
+                       {
+                               $files[$key] = self::fix_php_files_array(array(
+                                       'error'    => $data['error'][$key],
+                                       'name'     => $data['name'][$key],
+                                       'type'     => $data['type'][$key],
+                                       'tmp_name' => $data['tmp_name'][$key],
+                                       'size'     => $data['size'][$key],
+                               ));
+                       }
+
+                       return $files;
+               }
+               
+               /**
+               * It's safe to pass an already converted array, in which case 
this method just returns the original array unmodified.
+               *
+               * @param  array $taintedFiles An array representing uploaded 
file information
+               *
+               * @return array An array of re-ordered uploaded file information
+               */
+               static public function convert_file_information(array 
$taintedFiles)
+               {
+                       $files = array();
+                       foreach ($taintedFiles as $key => $data)
+                       {
+                               $files[$key] = self::fix_php_files_array($data);
+                       }
+
+                       return $files;
+               }
+               
+               protected static function get_file_type_from_extension($file, 
$defaultType = 'application/octet-stream')
+               {
+                       if (false === ($extension = (false === $pos = 
strrpos($file, '.')) ? false : substr($file, $pos+1)))
+                       {
+                               return $defaultType;
+                       }
+                       
+                       if (strlen($extension) == 0)
+                       {
+                               return $defaultType;
+                       }
+                       
+                       switch ($extension)
+                       {
+                               case 'ez':                      return 
'application/andrew-inset';
+                               case 'base64':          return 
'application/x-word';
+                               case 'dp':                      return 
'application/commonground';
+                               case 'pqi':             return 
'application/cprplayer';
+                               case 'tsp':             return 
'application/dsptype';
+                               case 'xls':             return 
'application/x-msexcel';
+                               case 'pfr':             return 
'application/font-tdpfr';
+                               case 'spl':             return 
'application/x-futuresplash';
+                               case 'stk':             return 
'application/hyperstudio';
+                               case 'js':                      return 
'application/x-javascript';
+                               case 'hqx':             return 
'application/mac-binhex40';
+                               case 'cpt':             return 
'application/x-mac-compactpro';
+                               case 'mbd':             return 
'application/mbed';
+                               case 'mfp':             return 
'application/mirage';
+                               case 'doc':             return 
'application/x-msword';
+                               case 'orq':             return 
'application/ocsp-request';
+                               case 'ors':             return 
'application/ocsp-response';
+                               case 'bin':             return 
'application/octet-stream';
+                               case 'oda':             return 
'application/oda';
+                               case 'ogg':             return 
'application/ogg';
+                               case 'pdf':             return 
'application/x-pdf';
+                               case '7bit':            return 
'application/pgp-keys';
+                               case 'sig':             return 
'application/pgp-signature';
+                               case 'p10':             return 
'application/pkcs10';
+                               case 'p7m':             return 
'application/pkcs7-mime';
+                               case 'p7s':             return 
'application/pkcs7-signature';
+                               case 'cer':             return 
'application/pkix-cert';
+                               case 'crl':             return 
'application/pkix-crl';
+                               case 'pkipath':         return 
'application/pkix-pkipath';
+                               case 'pki':             return 
'application/pkixcmp';
+                               case 'ps':                      return 
'application/postscript';
+                               case 'shw':             return 
'application/presentations';
+                               case 'cw':                      return 
'application/prs.cww';
+                               case 'rnd':             return 
'application/prs.nprend';
+                               case 'qrt':             return 
'application/quest';
+                               case 'rtf':             return 'text/rtf';
+                               case 'soc':             return 
'application/sgml-open-catalog';
+                               case 'siv':             return 
'application/sieve';
+                               case 'smi':             return 
'application/smil';
+                               case 'tbk':             return 
'application/toolbook';
+                               case 'plb':             return 
'application/vnd.3gpp.pic-bw-large';
+                               case 'psb':             return 
'application/vnd.3gpp.pic-bw-small';
+                               case 'pvb':             return 
'application/vnd.3gpp.pic-bw-var';
+                               case 'sms':             return 
'application/vnd.3gpp.sms';
+                               case 'atc':             return 
'application/vnd.acucorp';
+                               case 'xfdf':            return 
'application/vnd.adobe.xfdf';
+                               case 'ami':             return 
'application/vnd.amiga.amu';
+                               case 'mpm':             return 
'application/vnd.blueice.multipass';
+                               case 'cdy':             return 
'application/vnd.cinderella';
+                               case 'cmc':             return 
'application/vnd.cosmocaller';
+                               case 'wbs':             return 
'application/vnd.criticaltools.wbs+xml';
+                               case 'curl':            return 
'application/vnd.curl';
+                               case 'rdz':             return 
'application/vnd.data-vision.rdz';
+                               case 'dfac':            return 
'application/vnd.dreamfactory';
+                               case 'fsc':             return 
'application/vnd.fsc.weblauch';
+                               case 'txd':             return 
'application/vnd.genomatix.tuxedo';
+                               case 'hbci':            return 
'application/vnd.hbci';
+                               case 'les':             return 
'application/vnd.hhe.lesson-player';
+                               case 'plt':             return 
'application/vnd.hp-hpgl';
+                               case 'emm':             return 
'application/vnd.ibm.electronic-media';
+                               case 'irm':             return 
'application/vnd.ibm.rights-management';
+                               case 'sc':                      return 
'application/vnd.ibm.secure-container';
+                               case 'rcprofile':       return 
'application/vnd.ipunplugged.rcprofile';
+                               case 'irp':             return 
'application/vnd.irepository.package+xml';
+                               case 'jisp':            return 
'application/vnd.jisp';
+                               case 'karbon':          return 
'application/vnd.kde.karbon';
+                               case 'chrt':            return 
'application/vnd.kde.kchart';
+                               case 'kfo':             return 
'application/vnd.kde.kformula';
+                               case 'flw':             return 
'application/vnd.kde.kivio';
+                               case 'kon':             return 
'application/vnd.kde.kontour';
+                               case 'kpr':             return 
'application/vnd.kde.kpresenter';
+                               case 'ksp':             return 
'application/vnd.kde.kspread';
+                               case 'kwd':             return 
'application/vnd.kde.kword';
+                               case 'htke':            return 
'application/vnd.kenameapp';
+                               case 'kia':             return 
'application/vnd.kidspiration';
+                               case 'kne':             return 
'application/vnd.kinar';
+                               case 'lbd':             return 
'application/vnd.llamagraphics.life-balance.desktop';
+                               case 'lbe':             return 
'application/vnd.llamagraphics.life-balance.exchange+xml';
+                               case 'wks':             return 
'application/vnd.lotus-1-2-3';
+                               case 'mcd':             return 
'application/x-mathcad';
+                               case 'mfm':             return 
'application/vnd.mfmp';
+                               case 'flo':             return 
'application/vnd.micrografx.flo';
+                               case 'igx':             return 
'application/vnd.micrografx.igx';
+                               case 'mif':             return 
'application/x-mif';
+                               case 'mpn':             return 
'application/vnd.mophun.application';
+                               case 'mpc':             return 
'application/vnd.mophun.certificate';
+                               case 'xul':             return 
'application/vnd.mozilla.xul+xml';
+                               case 'cil':             return 
'application/vnd.ms-artgalry';
+                               case 'asf':             return 'video/x-ms-asf';
+                               case 'lrm':             return 
'application/vnd.ms-lrm';
+                               case 'ppt':             return 
'application/vnd.ms-powerpoint';
+                               case 'mpp':             return 
'application/vnd.ms-project';
+                               case 'wpl':             return 
'application/vnd.ms-wpl';
+                               case 'mseq':            return 
'application/vnd.mseq';
+                               case 'ent':             return 
'application/vnd.nervana';
+                               case 'rpst':            return 
'application/vnd.nokia.radio-preset';
+                               case 'rpss':            return 
'application/vnd.nokia.radio-presets';
+                               case 'odt':             return 
'application/vnd.oasis.opendocument.text';
+                               case 'ott':             return 
'application/vnd.oasis.opendocument.text-template';
+                               case 'oth':             return 
'application/vnd.oasis.opendocument.text-web';
+                               case 'odm':             return 
'application/vnd.oasis.opendocument.text-master';
+                               case 'odg':             return 
'application/vnd.oasis.opendocument.graphics';
+                               case 'otg':             return 
'application/vnd.oasis.opendocument.graphics-template';
+                               case 'odp':             return 
'application/vnd.oasis.opendocument.presentation';
+                               case 'otp':             return 
'application/vnd.oasis.opendocument.presentation-template';
+                               case 'ods':             return 
'application/vnd.oasis.opendocument.spreadsheet';
+                               case 'ots':             return 
'application/vnd.oasis.opendocument.spreadsheet-template';
+                               case 'odc':             return 
'application/vnd.oasis.opendocument.chart';
+                               case 'odf':             return 
'application/vnd.oasis.opendocument.formula';
+                               case 'odb':             return 
'application/vnd.oasis.opendocument.database';
+                               case 'odi':             return 
'application/vnd.oasis.opendocument.image';
+                               case 'prc':             return 
'application/vnd.palm';
+                               case 'efif':            return 
'application/vnd.picsel';
+                               case 'pti':             return 
'application/vnd.pvi.ptid1';
+                               case 'qxd':             return 
'application/vnd.quark.quarkxpress';
+                               case 'sdoc':            return 
'application/vnd.sealed.doc';
+                               case 'seml':            return 
'application/vnd.sealed.eml';
+                               case 'smht':            return 
'application/vnd.sealed.mht';
+                               case 'sppt':            return 
'application/vnd.sealed.ppt';
+                               case 'sxls':            return 
'application/vnd.sealed.xls';
+                               case 'stml':            return 
'application/vnd.sealedmedia.softseal.html';
+                               case 'spdf':            return 
'application/vnd.sealedmedia.softseal.pdf';
+                               case 'see':             return 
'application/vnd.seemail';
+                               case 'mmf':             return 
'application/vnd.smaf';
+                               case 'sxc':             return 
'application/vnd.sun.xml.calc';
+                               case 'stc':             return 
'application/vnd.sun.xml.calc.template';
+                               case 'sxd':             return 
'application/vnd.sun.xml.draw';
+                               case 'std':             return 
'application/vnd.sun.xml.draw.template';
+                               case 'sxi':             return 
'application/vnd.sun.xml.impress';
+                               case 'sti':             return 
'application/vnd.sun.xml.impress.template';
+                               case 'sxm':             return 
'application/vnd.sun.xml.math';
+                               case 'sxw':             return 
'application/vnd.sun.xml.writer';
+                               case 'sxg':             return 
'application/vnd.sun.xml.writer.global';
+                               case 'stw':             return 
'application/vnd.sun.xml.writer.template';
+                               case 'sus':             return 
'application/vnd.sus-calendar';
+                               case 'vsc':             return 
'application/vnd.vidsoft.vidconference';
+                               case 'vsd':             return 
'application/vnd.visio';
+                               case 'vis':             return 
'application/vnd.visionary';
+                               case 'sic':             return 
'application/vnd.wap.sic';
+                               case 'slc':             return 
'application/vnd.wap.slc';
+                               case 'wbxml':           return 
'application/vnd.wap.wbxml';
+                               case 'wmlc':            return 
'application/vnd.wap.wmlc';
+                               case 'wmlsc':           return 
'application/vnd.wap.wmlscriptc';
+                               case 'wtb':             return 
'application/vnd.webturbo';
+                               case 'wpd':             return 
'application/vnd.wordperfect';
+                               case 'wqd':             return 
'application/vnd.wqd';
+                               case 'wv':                      return 
'application/vnd.wv.csp+wbxml';
+                               case '8bit':            return 
'multipart/parallel';
+                               case 'hvd':             return 
'application/vnd.yamaha.hv-dic';
+                               case 'hvs':             return 
'application/vnd.yamaha.hv-script';
+                               case 'hvp':             return 
'application/vnd.yamaha.hv-voice';
+                               case 'saf':             return 
'application/vnd.yamaha.smaf-audio';
+                               case 'spf':             return 
'application/vnd.yamaha.smaf-phrase';
+                               case 'vmd':             return 
'application/vocaltec-media-desc';
+                               case 'vmf':             return 
'application/vocaltec-media-file';
+                               case 'vtk':             return 
'application/vocaltec-talker';
+                               case 'wif':             return 
'image/cewavelet';
+                               case 'wp5':             return 
'application/wordperfect5.1';
+                               case 'wk':                      return 
'application/x-123';
+                               case '7ls':             return 
'application/x-7th_level_event';
+                               case 'aab':             return 
'application/x-authorware-bin';
+                               case 'aam':             return 
'application/x-authorware-map';
+                               case 'aas':             return 
'application/x-authorware-seg';
+                               case 'bcpio':           return 
'application/x-bcpio';
+                               case 'bleep':           return 
'application/x-bleeper';
+                               case 'bz2':             return 
'application/x-bzip2';
+                               case 'vcd':             return 
'application/x-cdlink';
+                               case 'chat':            return 
'application/x-chat';
+                               case 'pgn':             return 
'application/x-chess-pgn';
+                               case 'z':                       return 
'application/x-compress';
+                               case 'cpio':            return 
'application/x-cpio';
+                               case 'pqf':             return 
'application/x-cprplayer';
+                               case 'csh':             return 
'application/x-csh';
+                               case 'csm':             return 
'chemical/x-csml';
+                               case 'co':                      return 
'application/x-cult3d-object';
+                               case 'deb':             return 
'application/x-debian-package';
+                               case 'dcr':             return 
'application/x-director';
+                               case 'dvi':             return 
'application/x-dvi';
+                               case 'evy':             return 
'application/x-envoy';
+                               case 'gtar':            return 
'application/x-gtar';
+                               case 'gz':                      return 
'application/x-gzip';
+                               case 'hdf':             return 
'application/x-hdf';
+                               case 'hep':             return 
'application/x-hep';
+                               case 'rhtml':           return 
'application/x-html+ruby';
+                               case 'mv':                      return 
'application/x-httpd-miva';
+                               case 'phtml':           return 
'application/x-httpd-php';
+                               case 'ica':             return 
'application/x-ica';
+                               case 'imagemap':        return 
'application/x-imagemap';
+                               case 'ipx':             return 
'application/x-ipix';
+                               case 'ips':             return 
'application/x-ipscript';
+                               case 'jar':             return 
'application/x-java-archive';
+                               case 'jnlp':            return 
'application/x-java-jnlp-file';
+                               case 'ser':             return 
'application/x-java-serialized-object';
+                               case 'class':           return 
'application/x-java-vm';
+                               case 'skp':             return 
'application/x-koan';
+                               case 'latex':           return 
'application/x-latex';
+                               case 'frm':             return 
'application/x-maker';
+                               case 'mid':             return 'audio/x-midi';
+                               case 'mda':             return 
'application/x-msaccess';
+                               case 'com':             return 
'application/x-msdos-program';
+                               case 'nc':                      return 
'application/x-netcdf';
+                               case 'pac':             return 
'application/x-ns-proxy-autoconfig';
+                               case 'pm5':             return 
'application/x-pagemaker';
+                               case 'pl':                      return 
'application/x-perl';
+                               case 'rp':                      return 
'application/x-pn-realmedia';
+                               case 'py':                      return 
'application/x-python';
+                               case 'qtl':             return 
'application/x-quicktimeplayer';
+                               case 'rar':             return 
'application/x-rar-compressed';
+                               case 'rb':                      return 
'application/x-ruby';
+                               case 'sh':                      return 
'application/x-sh';
+                               case 'shar':            return 
'application/x-shar';
+                               case 'swf':             return 
'application/x-shockwave-flash';
+                               case 'spr':             return 
'application/x-sprite';
+                               case 'sav':             return 
'application/x-spss';
+                               case 'spt':             return 
'application/x-spt';
+                               case 'sit':             return 
'application/x-stuffit';
+                               case 'sv4cpio':         return 
'application/x-sv4cpio';
+                               case 'sv4crc':          return 
'application/x-sv4crc';
+                               case 'tar':             return 
'application/x-tar';
+                               case 'tcl':             return 
'application/x-tcl';
+                               case 'tex':             return 
'application/x-tex';
+                               case 'texinfo':         return 
'application/x-texinfo';
+                               case 't':                       return 
'application/x-troff';
+                               case 'man':             return 
'application/x-troff-man';
+                               case 'me':                      return 
'application/x-troff-me';
+                               case 'ms':                      return 
'application/x-troff-ms';
+                               case 'vqf':             return 
'application/x-twinvq';
+                               case 'vqe':             return 
'application/x-twinvq-plugin';
+                               case 'ustar':           return 
'application/x-ustar';
+                               case 'bck':             return 
'application/x-vmsbackup';
+                               case 'src':             return 
'application/x-wais-source';
+                               case 'wz':                      return 
'application/x-wingz';
+                               case 'wp6':             return 
'application/x-wordperfect6.1';
+                               case 'crt':             return 
'application/x-x509-ca-cert';
+                               case 'zip':             return 
'application/zip';
+                               case 'xhtml':           return 
'application/xhtml+xml';
+                               case '3gpp':            return 'audio/3gpp';
+                               case 'amr':             return 'audio/amr';
+                               case 'awb':             return 'audio/amr-wb';
+                               case 'au':                      return 
'audio/basic';
+                               case 'evc':             return 'audio/evrc';
+                               case 'l16':             return 'audio/l16';
+                               case 'mp3':             return 'audio/mpeg';
+                               case 'sid':             return 'audio/prs.sid';
+                               case 'qcp':             return 'audio/qcelp';
+                               case 'smv':             return 'audio/smv';
+                               case 'koz':             return 
'audio/vnd.audiokoz';
+                               case 'eol':             return 
'audio/vnd.digital-winds';
+                               case 'plj':             return 
'audio/vnd.everad.plj';
+                               case 'lvp':             return 
'audio/vnd.lucent.voice';
+                               case 'mxmf':            return 
'audio/vnd.nokia.mobile-xmf';
+                               case 'vbk':             return 
'audio/vnd.nortel.vbk';
+                               case 'ecelp4800':       return 
'audio/vnd.nuera.ecelp4800';
+                               case 'ecelp7470':       return 
'audio/vnd.nuera.ecelp7470';
+                               case 'ecelp9600':       return 
'audio/vnd.nuera.ecelp9600';
+                               case 'smp3':            return 
'audio/vnd.sealedmedia.softseal.mpeg';
+                               case 'vox':             return 'audio/voxware';
+                               case 'aif':             return 'audio/x-aiff';
+                               case 'mp2':             return 'audio/x-mpeg';
+                               case 'mpu':             return 
'audio/x-mpegurl';
+                               case 'rm':                      return 
'audio/x-pn-realaudio';
+                               case 'rpm':             return 
'audio/x-pn-realaudio-plugin';
+                               case 'ra':                      return 
'audio/x-realaudio';
+                               case 'wav':             return 'audio/x-wav';
+                               case 'emb':             return 
'chemical/x-embl-dl-nucleotide';
+                               case 'cube':            return 
'chemical/x-gaussian-cube';
+                               case 'gau':             return 
'chemical/x-gaussian-input';
+                               case 'jdx':             return 
'chemical/x-jcamp-dx';
+                               case 'mol':             return 
'chemical/x-mdl-molfile';
+                               case 'rxn':             return 
'chemical/x-mdl-rxnfile';
+                               case 'tgf':             return 
'chemical/x-mdl-tgf';
+                               case 'mop':             return 
'chemical/x-mopac-input';
+                               case 'pdb':             return 
'x-chemical/x-pdb';
+                               case 'scr':             return 
'chemical/x-rasmol';
+                               case 'xyz':             return 
'x-chemical/x-xyz';
+                               case 'dwf':             return 'x-drawing/dwf';
+                               case 'ivr':             return 'i-world/i-vrml';
+                               case 'bmp':             return 'image/x-bmp';
+                               case 'cod':             return 'image/cis-cod';
+                               case 'fif':             return 'image/fif';
+                               case 'gif':             return 'image/gif';
+                               case 'ief':             return 'image/ief';
+                               case 'jp2':             return 'image/jp2';
+                               case 'jpg':             return 'image/pjpeg';
+                               case 'jpm':             return 'image/jpm';
+                               case 'jpf':             return 'image/jpx';
+                               case 'pic':             return 'image/pict';
+                               case 'png':             return 'image/x-png';
+                               case 'tga':             return 'image/targa';
+                               case 'tif':             return 'image/tiff';
+                               case 'tiff':            return 'image/tiff';
+                               case 'svf':             return 'image/vn-svf';
+                               case 'dgn':             return 'image/vnd.dgn';
+                               case 'djvu':            return 'image/vnd.djvu';
+                               case 'dwg':             return 'image/vnd.dwg';
+                               case 'pgb':             return 
'image/vnd.glocalgraphics.pgb';
+                               case 'ico':             return 
'image/vnd.microsoft.icon';
+                               case 'mdi':             return 
'image/vnd.ms-modi';
+                               case 'spng':            return 
'image/vnd.sealed.png';
+                               case 'sgif':            return 
'image/vnd.sealedmedia.softseal.gif';
+                               case 'sjpg':            return 
'image/vnd.sealedmedia.softseal.jpg';
+                               case 'wbmp':            return 
'image/vnd.wap.wbmp';
+                               case 'ras':             return 
'image/x-cmu-raster';
+                               case 'fh4':             return 
'image/x-freehand';
+                               case 'pnm':             return 
'image/x-portable-anymap';
+                               case 'pbm':             return 
'image/x-portable-bitmap';
+                               case 'pgm':             return 
'image/x-portable-graymap';
+                               case 'ppm':             return 
'image/x-portable-pixmap';
+                               case 'rgb':             return 'image/x-rgb';
+                               case 'xbm':             return 
'image/x-xbitmap';
+                               case 'xpm':             return 
'image/x-xpixmap';
+                               case 'xwd':             return 
'image/x-xwindowdump';
+                               case 'igs':             return 'model/iges';
+                               case 'msh':             return 'model/mesh';
+                               case 'x_b':             return 
'model/vnd.parasolid.transmit.binary';
+                               case 'x_t':             return 
'model/vnd.parasolid.transmit.text';
+                               case 'wrl':             return 'x-world/x-vrml';
+                               case 'csv':             return 
'text/comma-separated-values';
+                               case 'css':             return 'text/css';
+                               case 'html':            return 'text/html';
+                               case 'txt':             return 'text/plain';
+                               case 'rst':             return 
'text/prs.fallenstein.rst';
+                               case 'rtx':             return 'text/richtext';
+                               case 'sgml':            return 'text/x-sgml';
+                               case 'tsv':             return 
'text/tab-separated-values';
+                               case 'ccc':             return 
'text/vnd.net2phone.commcenter.command';
+                               case 'jad':             return 
'text/vnd.sun.j2me.app-descriptor';
+                               case 'si':                      return 
'text/vnd.wap.si';
+                               case 'sl':                      return 
'text/vnd.wap.sl';
+                               case 'wml':             return 
'text/vnd.wap.wml';
+                               case 'wmls':            return 
'text/vnd.wap.wmlscript';
+                               case 'hdml':            return 'text/x-hdml';
+                               case 'etx':             return 'text/x-setext';
+                               case 'talk':            return 'text/x-speech';
+                               case 'vcs':             return 
'text/x-vcalendar';
+                               case 'vcf':             return 'text/x-vcard';
+                               case 'xml':             return 'text/xml';
+                               case 'uvr':             return 'ulead/vrml';
+                               case '3gp':             return 'video/3gpp';
+                               case 'dl':                      return 
'video/dl';
+                               case 'gl':                      return 
'video/gl';
+                               case 'mj2':             return 'video/mj2';
+                               case 'mpeg':            return 'video/mpeg';
+                               case 'mov':             return 
'video/quicktime';
+                               case 'vdo':             return 'video/vdo';
+                               case 'viv':             return 'video/vivo';
+                               case 'fvt':             return 'video/vnd.fvt';
+                               case 'mxu':             return 
'video/vnd.mpegurl';
+                               case 'nim':             return 
'video/vnd.nokia.interleaved-multimedia';
+                               case 'mp4':             return 
'video/vnd.objectvideo';
+                               case 's11':             return 
'video/vnd.sealed.mpeg1';
+                               case 'smpg':            return 
'video/vnd.sealed.mpeg4';
+                               case 'sswf':            return 
'video/vnd.sealed.swf';
+                               case 'smov':            return 
'video/vnd.sealedmedia.softseal.mov';
+                               case 'vivo':            return 'video/vnd.vivo';
+                               case 'fli':             return 'video/x-fli';
+                               case 'wmv':             return 'video/x-ms-wmv';
+                               case 'avi':             return 
'video/x-msvideo';
+                               case 'movie':           return 
'video/x-sgi-movie';
+                               case 'ice':             return 
'x-conference/x-cooltalk';
+                               case 'd':                       return 
'x-world/x-d96';
+                               case 'svr':             return 'x-world/x-svr';
+                               case 'vrw':             return 
'x-world/x-vream';
+                               default: 
+                                       return $defaultType;
+                       }
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.uicommon.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,7 @@
        * @subpackage custom
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -56,8 +57,6 @@
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::custom';
 
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo               = 
CreateObject('property.bocustom',true);
@@ -96,207 +95,313 @@
 
                function index()
                {
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('custom',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs'));
-
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt','');
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']      = 
$this->bocommon->get_menu();
+
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'                    => 
'property.uicustom.index',
+                               'sort'                          => $this->sort,
+                       'order'                         => $this->order,
+                       'cat_id'                        => $this->cat_id,
+                       'filter'                        => $this->filter,
+                       'query'                         => $this->query
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uicustom.index',"
+                                                                               
                        ."sort:'{$this->sort}',"
+                                                                               
                        ."order:'{$this->order}',"
+                                                                               
                        ."cat_id:'{$this->cat_id}',"
+                                                                               
                        ."filter:'{$this->filter}',"
+                                                                               
                        ."query:'{$this->query}'";
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uicustom.index',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'cat_id'        => $this->cat_id,
+                                       'filter'        => $this->filter,
+                                       'query'         => $this->query
+                               );
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uicustom.index',
+                                                               'sort'          
=> $this->sort,
+                                                               'order'         
=> $this->order,
+                                                               'cat_id'        
=> $this->cat_id,
+                                                               'filter'        
=> $this->filter,
+                                                               'query'         
=> $this->query
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array
+                                                               (
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       )
+                                                                               
)
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
                        $list = $this->bo->read();
 
-                       $uicols['name'][]       = 'custom_id';
-                       $uicols['descr'][]      = lang('ID');
-                       $uicols['name'][]       = 'name';
-                       $uicols['descr'][]      = lang('Name');
-                       $uicols['name'][]       = 'entry_date';
-                       $uicols['descr'][]      = lang('date');
-                       $uicols['name'][]       = 'user';
-                       $uicols['descr'][]      = lang('User');
+                       $uicols['name'][0]      = 'custom_id';
+                       $uicols['descr'][0]     = lang('ID');
+                       $uicols['name'][1]      = 'name';
+                       $uicols['descr'][1]     = lang('Name');
+                       $uicols['name'][2]      = 'entry_date';
+                       $uicols['descr'][2]     = lang('date');
+                       $uicols['name'][3]      = 'user';
+                       $uicols['descr'][3]     = lang('User');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
-                       $j=0;
                        if (isset($list) AND is_array($list))
                        {
-                               foreach($list as $entry)
+                               foreach($list as $list_entry)
                                {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       for ($k=0;$k<$count_uicols_name;$k++)
                                        {
-                                               
if($uicols['input_type'][$i]!='hidden')
+                                               
if($uicols['input_type'][$k]!='hidden')
                                                {
-                                                       
$content[$j]['row'][$i]['value']                        = 
$entry[$uicols['name'][$i]];
-                                                       
$content[$j]['row'][$i]['name']                         = $uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $list_entry[$uicols['name'][$k]];
                                                }
                                        }
+                                       $j++;
+                                               }
+                                       }
 
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'custom_id',
+                                               'source'        => 'custom_id'
+                                       ),
+                               )
+                       );
+
                                        if($this->acl_read)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('view the 
entity');
-                                               $content[$j]['row'][$i]['text'] 
                        = lang('view');
-                                               
$content[$j]['row'][$i++]['link']                       = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uicustom.view', 'custom_id'=> $entry['custom_id']));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'view',
+                                                       'statustext'    => 
lang('view the entity'),
+                                                       'text'                  
=> lang('view'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uicustom.view'
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
                                        }
+
                                        if($this->acl_edit)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
actor');
-                                               $content[$j]['row'][$i]['text'] 
                        = lang('edit');
-                                               
$content[$j]['row'][$i++]['link']                       = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uicustom.edit', 'custom_id'=> $entry['custom_id']));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'    => 
lang('edit the actor'),
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uicustom.edit'
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
                                        }
+
                                        if($this->acl_delete)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('delete the 
actor');
-                                               $content[$j]['row'][$i]['text'] 
                        = lang('delete');
-                                               
$content[$j]['row'][$i++]['link']                       = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uicustom.delete', 'custom_id'=> $entry['custom_id']));
-                                       }
-
-                                       $j++;
-                               }
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'delete',
+                                                       'statustext'    => 
lang('delete the actor'),
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                               (
+                                                                               
'menuaction'    => 'property.uicustom.delete'
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
                        }
 
-//_debug_array($list);
-                       $i=0;
-                       $table_header[$i]['header']     = lang('ID');
-                       $table_header[$i]['width']      = '5%';
-                       $table_header[$i]['align']      = 'center';
-                       $table_header[$i]['sort_link']  = true;
-                       $table_header[$i]['sort']       = 
$this->nextmatchs->show_sort_order(array
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                (
-                                       'sort'  => $this->sort,
-                                       'var'   => 'id',
-                                       'order' => $this->order,
-                                       'extra' => array('menuaction'   => 
'property.uicustom.index',
-                                                                               
'query' =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-                       $table_header[$i]['header']     = lang('name');
-                       $table_header[$i]['width']      = '5%';
-                       $table_header[$i]['align']      = 'center';
-                       $table_header[$i]['sort_link']  = true;
-                       $table_header[$i]['sort']       = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   => 'name',
-                                       'order' => $this->order,
-                                       'extra' => array('menuaction'   => 
'property.uicustom.index',
-                                                                               
'query'         => $this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'      => $end_date)
-                               ));
-                       $i++;
+                                               'menuaction'    => 
'property.uicustom.edit'
+                                       )));
 
-                       $table_header[$i]['header']     = lang('date');
-                       $table_header[$i]['width']      = '5%';
-                       $table_header[$i]['align']      = 'center';
-                       $table_header[$i]['sort_link']  = true;
-                       $table_header[$i]['sort']       = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   => 'name',
-                                       'order' => $this->order,
-                                       'extra' => array('menuaction'   => 
'property.uicustom.index',
-                                                                               
'query'         => $this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'      => $end_date)
-                               ));
-                       $i++;
-                       $table_header[$i]['header']     = lang('User');
-                       $table_header[$i]['width']      = '5%';
-                       $table_header[$i]['align']      = 'center';
-                       $table_header[$i]['sort_link']  = true;
-                       $table_header[$i]['sort']       = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   => 'user_id',
-                                       'order' => $this->order,
-                                       'extra' => array('menuaction'   => 
'property.uicustom.index',
-                                                                               
'query'         => $this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'      => $end_date)
-                               ));
-                       $i++;
+                       unset($parameters);
 
-
-                       if($this->acl_read)
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
-                               $i++;
+                               if($uicols['input_type'][$i]!='hidden')
+                       {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='custom_id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
                        }
-                       if($this->acl_edit)
+
+                                       if($uicols['name'][$i]=='entry_date')
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('edit');
-                               $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
                        }
-                       if($this->acl_delete)
+
+                                       if($uicols['name'][$i]=='name' || 
$uicols['name'][$i]=='user')
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('delete');
-                               $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                                       }
                        }
+                       }
 
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       if($this->acl_add)
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                                        = 
lang('custom');
+                       $function_msg                           = lang('list 
custom');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $table_add = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
custom query'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uicustom.edit'))
-                               );
+                               $datatable['sorting']['order']                  
= 'custom_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
 
-                       $link_data = array
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 'property.uicustom.index',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'query'         => $this->query
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       if(!$this->allrows)
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
                        }
-                       else
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
                        {
-                               $record_limit   = $this->bo->total_records;
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
=> $content,
-                               'table_add'                                     
=> $table_add
-                       );
-                       $this->save_sessiondata();
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('custom') . ': ' . lang('list custom');
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'custom.index', 'property' );
                }
 
                function edit()
@@ -431,10 +536,10 @@
                                'menuaction' => 'property.uicustom.index'
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
                                $this->bo->delete($custom_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               return "custom_id ".$custom_id." ".lang("has 
been deleted");
                        }
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
@@ -461,8 +566,220 @@
 
                function view()
                {
-                       $custom_id      = phpgw::get_var('custom_id', 'int', 
'GET');
+                       $custom_id      = phpgw::get_var('custom_id', 
'int','GET');
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']      = 
$this->bocommon->get_menu();
+
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 'property.uicustom.view',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'custom_id'     => $custom_id,
+                                       'filter'        => $this->filter,
+                                       'query'         => $this->query
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uicustom.view',"
+                                                                               
                        ."sort:'{$this->sort}',"
+                                                                               
                        ."order:'{$this->order}',"
+                                                                               
                        ."custom_id:'{$custom_id}',"
+                                                                               
                        ."filter:'{$this->filter}',"
+                                                                               
                        ."query:'{$this->query}'";
+
+                           $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uicustom.view',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'custom_id'     => $custom_id,
+                                       'filter'        => $this->filter,
+                                       'query'         => $this->query
+                               );
+
+                           $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uicustom.view',
+                                                               'sort'          
=> $this->sort,
+                                                               'order'         
=> $this->order,
+                                                               'custom_id'     
=> $custom_id,
+                                                               'filter'        
=> $this->filter,
+                                                               'query'         
=> $this->query
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                                        'field' => array
+                                                        (
+                                                                       'type'  
=> 'button',
+                                                                   'id'        
=> 'btn_export',
+                                                                   'value'     
=> lang('download'),
+                                                                   'tab_index' 
=> 1
+                                                        )
+                                               )
+                                        )
+                               );
+                       }
+                       //_debug_array($custom_id);die;
+                       $list = $this->bo->read_custom($custom_id);
+                       $uicols = $this->bo->uicols;
+                       $j = 0;
+                       $count_uicols_name = count($uicols);
+
+                       if (isset($list) AND is_array($list))
+                       {
+                               foreach($list as $list_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols[$k]['name'];
+                                               
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$list_entry[$uicols[$k]['name']];
+                                       }
+                                       $j++;
+                               }
+
+                               $datatable['rowactions']['action'] = array();
+
+                       }
+                       //_debug_array($datatable);die;
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols[$i]['name'];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols[$i]['descr'];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                               }
+                       }
+
+                       $link_download = array
+                       (
+                               'menuaction'    => 'property.uicustom.download',
+                               'sort'          => $this->sort,
+                               'order'         => $this->order,
+                               'filter'        => $this->filter,
+                               'query'         => $this->query,
+                               'custom_id'     => $custom_id,
+                               'allrows'       => $this->allrows
+                       );
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                                        = 
lang('documents');
+                       $function_msg                           = lang('list 
documents');
+
+                       //_debug_array($datatable['headers']['header']);die;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= $datatable['headers']['header'][0]['name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= null; // name of column of Database
+                               $datatable['sorting']['sort']                   
= null; // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'custom.view', 'property' );
+                       //$this->save_sessiondata();
+
+
+                       /*$custom_id    = phpgw::get_var('custom_id', 'int', 
'GET');
+
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('custom','nextmatchs'));
 
                        $list= $this->bo->read_custom($custom_id);
@@ -556,7 +873,7 @@
                        );
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+               //      $GLOBALS['phpgw']->xslttpl->pp();*/
                }
 
                function download()

Added: people/sigurdne/modules/property/trunk/inc/class.uidebug_json.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uidebug_json.inc.php       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.uidebug_json.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,103 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author César Ramírez <address@hidden>
+       * @copyright Copyright (C) 2009 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage project
+       * @version $Id$
+       */
+
+       //phpgw::import_class('phpgwapi.yui');
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_uidebug_json
+       {
+               var $public_functions = array
+               (
+                       'index'                 => true
+               );
+
+               public function __construct()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+                       $this->acl                              = & 
$GLOBALS['phpgw']->acl;
+                       $this->acl_location             = '.admin';
+                       $this->acl_read                 = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
+               }
+
+               public function index()
+               {
+                       if(!$this->acl_read)
+                       {
+                               echo lang('no access');
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
+                       //get session's values
+                       $data = 
phpgwapi_cache::session_get($GLOBALS['phpgw_info']['flags']['currentapp'],"id_debug");
+                       if(isset($data))
+                       {
+                               //clear session
+                               
phpgwapi_cache::session_clear($GLOBALS['phpgw_info']['flags']['currentapp'], 
"id_debug");
+                               //replace '<' and '>'
+                               if (is_array($data))
+                               {
+                                       self::_my_print_rec($data,0);
+                               }
+                               else
+                               {
+                                       $data = htmlspecialchars($data);
+                               }
+                               _debug_array($data);                            
+                       }
+                       else
+                       {
+                               echo "empty session's value"; 
+                       }
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               
+               static protected function _my_print_rec(&$val,$nivel=0)
+               {
+                       foreach($val as $key => &$value)
+                       {
+                               if(is_array($value))
+                               {
+                                       self::_my_print_rec($value,$nivel+1);
+                               }
+                               else
+                               {
+                               //      $value = 
str_replace(array('<','>'),array('&lt;','&gt;'),$value);
+                                       $value = htmlspecialchars($value);
+                               }
+                       }
+               }               
+
+
+
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.uidebug_json.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision

Modified: people/sigurdne/modules/property/trunk/inc/class.uidocument.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uidocument.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uidocument.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,7 @@
        * @subpackage document
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -44,6 +45,7 @@
                var $part_of_town_id;
                var $sub;
                var $currentapp;
+               var $allrows;
 
                var $public_functions = array
                (
@@ -60,11 +62,10 @@
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"property::documentation";
 
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                                       = 
CreateObject('property.bodocument',true);
-                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->bocommon                         = & 
$this->bo->bocommon;
+                       $this->cats                                     = & 
$this->bo->cats;
                        $this->bolocation                       = 
CreateObject('property.bolocation');
                        $this->config                           = 
CreateObject('phpgwapi.config','property');
                        $this->boadmin_entity           = 
CreateObject('property.boadmin_entity');
@@ -76,7 +77,8 @@
                        $this->acl_edit                         = 
$this->acl->check('.document', PHPGW_ACL_EDIT, 'property');
                        $this->acl_delete                       = 
$this->acl->check('.document', PHPGW_ACL_DELETE, 'property');
 
-                       $this->rootdir                          = 
$this->bo->rootdir;
+                       //$this->rootdir                                = 
$this->bo->rootdir;
+                       $this->bofiles                          = & 
$this->bo->bofiles;
                        $this->fakebase                         = 
$this->bo->fakebase;
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
@@ -88,6 +90,7 @@
                        $this->entity_id                        = 
$this->bo->entity_id;
                        $this->doc_type                         = 
$this->bo->doc_type;
                        $this->query_location           = 
$this->bo->query_location;
+                       $this->allrows                          = 
$this->bo->allrows;
 
                        // FIXME: $this->entity_id always has a value set here 
- skwashd jan08
                        if ( $this->entity_id )
@@ -125,17 +128,7 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                                               
'document',
-                                                                               
'values',
-                                                                               
'table_header',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'
-                                                                               
)
-                       );
-
                        $entity_id = phpgw::get_var('entity_id', 'int');
-
                        $preserve = phpgw::get_var('preserve', 'bool');
 
                        if($preserve)
@@ -152,209 +145,339 @@
                                $this->entity_id                        = 
$this->bo->entity_id;
                        }
 
-                       $document_list = $this->bo->read();
+                       $datatable = array();
 
-//_debug_array($document_list);
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'                    => 
'property.uidocument.index',
+                               'sort'                          => $this->sort,
+                       'order'                         => $this->order,
+                       'cat_id'                        => $this->cat_id,
+                       'filter'                        => $this->filter,
+                       'status_id'                     => $this->status_id,
+                       'query'                         => $this->query,
+                       'doc_type'                      => $this->doc_type,
+                       'entity_id'                     => $this->entity_id
+                               ));
 
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uidocument.index',"
+                                                                               
                        ."sort:'{$this->sort}',"
+                                                                               
                        ."order:'{$this->order}',"
+                                                                               
                        ."cat_id:'{$this->cat_id}',"
+                                                                               
                        ."filter:'{$this->filter}',"
+                                                                               
                        ."status_id:'{$this->status_id}',"
+                                                                               
                        ."query:'{$this->query}',"
+                                                                               
                        ."doc_type:'{$this->doc_type}',"
+                                                                               
                        ."entity_id:'{$this->entity_id}'";
 
+                               
//_debug_array($datatable['config']['base_java_url']);die;
+
+                           $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uidocument.index',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'cat_id'        => $this->cat_id,
+                                       'filter'        => $this->filter,
+                                       'status_id'     => $this->status_id,
+                                       'query'         => $this->query,
+                                       'doc_type'      => $this->doc_type,
+                                       'entity_id'     => $this->entity_id
+                               );
+
+                           $datatable['config']['allow_allrows'] = false;
+
+                               $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->doc_type,'globals' => True));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no document type'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl_location,array('all'),$default=$this->account);
+                               $default_value = array 
('id'=>'','name'=>lang('no status'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uidocument.index',
+                                                               'sort'       => 
$this->sort,
+                                                               'order'       
=> $this->order,
+                                                               'cat_id'       
=> $this->cat_id,
+                                                               'filter'       
=> $this->filter,
+                                                               'status_id'     
  => $this->status_id,
+                                                               'query'       
=> $this->query,
+                                                               'doc_type'      
 => $this->doc_type,
+                                                               'entity_id'     
  => $this->entity_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
//boton  CATEGORY
+                                                                           
'id' => 'btn_type_id',
+                                                                           
'name' => 'type_id',
+                                                                           
'value'     => lang('Type'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//boton  STATUS
+                                                                           
'id' => 'btn_user_id',
+                                                                           
'name' => 'user_id',
+                                                                           
'value'     => lang('User'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       )
+                                                                               
),
+                                                       'hidden_value' => array(
+                                                                               
        array( //div values  combo_box_0
+                                                                               
                            'id' => 'values_combo_box_0',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id') 
//i.e.  id,value/id,vale/
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_1
+                                                                               
                            'id' => 'values_combo_box_1',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
                      )
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+                       $document_list = $this->bo->read();
                        $uicols = $this->bo->uicols;
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
-                       $j=0;
-                       while (is_array($document_list) && 
list(,$document_entry) = each($document_list))
+                       if (isset($document_list) AND is_array($document_list))
                        {
-                               for ($k=0;$k<count($uicols['name']);$k++)
+                               foreach($document_list as $document_entry)
                                {
-                                       if($uicols['input_type'][$k]!='hidden')
+                                       for ($k=0;$k<$count_uicols_name;$k++)
                                        {
                                                
if(isset($document_entry['query_location'][$uicols['name'][$k]]) && 
$document_entry['query_location'][$uicols['name'][$k]])
                                                {
-
-                                                       $content[$j]['row'][]= 
array(
-                                                               'statustext'    
=> lang('search'),
-                                                               'text'          
=> $document_entry[$uicols['name'][$k]],
-                                                               'link'          
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.index', 'query'=> 
$document_entry['query_location'][$uicols['name'][$k]], 'entity_id'=> 
isset($document_entry['p_entity_id'])?$document_entry['p_entity_id']:'', 
'cat_id'=> isset($document_entry['p_cat_id'])?$document_entry['p_cat_id']:''))
-                                                               );
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['statustext']               = 
lang('search');
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$document_entry[$uicols['name'][$k]];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['java_link']                = true;
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                             
= $document_entry['query_location'][$uicols['name'][$k]];
                                                }
                                                else
                                                {
-                                                       $content[$j]['row'][]= 
array(
-                                                               'value'         
=> $document_entry[$uicols['name'][$k]],
-                                                               'name'          
=> $uicols['name'][$k],
-                                                               );
-                                               }
-
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$document_entry[$uicols['name'][$k]];
                                        }
                                }
 
                                if($this->acl_read)
                                {
-                                       $content[$j]['row'][]= array(
-                                               'statustext'            => 
lang('view documents for this location/entity'),
-                                               'text'                  => 
lang('documents'),
-                                               'link'                  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.list_doc', 'location_code'=>  
$document_entry['location_code'], 'p_num'=> isset($document_entry['p_num']) ? 
$document_entry['p_num'] :'', 'entity_id'=> 
isset($document_entry['p_entity_id']) ? $document_entry['p_entity_id'] : '', 
'cat_id'=> isset($document_entry['p_cat_id']) ? $document_entry['p_cat_id'] : 
'', 'doc_type'=> $this->doc_type))
-                                               );
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
lang('view');
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                                               
$datatable['rows']['row'][$j]['column'][$k]['link']             =       
$GLOBALS['phpgw']->link('/index.php', array
+                                                                               
        (
+                                                                               
                'menuaction'=> 'property.uidocument.list_doc',
+                                                                               
                'location_code'=>  $document_entry['location_code'],
+                                                                               
                'p_num'=> isset($document_entry['p_num']) ? 
$document_entry['p_num'] :'',
+                                                                               
                'entity_id'=> isset($document_entry['p_entity_id']) ? 
$document_entry['p_entity_id'] : '',
+                                                                               
                'cat_id'=> isset($document_entry['p_cat_id']) ? 
$document_entry['p_cat_id'] : '',
+                                                                               
                'doc_type'=> $this->doc_type
+                                                                               
        ));
+                                                                               
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
lang('documents');
+                                                                               
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
                                }
 
                                $j++;
                        }
 
-                       for ($i=0;$i<count($uicols['descr']);$i++)
+                               //_debug_array($datatable['rows']['row']);die;
+                               $datatable['rowactions']['action'] = array();
+
+                               if ($this->acl_add)
                        {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                                               
'my_name'                       => 'add',
+                                                                               
'text'                  => lang('add'),
+                                                                               
'action'                => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                                (
+                                                                               
                                        'menuaction'=> 
'property.uidocument.edit',
+                                                                               
                                        'entity_id'=> $this->entity_id,
+                                                                               
                                        'cat_id'=> $this->cat_id
+                                                                               
                                ))
+                                                               );
+                               }
+                       }
+
+                       $count_uicols_descr = count($uicols['descr']);
+
+                       for ($i=0;$i<$count_uicols_descr;$i++)
+                               {
                                if($uicols['input_type'][$i]!='hidden')
-                               {
-                                       $table_header[$i]['header']             
= $uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'location_code',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uidocument.index',
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'doc_type'      => 
$this->doc_type,
-                                                                               
                                                        'entity_id'     => 
$this->entity_id)
-                                                                               
));
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
                                        }
-                                       if($uicols['name'][$i]=='document_id')
+
+                               if($uicols['name'][$i]=='loc1')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'document_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uidocument.index',
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'doc_type'      => 
$this->doc_type,
-                                                                               
                                                        'entity_id'     => 
$this->entity_id)
-                                                                               
));
+                                       
$datatable['headers']['header'][$i]['sortable']         = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']       = 'location_code';
                                        }
+
                                        if($uicols['name'][$i]=='address')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'address',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uidocument.index',
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'doc_type'      => 
$this->doc_type,
-                                                                               
                                                        'entity_id'     => 
$this->entity_id)
-                                                                               
));
-                                       }
+                                       
$datatable['headers']['header'][$i]['sortable']         = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']       = 'address';
                                }
                        }
 
                        if($this->acl_read)
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
-                               $i++;
+                               
$datatable['headers']['header'][$i]['formatter']                = '""';
+                               $datatable['headers']['header'][$i]['name']     
                = lang('view');
+                               $datatable['headers']['header'][$i]['text']     
                = 'view';
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = false;
                        }
 
-                       if($this->acl_add)
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($document_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                                        = 
lang('documents');
+                       $function_msg                           = lang('list 
documents');
+
+                       //_debug_array($datatable['headers']['header']);die;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $table_add[] = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
document'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.edit', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id))
-
-                               );
+                               $datatable['sorting']['order']                  
= 'loc1'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
                        }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
 
-                       $link_data = array
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 'property.uidocument.index',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'status_id'     => $this->status_id,
-                               'query'         => $this->query,
-                               'doc_type'      => $this->doc_type,
-                               'entity_id'     => $this->entity_id
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       if($this->entity_id)
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
                        {
-                               $boentity       = 
CreateObject('property.boentity');
-                               $boentity->entity_id=$this->entity_id;
-
-                               $cat_list       = 
$this->bo->select_category_list('filter',$this->cat_id);
-                               $entity         = 
$this->boadmin_entity->read_single($this->entity_id,false);
-                               $appname_sub    = $entity['name'];
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
                        }
-                       else
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
                        {
-                               $appname_sub    = lang('location');
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
                        }
 
-                       $data = array
-                       (
-                               'menu'                                          
                        => $this->bocommon->get_menu(),
-                               'link_history'                                  
                => $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.index', 'cat_id'=> $this->cat_id)),
-                               'lang_history_statustext'                       
        => lang('search for history at this location'),
-                               'lang_select'                                   
                => lang('select'),
-                               'allow_allrows'                                 
                => false,
-                               'start_record'                                  
                => $this->start,
-                               'record_limit'                                  
                => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
                => count($document_list),
-                               'all_records'                                   
                => $this->bo->total_records,
-                               'link_url'                                      
                        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
                        => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'type'                                          
                        => $this->cat_id,
-                               'select_action'                                 
                => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                               'lang_no_cat'                                   
                => lang('no category'),
-                               'lang_cat_statustext'                           
        => lang('Select the category. To do not use a category select NO 
CATEGORY'),
-                               'select_name'                                   
                => 'cat_id',
-                               'cat_list'                                      
                        => (isset($cat_list)?$cat_list:''),
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
 
-                               'lang_no_doc_type'                              
                => lang('no document type'),
-                               'lang_doc_type_statustext'                      
        => lang('Select the document type the document belongs to.'),
-                               'doc_type'                                      
                        => 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->doc_type,'type' =>'document','order'=>'descr')),
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'lang_status_statustext'                        
        => lang('Select the status the document belongs to. To do not use a 
category select NO STATUS'),
-                               'status_name'                                   
                => 'status_id',
-                               'lang_no_status'                                
                => lang('No status'),
-                               'status_list'                                   
                => $this->bo->select_status_list('filter',$this->status_id),
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
 
-                               'lang_user_statustext'                          
        => lang('Select the user the document belongs to. To do not use a 
category select NO USER'),
-                               'select_user_name'                              
                => 'filter',
-                               'lang_no_user'                                  
                => lang('No user'),
-                               'user_list'                                     
                        => 
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl_location,array('all'),$default=$this->account),
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
 
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
                        => $this->query,
-                               'lang_search'                                   
                => lang('search'),
-                               'table_header'                                  
                => $table_header,
-                               'values'                                        
                        => (isset($content)?$content:''),
-                               'table_add'                                     
                        => $table_add
-                       );
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       $appname        = lang('document');
-                       $function_msg   = lang('list document');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg . ' - ' . 
$appname_sub;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'document.index', 'property' );
+                       //$this->save_sessiondata();
                }
 
                function list_doc()
                {
-
                        if(!$this->acl_read)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
@@ -375,13 +498,14 @@
                                $this->cat_id                           = 
$this->bo->cat_id;
                                $this->status_id                        = 
$this->bo->status_id;
                        }
-//_debug_array($this->cat_id);
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('document',
-                                                                               
'receipt',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
 
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt','');
 
@@ -393,7 +517,8 @@
 
                        $p_num = phpgw::get_var('p_num');
 
-                       $location=$this->bo->read_location_data($location_code);
+                       $location = 
$this->bo->read_location_data($location_code);
+                       //_debug_array($location);
 
                        if($this->cat_id)
                        {
@@ -415,113 +540,73 @@
                                
$entity_data[$this->entity_id]['p_cat_name']=$category['name'];
                        }
 
-                       $this->config->read_repository();
-                       $files_url = $this->config->config_data['files_url'];
-
-                       $document_list = 
$this->bo->read_at_location($location_code);
-
-//_debug_array($document_list);
-
-                       if($this->cat_id)
-                       {
-                               $directory = $this->fakebase. '/' . 'document' 
. '/' . $location['loc1'] . '/' . $entity['name'] . '/' . $category['name'] . 
'/' . $p_num;
-                       }
-                       else
-                       {
-                               $directory = $this->fakebase. '/' . 'document' 
. '/' . $location['loc1'];
-                       }
-
-                       while (is_array($document_list) && list(,$document) = 
each($document_list))
-                       {
-                               if($document['link'])
-                               {
-                                       $link_view_file=$document['link'];
-                                       $document['document_name']='link';
-                                       unset($link_to_files);
-                               }
-                               else
-                               {
-                                       if(!$link_to_files)
-                                       {
-                                               $link_view_file = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.view_file', 'id'=> $document['document_id'], 'entity_id'=> 
$this->entity_id, 'cat_id'=> $this->cat_id, 'p_num'=> $p_num));
-                                               $link_to_files = $files_url;
-                                       }
-                               }
-
-                               $content[] = array
-                               (
-                                       'directory'                             
=> $directory,
-                                       'document_id'                           
=> $document['document_id'],
-                                       'document_name'                         
=> $document['document_name'],
-                                       'title'                                 
=> $document['title'],
-                                       'user'                                  
=> $document['user'],
-                                       'doc_type'                              
=> $document['doc_type'],
-                                       'link_view_file'                        
=> $link_view_file,
-                                       'link_to_files'                         
=> $link_to_files,
-                                       'link_view'                             
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.view', 'document_id'=> $document['document_id'], 'from'=> 
'list_doc')),
-                                       'link_edit'                             
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.edit', 'document_id'=> $document['document_id'], 'from'=> 
'list_doc')),
-                                       'link_delete'                           
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.delete', 'document_id'=> $document['document_id'], 
'location_code'=> $location_code, 'p_num'=> $p_num)),
-                                       'lang_view_file_statustext'             
=> lang('view the document'),
-                                       'lang_view_statustext'                  
=> lang('view information about the document'),
-                                       'lang_edit_statustext'                  
=> lang('edit information about the document'),
-                                       'lang_delete_statustext'                
=> lang('delete this document'),
-                                       'text_view'                             
=> lang('view'),
-                                       'text_edit'                             
=> lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
-                               );
-                       }
-
-
-                       $table_header[] = array
-                       (
-                               'sort_document_name'    => 
$this->nextmatchs->show_sort_order(array
+                       $link_data = array
                                                                                
(
+                                       'menuaction'    => 
'property.uidocument.list_doc',
                                                                                
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'document_name',
                                                                                
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uidocument.list_doc',
                                                                                
                                'entity_id'     => $this->entity_id,
                                                                                
                                'cat_id'        => $this->cat_id,
-                                                                               
                                'doc_type'      => $this->doc_type,
                                                                                
                                'p_num'         => $p_num,
+                                       'doc_type'      => $this->doc_type,
                                                                                
                                'location_code' => $location_code,
                                                                                
                                'filter'        => $this->filter,
                                                                                
                                'query'         => $this->query,
-                                                                               
                                'query_location' => $this->query_location
-                                                                               
                                )
-                                                                               
)),
-                               'lang_document_name'    => lang('Document 
name'),
-                               'lang_doc_type'         => lang('Doc type'),
-                               'lang_user'             => lang('user'),
-                               'lang_title'            => lang('Title'),
-                               'lang_view'             => lang('view'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
+                                       'query_location'=> 
$this->query_location,
+                                       'allrows'               => 
$this->allrows
                                );
 
+                       $this->config->read();
+                       $files_url = $this->config->config_data['files_url'];
 
-                       $link_data_add = array
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
                        (
-                               'menuaction'            => 
'property.uidocument.edit',
-                               'location_code'         => $location_code,
-                               'p_entity_id'           => $this->entity_id,
+                               'menuaction'    => 
'property.uidocument.list_doc',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
                                'entity_id'             => $this->entity_id,
-                               'p_cat_id'              => $this->cat_id,
                                'cat_id'                => $this->cat_id,
                                'p_num'                 => $p_num,
-                               'from'                  => 'list_doc',
-                               'bypass'                => true
-                       );
+                                       'doc_type'      => $this->doc_type,
+                                       'location_code' => $location_code,
+                                       'filter'        => $this->filter,
+                                       'query'         => $this->query,
+                                       'query_location'=> 
$this->query_location,
+                                       'allrows'               => 
$this->allrows
+                               ));
 
-                       $table_add[] = array
-                       (
-                               'lang_add'              => lang('add'),
-                               'lang_add_statustext'   => lang('add a 
document'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',$link_data_add)
-                       );
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uidocument.list_doc',"
+                                                                               
                        ."sort:'{$this->sort}',"
+                                                                               
                        ."order:'{$this->order}',"
+                                                                               
                        ."entity_id:'{$this->entity_id}',"
+                                                                               
                        ."cat_id:'{$this->cat_id}',"
+                                                                               
                        ."p_num:'{$p_num}',"
+                                                                               
                        ."doc_type:'{$this->doc_type}',"
+                                                                               
                        ."location_code:'{$location_code}',"
+                                                                               
                        ."filter:'{$this->filter}',"
+                                                                               
                        ."query:'{$this->query}',"
+                                                                               
                        ."query_location:'{$this->query_location}',"
+                                                                               
                        ."allrows:'{$this->allrows}'";
 
-                       $link_data = array
-                       (
+                           $datatable['config']['allow_allrows'] = true;
+
+                               $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->doc_type,'globals' => True));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl_location,array('all'),$default=$this->account);
+                               $default_value = array 
('id'=>'','name'=>lang('no user'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
                                'menuaction'    => 
'property.uidocument.list_doc',
                                'sort'          => $this->sort,
                                'order'         => $this->order,
@@ -533,10 +618,152 @@
                                'filter'        => $this->filter,
                                'query'         => $this->query,
                                'query_location'=> $this->query_location
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
// mensaje
+                                                                               
                                        'type'  => 'label',
+                                                                               
                                        'id'    => 'msg_header',
+                                                                               
                                        'value' => '',
+                                                                               
                                        'style' => 'filter'
+                                                                               
                                ),
+                                                                               
                                array( //boton  CATEGORY
+                                                                           
'id' => 'btn_type_id',
+                                                                           
'name' => 'type_id',
+                                                                           
'value'     => lang('Type'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//boton  STATUS
+                                                                           
'id' => 'btn_user_id',
+                                                                           
'name' => 'user_id',
+                                                                           
'value'     => lang('User'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       ),
+                                                                               
                                array( //container of  control's Form
+                                                                               
                                        'type'  => 'label',
+                                                                               
                                        'id'    => 'controlsForm_container',
+                                                                               
                                        'value' => ''
+                                                                               
                                )
+                                                                               
),
+                                                       'hidden_value' => array(
+                                                                               
        array( //div values  combo_box_0
+                                                                               
                            'id' => 'values_combo_box_0',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id') 
//i.e.  id,value/id,vale/
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_1
+                                                                               
                            'id' => 'values_combo_box_1',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
                      )
+                                                                               
                        )
+                                                                               
)
+                                        )
                        );
 
+                               $dry_run = true;
+                       }
 
-                       
$location_data=$this->bolocation->initiate_ui_location(array(
+                       $document_list = 
$this->bo->read_at_location($location_code);
+
+                       if($this->cat_id)
+                       {
+                               $directory = 
"{$this->fakebase}/document/entity_{$this->entity_id}_{$this->cat_id}/{$p_num}/{$this->doc_type}";
+                       }
+                       else
+                       {
+                               $directory = 
"{$this->fakebase}/document/{$location_code}/{$this->doc_type}";
+                       }
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+
+                       $uicols['name'][0]              = 'document_name';
+                       $uicols['descr'][0]             = lang('Document name');
+                       $uicols['datatype'][0]  = 'link';
+                       $uicols['name'][1]              = 'title';
+                       $uicols['descr'][1]             = lang('Title');
+                       $uicols['datatype'][1]  = 'text';
+                       $uicols['name'][2]              = 'doc_type';
+                       $uicols['descr'][2]             = lang('Doc type');
+                       $uicols['datatype'][2]  = 'text';
+                       $uicols['name'][3]              = 'user';
+                       $uicols['descr'][3]             = lang('User');
+                       $uicols['datatype'][3]  = 'text';
+                       $uicols['name'][4]              = 'document_id';
+                       $uicols['descr'][4]             = lang('document id');
+                       $uicols['datatype'][4]  = 'text';
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       foreach($document_list as $document_entry )
+                       {
+                               for ($k=0;$k<$count_uicols_name;$k++)
+                               {
+                                       if($document_entry['link'])
+                                       {
+                                               
$link_view_file=$document_entry['link'];
+                                               
$document_entry['document_name']='link';
+                                               unset($link_to_files);
+                                       }
+                                       else
+                                       {
+                                               if(!$link_to_files)
+                                               {
+                                                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.view_file', 'id'=> $document_entry['document_id'], 
'entity_id'=> $this->entity_id, 'cat_id'=> $this->cat_id, 'p_num'=> $p_num));
+                                                       $link_to_files = 
$files_url;
+                                               }
+                                               else
+                                               {
+                                                       $link_view_file 
="{$files_url}/{$directory}/{$document_entry['document_name']}";
+                                               }
+                                       }
+
+                                       if($uicols['input_type'][$k]!='hidden')
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                               
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$document_entry[$uicols['name'][$k]];
+
+                                               if(isset($uicols['datatype']) 
&& isset($uicols['datatype'][$k]) && $uicols['datatype'][$k]=='link' && 
$document_entry[$uicols['name'][$k]])
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']           = 'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
$document_entry[$uicols['name'][$k]];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
$link_view_file;
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']           = '_blank';
+                                               }
+                                       }
+                               }
+                               $j++;
+                       }
+
+                       $location_data = array();
+
+                       $location_data = 
$this->bolocation->initiate_ui_location(array(
                                                'values'                => 
$location,
                                                'type_id'               => 
count(explode('-',$location_code)),
                                                'no_link'               => 
false, // disable lookup links for location type less than type_id
@@ -548,92 +775,233 @@
                                                'query_link'            => true
                                                ));
 
-//_debug_array($location_data);
+                       $datatable['locdata'] = $location_data['location'];
 
+                       $datatable['rowactions']['action'] = array();
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
'document_id',
+                                               'source'        => 'document_id'
+                                       ),
+                               )
+                       );
 
-                       $data = array
+                       if($this->acl_read)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'view',
+                                                       'statustext'    => 
lang('view this entity'),
+                                                       'text'                  
=> lang('view'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'location_data'                                 
=> $location_data,
-                               'link_history'                                  
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.list_doc', 'cat_id'=> $this->cat_id)),
-                               'lang_history_statustext'                       
=> lang('search for history at this location'),
-                               'lang_select'                                   
=> lang('select'),
-                               'lookup_action'                                 
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uiworkorder.edit')),
-                               'lookup'                                        
=> $lookup,
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($document_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'type'                                          
=> $this->doc_type,
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the document belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'doc_type',
-                               'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->doc_type,'type' =>'document','order'=>'descr')),
+                                                                               
'menuaction'    => 'property.uidocument.view',
+                                                                               
'from'                  => 'list_doc'
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
+                       }
 
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'    => 
lang('edit this entity'),
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uidocument.edit',
+                                                                               
'from'                  => 'list_doc'
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
+                       }
 
-                               'lang_status_statustext'                        
=> lang('Select the status the document belongs to. To do not use a category 
select NO STATUS'),
-                               'status_name'                                   
=> 'status_id',
-                               'lang_no_status'                                
=> lang('No status'),
-                               'status_list'                                   
=> $this->bo->select_status_list('filter',$this->status_id),
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'delete',
+                                                       'statustext'    => 
lang('delete this entity'),
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uidocument.delete',
+                                                                               
'location_code' => $location_code,
+                                                                               
'p_num'         => $p_num
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
+                       }
 
-                               'lang_user_statustext'                          
=> lang('Select the user the document belongs to. To do not use a category 
select NO USER'),
-                               'select_user_name'                              
=> 'filter',
-                               'lang_no_user'                                  
=> lang('No user'),
-                               'user_list'                                     
=> 
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl_location,array('all'),$default=$this->account),
-
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_document'                         
=> $table_header,
-                               'values_document'                               
=> $content,
-                               'table_add'                                     
=> $table_add,
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uidocument.index', 'preserve'=> 1)),
-                               'lang_done'                                     
=> lang('done'),
-                               'lang_done_statustext'                          
=> lang('Back to the list')
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add an entity'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uidocument.edit',
+                                                                               
'from'                  => 'list_doc',
+                                                                               
'location_code' => $location_code,
+                                                                               
'p_entity_id'   => $this->entity_id,
+                                                                               
'p_cat_id'              => $this->cat_id,
+                                                                               
'p_num'                 => $p_num
+                                                                       ))
                        );
+                       }
 
+                       unset($parameters);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       if($uicols['name'][$i]=='document_name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'document_name';
+                                       }
+
+                                       if($uicols['name'][$i]=='document_id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']          = false;
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($document_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
                        $appname        = lang('document');
                        $function_msg   = lang('list document');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg . ' - ' . 
$appname_sub;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_document' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'document_name'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                }
 
-               function view_file()
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                {
-                       if(!$this->acl_read)
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
                        }
 
-                       $document_id            = phpgw::get_var('id', 'int');
-                       $p_num = phpgw::get_var('p_num');
+                       // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                       $values = $this->bo->read_single($document_id);
+                               $json ['toolbar_height'] = 40;
+                               if(isset($location_data) && 
is_array($location_data))
+                               {
+                                       $json ['toolbar_height'] = $json 
['toolbar_height'] + (count($datatable['locdata']) * 10);
+                                       $json ['current_consult'] = 
$datatable['locdata'];
+                               }
+_debug_array($datatable['locdata']);                           
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
 
-                       $bofiles        = CreateObject('property.bofiles');
-                       if($this->cat_id)
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
                        {
-                               $entity = 
$this->boadmin_entity->read_single($this->entity_id,false);
-                               $category = 
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
-                               $file   = 
"{$bofiles->fakebase}/document/{$values['location_data']['loc1']}/entity_{$this->entity_id}_{$this->cat_id}/{$p_num}/{$values['document_name']}";
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
                        }
-                       else
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'document.list_doc', 'property' );
+
+               }
+
+               function view_file()
+               {
+                       if(!$this->acl_read)
                        {
-                               $file   = 
"{$bofiles->fakebase}/document/{$values['location_data']['loc1']}/{$values['document_name']}";
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $bofiles->view_file('', $file);
+                       $document_id    = phpgw::get_var('id', 'int');
+
+                       $file                   = 
$this->bo->get_file($document_id);
+
+                       $this->bofiles->view_file('', $file);
                }
 
                function edit()
@@ -689,18 +1057,18 @@
 
                                if($location_code)
                                {
-                                       $values['location_data'] = 
$this->bolocation->read_single($location_code,array());
+                                       $values['location_data'] = 
$this->bolocation->read_single($location_code,array('view' => true));
                                }
                        }
 
-//_debug_array($values);
                        if($values[extra]['p_entity_id'])
                        {
-                               $this->entity_id=$values[extra]['p_entity_id'];
-                               $this->cat_id=$values[extra]['p_cat_id'];
+                               
$this->entity_id=$values['extra']['p_entity_id'];
+                               $this->cat_id=$values['extra']['p_cat_id'];
                                $p_num=$values['extra']['p_num'];
                        }
 
+/*
                        if($this->cat_id)
                        {
                                $entity = 
$this->boadmin_entity->read_single($this->entity_id,false);
@@ -708,7 +1076,7 @@
                                $values['entity_name']=$entity['name'];
                                $values['category_name']=$category['name'];
                        }
-
+*/
                        if ($values['save'])
                        {
                                $values['vendor_id']            = 
phpgw::get_var('vendor_id', 'int', 'POST');
@@ -738,18 +1106,20 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
                                }
 
-                               $bofiles        = 
CreateObject('property.bofiles');
+                               $values['location_code'] = 
isset($values['location_code']) && $values['location_code'] ? 
$values['location_code'] : implode('-',$values['location']);
 
-                               $document_dir = 'document/' . 
$values['location']['loc1'];
+                               $document_dir = 
"document/{$values['location_code']}";
 
                                if($values['extra']['p_num'])
                                {
-                                       $document_dir .= 
"/entity_{$this->entity_id}_{$this->cat_id}/{$values['extra']['p_num']}";
+                                       $document_dir = 
"document/entity_{$this->entity_id}_{$this->cat_id}/{$values['extra']['p_num']}";
                                }
 
-                               $to_file        = 
"{$bofiles->fakebase}/{$document_dir}/{$values['document_name']}";
+                               $document_dir .= "/{$values['doc_type']}";
 
-                               if((!isset($values['document_name_orig']) || 
!$values['document_name_orig']) && $bofiles->vfs->file_exists(array(
+                               $to_file        = 
"{$this->bofiles->fakebase}/{$document_dir}/{$values['document_name']}";
+
+                               if((!isset($values['document_name_orig']) || 
!$values['document_name_orig']) && $this->bofiles->vfs->file_exists(array(
                                                'string' => $to_file,
                                                'relatives' => 
Array(RELATIVE_NONE)
                                        )))
@@ -757,9 +1127,29 @@
                                        
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
                                }
 
-                               $receipt2 = 
$bofiles->create_document_dir($document_dir);
-                               $receipt = array_merge($receipt, $receipt2);
-                               unset($receipt2);
+                               if(!$receipt['error'])
+                               {
+                                       $receipt = 
$this->bofiles->create_document_dir($document_dir);
+                                       if(isset($values['document_name_orig']) 
&& $values['document_name_orig'] && (!isset($values['document_name']) || 
!$values['document_name']))
+                                       {
+                                               $old_file       = 
$this->bo->get_file($document_id);
+                                               
+                                               $to_file .= 
$values['document_name_orig'];
+                                               
+                                               if($old_file != $to_file)
+                                               {
+                                                       
$this->bofiles->vfs->override_acl = 1;
+                                                       
if(!$this->bofiles->vfs->mv (array (
+                                                               'from'          
=> $old_file,
+                                                               'to'            
=> $to_file,
+                                                               'relatives'     
=> array (RELATIVE_ALL, RELATIVE_ALL))))
+                                                       {
+                                                               
$receipt['error'][]=array('msg'=>lang('Failed to move file !'));
+                                                       }
+                                                       
$this->bofiles->vfs->override_acl = 0;
+                                               }
+                                       }
+                               }
 
                                $values['document_id'] = $document_id;
 
@@ -767,16 +1157,16 @@
                                {
                                        if($values['document_name'] && 
!$values['link'])
                                        {
-                                               $bofiles->vfs->override_acl = 1;
+                                               
$this->bofiles->vfs->override_acl = 1;
 
-                                               if(!$bofiles->vfs->cp (array (
+                                               if(!$this->bofiles->vfs->cp 
(array (
                                                        'from'          => 
$_FILES['document_file']['tmp_name'],
                                                        'to'            => 
$to_file,
                                                        'relatives'     => 
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
                                                }
-                                               $bofiles->vfs->override_acl = 0;
+                                               
$this->bofiles->vfs->override_acl = 0;
                                        }
 
                                        if(!$receipt['error'])
@@ -792,9 +1182,9 @@
                                        $values['document_name']='';
                                        if($values['location'])
                                        {
-                                               $location_code=implode("-", 
$values['location']);
+               //                              $location_code=implode("-", 
$values['location']);
                                                $values['extra']['view'] = true;
-                                               $values['location_data'] = 
$this->bolocation->read_single($location_code,$values['extra']);
+                                               $values['location_data'] = 
$this->bolocation->read_single($values['location_code'],$values['extra']);
                                        }
                                        if($values['extra']['p_num'])
                                        {
@@ -869,8 +1259,36 @@
                        $jscal = CreateObject('phpgwapi.jscalendar');
                        $jscal->add_listener('values_document_date');
 
+                       //data test     $record_history = 
array(array(value_date=>"1111",value_user=>"22222",value_action=>"33333",value_new_value=>"44444444"));
+                       
+//----datatable settings------------------------------------
+
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($record_history),
+                                       'total_records'                 => 
count($record_history),
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );      
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array(key => value_date,        label=>lang('Date'),    
sortable=>true,resizeable=>true),
+                                                                               
                array(key => value_user,        label=>lang('User'),    
sortable=>true,resizeable=>true),
+                                                                               
                array(key => value_action,      label=>lang('Action'),  
sortable=>true,resizeable=>true),
+                                                                               
        array(key => value_new_value,label=>lang('New 
value'),sortable=>true,resizeable=>true)))
+                       );      
+                       
+//-----------------------------------------datatable settings-----
+
                        $data = array
                        (
+                               'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
        => $datavalues,
+                               'myColumnDefs'                                  
=> $myColumnDefs,       
+                                                                       
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'vendor_data'                                   
=> $vendor_data,
                                'record_history'                                
=> $record_history,
@@ -928,10 +1346,8 @@
                                'value_descr'                                   
=> $values['descr'],
                                'lang_no_cat'                                   
=> lang('Select category'),
                                'lang_cat_statustext'                           
=> lang('Select the category the document belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'values[doc_type]',
                                'value_cat_id'                                  
=> $values['doc_type'],
-                               'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'select','selected' => 
$values['doc_type'],'type' =>'document','order'=>'descr')),
-
+                               'cat_select'                                    
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[doc_type]','selected' => $values['doc_type'])),
                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_user_statustext'                          
=> lang('Select the coordinator the document belongs to. To do not use a 
category select NO USER'),
                                'select_user_name'                              
=> 'values[coordinator]',
@@ -951,7 +1367,25 @@
                                'lang_branch'                                   
=> lang('branch'),
                                'lang_branch_statustext'                        
=> lang('Select the branch for this document')
                        );
+                       //----datatable 
settings------------------------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
                        
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'document.view', 'property' );
+                       //--------------------------------datatable 
settings--------
+
                        $appname                = lang('document');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
@@ -978,10 +1412,10 @@
                                'p_num'         => $p_num
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
                                $this->bo->delete($document_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               return "document_id ".$document_id." 
".lang("has been deleted");
                        }
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
@@ -1063,6 +1497,8 @@
                                'document_id'   => $document_id
                        );
 
+                       $categories = 
$this->cats->formatted_xslt_list(array('selected' => $values['doc_type']));
+
                        $data = array
                        (
                                'vendor_data'                                   
=> $vendor_data,
@@ -1109,13 +1545,9 @@
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                          
=> lang('Back to the list'),
-                               'lang_save_statustext'                          
=> lang('Save the document'),
-                               'lang_no_cat'                                   
=> lang('Select category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the document belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'values[doc_type]',
-                               'value_cat_id'                                  
=> $values['doc_type'],
-                               'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'select','selected' => 
$values['doc_type'],'type' =>'document','order'=>'descr')),
 
+                               'cat_list'                                      
        => $categories['cat_list'],
+
                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_user_statustext'                          
=> lang('Select the coordinator the document belongs to. To do not use a 
category select NO USER'),
                                'select_user_name'                              
=> 'values[coordinator]',

Modified: people/sigurdne/modules/property/trunk/inc/class.uientity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uientity.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uientity.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,13 +24,14 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage entity
-       * @version $Id$
+        * @version $Id$
        */
 
        /**
         * Description
         * @package property
         */
+       phpgw::import_class('phpgwapi.yui');
 
        class property_uientity
        {
@@ -49,43 +50,31 @@
                (
                        'columns'               => true,
                        'download'      => true,
-                       'index'                 => true,
+                       'index_old'                     => true,
                        'view'                  => true,
                        'edit'                  => true,
                        'delete'                => true,
                        'view_file'             => true,
                        'attrib_history'=> true,
                        'attrib_help'   => true,
-                       'print_pdf'             => true
+                       'print_pdf'             => true,
+                       'select2String'         => true,
+                       'index'         => true
                );
 
                function property_uientity()
                {
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; // 
menus added where needed via bocommon::get_menu
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
+
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo                               = 
CreateObject('property.boentity',true);
-                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->bocommon                         = & 
$this->bo->bocommon;
+                       $this->soadmin_entity           = & 
$this->bo->soadmin_entity;
 
-                       $this->boadmin_entity                   = 
CreateObject('property.boadmin_entity',true);
-
                        $this->entity_id                        = 
$this->bo->entity_id;
                        $this->cat_id                           = 
$this->bo->cat_id;
-                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
-                       if(!$this->cat_id)
-                       {
-                               $this->acl_location             = '.entity.' . 
$this->entity_id;
-                       }
-                       else
-                       {
-                               $this->acl_location             = '.entity.' . 
$this->entity_id . '.' . $this->cat_id;
-                       }
-                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
-                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
-                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
-                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
 
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
@@ -95,13 +84,27 @@
                        $this->part_of_town_id                  = 
$this->bo->part_of_town_id;
                        $this->district_id                      = 
$this->bo->district_id;
                        $this->status                           = 
$this->bo->status;
+                       $this->location_code            = 
$this->bo->location_code;
                        $this->category_dir                     = 
$this->bo->category_dir;
                        
$GLOBALS['phpgw']->session->appsession('entity_id','property',$this->entity_id);
                        $this->start_date                       = 
$this->bo->start_date;
                        $this->end_date                         = 
$this->bo->end_date;
                        $this->allrows                          = 
$this->bo->allrows;
+                       $this->type                                     = 
$this->bo->type;
+                       $this->type_app                         = 
$this->bo->type_app;
+                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
 
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"property::entity_{$this->entity_id}";
+                       $this->acl_location                     = 
".{$this->type}.$this->entity_id";
+                       if( $this->cat_id )
+                       {
+                               $this->acl_location             .= 
".{$this->cat_id}";
+                       }
+                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 
$this->type_app[$this->type]);
+                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 
$this->type_app[$this->type]);
+                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 
$this->type_app[$this->type]);
+                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 
$this->type_app[$this->type]);
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"{$this->type_app[$this->type]}::entity_{$this->entity_id}";
                        if($this->cat_id > 0)
                        {
                                 
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::entity_{$this->entity_id}_{$this->cat_id}";
@@ -140,7 +143,7 @@
                        $start_date     = urldecode($this->start_date);
                        $end_date       = urldecode($this->end_date);
 
-                       $list = 
$this->bo->read(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'allrows'=>true,'start_date'=>$start_date,'end_date'=>$end_date));
+                       $list = 
$this->bo->read(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'allrows'=>true,'start_date'=>$start_date,'end_date'=>$end_date,
 'type' => $this->type));
                        $uicols = $this->bo->uicols;
 
                        
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
@@ -149,6 +152,8 @@
 
                function columns()
                {
+               //cramirez: necesary for windows.open . Avoid error JS
+               phpgwapi_yui::load_widget('tabview');
                        $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
 
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
@@ -160,8 +165,8 @@
                        if (isset($values['save']) && $values['save'] && 
$this->cat_id)
                        {
                                
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-                               
$GLOBALS['phpgw']->preferences->read_repository();
-                               
$GLOBALS['phpgw']->preferences->add('property',"entity_columns_" . 
$this->entity_id . '_' . $this->cat_id,$values['columns'],'user');
+                               $GLOBALS['phpgw']->preferences->read();
+                               
$GLOBALS['phpgw']->preferences->add($this->type_app[$this->type],"entity_columns_"
 . $this->entity_id . '_' . $this->cat_id,$values['columns'],'user');
                                
$GLOBALS['phpgw']->preferences->save_repository();
 
                                $receipt['message'][] = array('msg' => 
lang('columns is updated'));
@@ -177,7 +182,8 @@
                        (
                                'menuaction'    => 'property.uientity.columns',
                                'entity_id'     => $this->entity_id,
-                               'cat_id'        => $this->cat_id
+                               'cat_id'                => $this->cat_id,
+                               'type'                  => $this->type
                        );
 
 
@@ -196,7 +202,6 @@
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
$function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
                function view_file()
@@ -207,321 +212,651 @@
                        }
 
                        $file_name      = 
urldecode(phpgw::get_var('file_name'));
-                       $loc1           = phpgw::get_var('loc1');
+                       $loc1           = phpgw::get_var('loc1', 'string', 
'REQUEST', 'dummy');
+                       if($this->type_app[$this->type] == 'catch')
+                       {
+                               $loc1 = 'dummy';
+                       }
                        $id             = phpgw::get_var('id', 'int');
+                       $jasper         = phpgw::get_var('jasper', 'bool');
 
                        $bofiles        = CreateObject('property.bofiles');
-                       $bofiles->view_file("{$this->category_dir}/{$loc1}");
+                       $bofiles->view_file("{$this->category_dir}/{$loc1}", 
'', $jasper);
                }
 
                function index()
                {
+                       $dry_run = false;
+
+                       //redirect. If selected the title of module.
+                       if($this->entity_id == 1 && !$this->cat_id)
+                       {
+                                 
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uientity.index', 'entity_id'=>1, 'cat_id'=> 1, 'type' => 
$this->type));
+                       }
+                       elseif($this->entity_id == 2 && !$this->cat_id)
+                       {
+                                 
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uientity.index', 'entity_id'=>2, 'cat_id'=> 1, 'type' => 
$this->type));
+                       }
+
+                       //redirect if no rights
                        if(!$this->acl_read && $this->cat_id)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('entity',
-                                                                       
'nextmatchs'));
-
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','entity_receipt_' . 
$this->entity_id . '_' . $this->cat_id);
-                       
$GLOBALS['phpgw']->session->appsession('session_data','entity_receipt_' . 
$this->entity_id . '_' . $this->cat_id,'');
-
                        $start_date     = urldecode($this->start_date);
                        $end_date       = urldecode($this->end_date);
 
-                       $entity_list = 
$this->bo->read(array('start_date'=>$start_date,'end_date'=>$end_date));
+                       //Preferencias sets
+                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'] 
== 'yes')
+                       {
+                               $group_filters = 'select';
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
+                       }
+                       else
+                       {
+                               $group_filters = 'filter';
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
+                       }
 
-                       $uicols = $this->bo->uicols;
+                       $datatable = array();
+                       $values_combo_box = array();
 
-                       $j=0;
+                       //      enters the first time
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
                =       $this->bocommon->get_menu($this->type_app[$this->type]);
 
-                       $content = array();
-                       if (isset($entity_list) AND is_array($entity_list))
-                       {
-                               foreach($entity_list as $entity_entry)
+                               $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                                                               
                                (
+                                                                               
                                        'menuaction'                    => 
'property.uientity.index',
+                                                                               
                                        'entity_id'                     => 
$this->entity_id,
+                                                                               
                                                'cat_id'                => 
$this->cat_id,
+                                                                               
                        'district_id'           => $this->district_id,
+                                                                               
                        'status'                        => $this->status,
+                                                                               
                        'filter'                        => $this->filter,
+                                                                               
                        'query'                         => $this->query,
+                                                                               
                        'type'                                  => $this->type,
+                                                                               
                        'location_code'                 => $this->location_code
+                                                                               
                    ));
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url']   =       
"menuaction:'property.uientity.index',".
+                                                                               
                                        "entity_id:'{$this->entity_id}',".
+                                                                               
                                        "cat_id:'{$this->cat_id}',".
+                                                                               
                                        "district_id:'{$this->district_id}',".
+                                                                               
                                        "status:'{$this->status}',".
+                                                                               
                                        "filter:'{$this->filter}',".
+                                                                               
                                        "query:'{$this->query}',".
+                                                                               
                                        "type:'{$this->type}',".
+                                                                               
                                        
"location_code:'{$this->location_code}'";
+
+                               // this array "$arr_filter_hide" indicate what 
filters are hidden or not
+                               $arr_filter_hide = array();
+
+                               ////// ---- CATEGORY 
filter----------------------
+/*                             $values_combo_box[0]  = 
$this->bo->select_category_list($group_filters,$this->cat_id);
+                               if(count($values_combo_box[0]))
                                {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       $default_value = array 
('id'=>'','name'=> lang('no category'));
+                                       array_unshift 
($values_combo_box[0],$default_value);
+                                       $arr_filter_hide[0] = 1;
+                               }
+                               else
+                               {
+                                       $arr_filter_hide[0] = 1;
+                               }
+*/
+                               //// ---- DISTRICT filter----------------------
+                               if($this->cat_id)
                                        {
-                                               
if($uicols['input_type'][$i]!='hidden')
+                                       $category = 
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+                                       //this validation comes to previous 
versions
+                                       if (isset($category['location_level']) 
&& $category['location_level']>0)
                                                {
-                                                       
if(isset($entity_entry['query_location'][$uicols['name'][$i]]) && 
$entity_entry['query_location'][$uicols['name'][$i]])
+                                               $values_combo_box[1]    = 
$this->bocommon->select_district_list($group_filters,$this->district_id);
+                                               if(count($values_combo_box[1]))
                                                        {
-                                                               
$content[$j]['row'][$i]['statustext']           = lang('search');
-                                                               
$content[$j]['row'][$i]['text']                 = 
$entity_entry[$uicols['name'][$i]];
-                                                               
$content[$j]['row'][$i]['link']                 = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id, 'query'=> $entity_entry['query_location'][$uicols['name'][$i]]));
+                                                       $default_value = array 
('id'=>'','name'=>lang('no district'));
+                                                       array_unshift 
($values_combo_box[1],$default_value);
+                                                       $arr_filter_hide[1] = 0;
                                                        }
                                                        else
                                                        {
-                                                               
$content[$j]['row'][$i]['value']                = 
$entity_entry[$uicols['name'][$i]];
-                                                               
$content[$j]['row'][$i]['name']                 = $uicols['name'][$i];
-                                                               
if(isset($uicols['datatype'][$i]) && $uicols['datatype'][$i]=='link' && 
$entity_entry[$uicols['name'][$i]])
-                                                               {
-                                                                       
$content[$j]['row'][$i]['text']         = lang('link');
-                                                                       
$content[$j]['row'][$i]['link']         = $entity_entry[$uicols['name'][$i]];
-                                                                       
$content[$j]['row'][$i]['target']       = '_blank';
-
+                                                       $arr_filter_hide[1] = 1;
                                                                }
                                                        }
+                                       else
+                                       {
+                                               $values_combo_box[1] = array();
+                                               $arr_filter_hide[1] = 1;
                                                }
                                        }
+                               //// ---- STATUS filter----------------------
+                               $values_combo_box[2]  = 
$this->bo->select_status_list($group_filters,$this->status);
 
-                                       if($this->acl_read)
+                               if(count($values_combo_box[2]))
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                           = lang('view 
the entity');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('view');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.view', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id, 'id'=> $entity_entry['id']));
+                                       $default_value = array 
('id'=>'','name'=>lang('no status'));
+                                       array_unshift 
($values_combo_box[2],$default_value);
+                                       $arr_filter_hide[2] = 0;
                                        }
-                                       if($this->acl_edit)
+                               else
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                           = lang('edit 
the entity');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('edit');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.edit', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id, 'id'=> $entity_entry['id']));
+                                       $arr_filter_hide[2] = 1;
                                        }
-                                       if($this->acl_delete)
-                                       {
-                                               
$content[$j]['row'][$i]['statustext']                           = lang('delete 
the entity');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('delete');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.delete', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id, 'id'=> $entity_entry['id']));
-                                       }
 
-                                       $j++;
-                               }
-                       }
 
-                       for ($i=0;$i<count($uicols['descr']);$i++)
-                       {
-                               if($uicols['input_type'][$i]!='hidden')
+                               //// ---- USER filter----------------------
+                               $values_combo_box[3]  = 
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl_location,array('all'),$default='all');
+
+                               if(count($values_combo_box[3]))
                                {
-                                       $table_header[$i]['header']             
= $uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if(!isset($uicols['datatype'][$i]) || 
($uicols['datatype'][$i]!='T' && $uicols['datatype'][$i]!='CH'))
+                                       $default_value = array 
('id'=>'','name'=>lang('no user'));
+                                       array_unshift 
($values_combo_box[3],$default_value);
+                                       $arr_filter_hide[3] = 0;
+                               }
+                               else
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                       (
-                                                               'sort'  => 
$this->sort,
-                                                               'var'   => 
$uicols['name'][$i],
-                                                               'order' => 
$this->order,
-                                                               'extra' => 
array('menuaction'   => 'property.uientity.index',
-               //                                                              
        'type_id'       => $type_id,
-                                                                               
        'query'         => $this->query,
-                                                                               
        'lookup'        => isset($lookup)?$lookup:'',
+                                       $arr_filter_hide[3] = 1;
+                               }
+
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                               'action'  => 
$GLOBALS['phpgw']->link('/index.php',
+                                                                               
array(
+                                                                               
                'menuaction'    => 'property.uientity.index',
+                                                                               
                'entity_id'             => $this->entity_id,
+                                                                               
                'cat_id'                => $this->cat_id,
                                                                                
        'district_id'   => $this->district_id,
+                                                                               
                'status'                => $this->status,
+                                                                               
                'filter'                => $this->filter,
+                                                                               
                'query'                 => $this->query,
+                                                                               
                'type'                  => $this->type
+                                                                               
          )),
+                                               'fields'  => array(
+                                                         'field' => array(
+                                                                               
/*              array( //boton  CATEGORY
+                                                                               
                        'id'   => 'btn_cat_id',
+                                                                               
                        'name' => 'cat_id',
+                                                                               
                        'value'=> lang('Category'),
+                                                                               
                        'type' => 'button',
+                                                                               
                        'style' => 'filter',
+                                                                               
                        'tab_index' => 1
+                                                                               
                ),*/
+                                                                               
                array( //boton  DISTINT
+                                                                               
                        'id'   => 'btn_district_id',
+                                                                               
                        'name' => 'district_id',
+                                                                               
                        'value'=> lang('District'),
+                                                                               
                        'type' => 'button',
+                                                                               
                        'style' => 'filter',
+                                                                               
                        'tab_index' => 2
+                                                                               
                ),
+                                                                               
                array( //boton  STATUS
+                                                                               
                        'id'   => 'btn_status_id',
+                                                                               
                        'name' => 'status_id',
+                                                                               
                        'value'=> lang('Status'),
+                                                                               
                        'type' => 'button',
+                                                                               
                        'style' => 'filter',
+                                                                               
                        'tab_index' => 3
+                                                                               
                ),
+                                                                               
                array( //boton  USER
+                                                                               
                        'id'   => 'btn_user_id',
+                                                                               
                        'name' => 'user_id',
+                                                                               
                        'value'=> lang('User'),
+                                                                               
                        'type' => 'button',
+                                                                               
                        'style' => 'filter',
+                                                                               
                        'tab_index' => 4
+                                                                               
                ),
+                                                                               
                array(//for link "columns", next to Export button
+                                                                               
                        'type'=> 'link',
+                                                                               
                        'id'  => 'btn_columns',
+                                                                               
                        'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                                   array(
+                                                                               
                                                'menuaction'    => 
'property.uientity.columns',
                                                                                
        'entity_id'     => $this->entity_id,
                                                                                
        'cat_id'        => $this->cat_id,
-                                                                               
        'start_date'    => $start_date,
-                                                                               
        'end_date'      => $end_date)
-                                                       ));
+                                                                               
                                                'type'                  => 
$this->type
+                                                                               
                                          
))."','link','width=300,height=600,scrollbars=1')",
+                                                                               
                         'value' => lang('columns'),
+                                                                               
                         'tab_index' => 10
+                                                                               
                ),
+                                                                               
                array(
+                                                                               
                        'type' => 'button',
+                                                                               
                        'id'   => 'btn_export',
+                                                                               
                        'value'=> lang('download'),
+                                                                               
                        'tab_index' => 9
+                                                                               
                        ),
+                                                                               
                array(
+                                                                               
                        'type' => 'button',
+                                                                               
                        'id'   => 'btn_new',
+                                                                               
                        'value'=> lang('add'),
+                                                                               
                        'tab_index' => 8
+                                                                               
                        ),
+                                                                               
                array( //boton   SEARCH
+                                                                               
                        'id'   => 'btn_search',
+                                                                               
                        'name' => 'search',
+                                                                               
                        'value'=> lang('search'),
+                                                                               
                        'type' => 'button',
+                                                                               
                        'tab_index' => 7
+                                                                               
                ),
+                                                                               
                array( // TEXT IMPUT
+                                                                               
                        'name' => 'query',
+                                                                               
                        'id'   => 'txt_query',
+                                                                               
                        'value'=> '',//$query,
+                                                                               
                        'type' => 'text',
+                                                                               
                        'size' => 28,
+                                                                               
                        'onkeypress' => 'return pulsar(event)',
+                                                                               
                        'tab_index' => 6
+                                                                               
                ),
+                                                                               
                 array(//for link "None",
+                                                                               
                  'type'=> 'label_date'
+                                                                               
                 ),
+                                                                               
                 array( //hidden end_date
+                                                                               
                        'type'  => 'hidden',
+                                                                               
                        'id'    => 'end_date',
+                                                                               
                        'name'  => 'end_date',
+                                                                               
                        'value' => $end_date
+                                                                               
                 ),
+                                                                               
                array( //hidden start_date
+                                                                               
                        'type'  => 'hidden',
+                                                                               
                        'id'    => 'start_date',
+                                                                               
                        'name'  => 'start_date',
+                                                                               
                        'value' => $start_date
+                                                                               
                 ),
+                                                                               
                array(//for link "Date search",
+                                                                               
                        'type'=> 'link',
+                                                                               
                        'id'  => 'btn_data_search',
+                                                                               
                        'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                                   array(
+                                                                               
                                                        'menuaction' => 
'property.uiproject.date_search'))."','link','width=350,height=250')",
+                                                                               
                         'value' => lang('Date search'),
+                                                                               
                         'tab_index' => 5
+                                                                               
                 )),
+                                                               'hidden_value' 
=> array(
+                                                                               
                        array(
+                                                                               
                                'id'   => 'values_combo_box_0',
+                                                                               
                                'value'=> 
$this->bocommon->select2String($values_combo_box[0])
+                                                                               
                                  ),
+                                                                               
                        array(
+                                                                               
                                'id'    => 'values_combo_box_1',
+                                                                               
                                'value' => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
                                  ),
+                                                                               
                         array(
+                                                                               
                                'id' => 'values_combo_box_2',
+                                                                               
                                'value' => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
                                  ),
+                                                                               
                         array(
+                                                                               
                                'id' => 'values_combo_box_3',
+                                                                               
                                'value' => 
$this->bocommon->select2String($values_combo_box[3])
+                                                                               
                                  ))
+                                                )));
+
+                                       //      eliminates those empty filters
+                                       $eliminate = 0;
+                                       foreach( $arr_filter_hide as $key => 
$value )
+                                       {
+                                               if ($value)
+                                               {
+                                                       //eliminates the 
respective entry in $datatable..['field']
+                                                       
array_splice($datatable['actions']['form'][0]['fields']['field'],$eliminate, 1);
                                        }
+                                               else
+                                               {
+                                                       $eliminate++;
                                }
                        }
 
-                       if($this->acl_read)
+                               //cramirez: $dry_run is use "$this->bo->read"
+                               $dry_run=true;
+                               // sets for initial ordering
+                               $this->sort = "ASC";
+                               $this->order = "num";
+                       }
+
+                       $entity_list = array();
+                       //cramirez: $dry_run avoid to load all data the first 
time
+                       $entity_list = 
$this->bo->read(array('start_date'=>$start_date,'end_date'=>$end_date,'dry_run' 
=>$dry_run));
+
+                       $uicols = $this->bo->uicols;
+
+                       $content = array();
+                       $j=0;
+                       if (isset($entity_list) && is_array($entity_list))
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
-                               $i++;
+                               foreach($entity_list as $entity_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       
if(isset($entity_entry['query_location'][$uicols['name'][$i]]))
+                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['statustext']               = 
lang('search');
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$entity_entry[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['java_link']                = true;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']                     = 
$entity_entry['query_location'][$uicols['name'][$i]];
                        }
-                       if($this->acl_edit)
+                                                       else
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('edit');
-                               $i++;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$entity_entry[$uicols['name'][$i]];
+                                                               
//$datatable['rows']['row'][$j]['column'][$i]['value']                  = $i;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
//$datatable['rows']['row'][$j]['column'][$i]['lookup']                         
= $lookup;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+
+                                                               
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $entity_entry[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']           = 'link';
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']            = lang('link');
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']                     = 
$entity_entry[$uicols['name'][$i]];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']      = '_blank';
                        }
-                       if($this->acl_delete)
+                                                       }
+                                               }
+                                               else
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('delete');
-                               $i++;
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$entity_entry[$uicols['name'][$i]];
+                                               }
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                            
= $entity_entry[$uicols['name'][$i]];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                             
        = $uicols['name'][$i];
+                                       }
+
+                                       $j++;
+                               }
                        }
 
+                       //indica que de la fila seleccionada escogera de la 
columna "id" el valor "id". Para agregarlo al URL
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                               array
+                                               (
+                                                               'name'          
=> 'id',
+                                                               'source'        
=> 'id'
+                                               ),
+                               )
+                       );
 
-                       if($this->acl_add)
+                       if($this->acl_read)
                        {
-                               $table_add[] = array
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'               => 
'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                                (
+                                                                               
                                                'menuaction'    => 
'property.uientity.view',
+                                                                               
                                                'entity_id'             => 
$this->entity_id,
+                                                                               
                                                'cat_id'                => 
$this->cat_id,
+                                                                               
                                                'type'                  => 
$this->type
+                                                                               
                                )),
+                                               'parameters'                    
=> $parameters
+                               );
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'               => 
'view',
+                                               'text'                  => 
lang('open view in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
entity'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.edit', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id))
+                                                                               
                                                'menuaction'    => 
'property.uientity.view',
+                                                                               
                                                'entity_id'             => 
$this->entity_id,
+                                                                               
                                                'cat_id'                => 
$this->cat_id,
+                                                                               
                                                'type'                  => 
$this->type,
+                                                                               
                                                'target'                => 
'_blank'
+                                                                               
                                )),
+                                               'parameters'                    
=> $parameters
                                );
                        }
-
-                       $link_data = array
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 'property.uientity.index',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
+                                                                               
                                                'menuaction'    => 
'property.uientity.edit',
+                                                                               
                                                'entity_id'             => 
$this->entity_id,
                                'cat_id'        => $this->cat_id,
+                                                                               
                                                'type'                  => 
$this->type
+                                                                               
                                )),
+                                               'parameters'                    
=> $parameters
+                               );
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('open edit in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                                (
+                                                                               
                                                'menuaction'    => 
'property.uientity.edit',
                                'entity_id'     => $this->entity_id,
-                               'district_id'   => $this->district_id,
-                               'filter'        => $this->filter,
-                               'query'         => $this->query,
-                               'start_date'    => $start_date,
-                               'end_date'      => $end_date
+                                                                               
                                                'cat_id'                => 
$this->cat_id,
+                                                                               
                                                'type'                  => 
$this->type,
+                                                                               
                                                'target'                => 
'_blank'
+                                                                               
                                )),
+                                               'parameters'                    
=> $parameters
                        );
-
-                       $link_download = array
+                       }
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'               => 
'delete',
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 'property.uientity.download',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
+                                                                               
                                                'menuaction'    => 
'property.uientity.delete',
                                'entity_id'     => $this->entity_id,
                                'cat_id'        => $this->cat_id,
-                               'district_id'   => $this->district_id,
-                               'status_id'     => $this->status,
-                               'filter'        => $this->filter,
-                               'query'         => $this->query,
-                               'start_date'    => $start_date,
-                               'end_date'      => $end_date,
-                               'start'         => $this->start
+                                                                               
                                                'type'                  => 
$this->type
+                                                                               
                                )),
+                                               'parameters'    => $parameters
                        );
-
-                       $link_columns = array
+                       }
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'               => 
'add',
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 'property.uientity.columns',
-                               'entity_id'     =>$this->entity_id,
-                               'cat_id'        =>$this->cat_id
+                                                                               
                                                'menuaction'    => 
'property.uientity.edit',
+                                                                               
                                                'entity_id'             => 
$this->entity_id,
+                                                                               
                                                'cat_id'                => 
$this->cat_id,
+                                                                               
                                                'type'                  => 
$this->type
+                                                                               
                                ))
                        );
+                       }
 
-                       $link_date_search       = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uiproject.date_search'));
+                       unset($parameters);
 
-                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
+                       $uicols_count   = count($uicols['descr']);
+
+                       //Columns Order
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
-                               $group_filters = 'select';
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                               
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                               
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                               
$datatable['headers']['header'][$i]['visible']                  = true;
+                                               
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+                                               
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                               
//$datatable['headers']['header'][$i]['formatter']              = 
$uicols['formatter'][$i];
+                                               //according to stable bruch 
this columns is not SORTABLE'
+                                               $denied = 
array('merknad');//$denied = array('merknad','account_lid');
+                                               //if not include
+                                               if(!in_array 
($uicols['name'][$i], $denied))
+                                               {
+                                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                        }
-                       else
+                                               else 
if(isset($uicols['cols_return_extra'][$i]) && 
($uicols['cols_return_extra'][$i]!='T' || 
$uicols['cols_return_extra'][$i]!='CH'))
                        {
-                               $group_filters = 'filter';
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
+                                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                        }
 
-                       if(!$this->allrows)
-                       {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                                               
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                               
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                               
$datatable['headers']['header'][$i]['visible']                  = false;
+                                               
$datatable['headers']['header'][$i]['sortable']          = false;
+                                               
$datatable['headers']['header'][$i]['format']                   = 'hidden';
                        }
-
-                       if($this->entity_id)
-                       {
-                               $entity         = 
$this->boadmin_entity->read_single($this->entity_id,false);
-                               $appname        = $entity['name'];
                        }
 
-                       $district_list ='';
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       if($this->cat_id)
-                       {
-                               $category = 
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
-                               $function_msg   = 'list ' . $category['name'];
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                               if (isset($category['location_level']) && 
$category['location_level']>0)
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']    = 
count($entity_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // Column
+                       $datatable['sorting']['sort']   = 
phpgw::get_var('sort', 'string'); // ASC / DESC
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                                {
-                                       $district_list  = 
$this->bocommon->select_district_list($group_filters,$this->district_id);
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                                }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'group_filters'                         => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters']:'',
-                               'lang_download'                         => 
'download',
-                               'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                    => 
lang('Download table to your browser'),
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                       $appname = lang('entity');
 
-                               'lang_columns'                          => 
lang('columns'),
-                               'link_columns'                          => 
$GLOBALS['phpgw']->link('/index.php',$link_columns),
-                               'lang_columns_help'                     => 
lang('Choose columns'),
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
 
-                               'start_date'                            => 
$start_date,
-                               'end_date'                                      
=> $end_date,
-                               'lang_none'                                     
=> lang('None'),
-                               'lang_date_search'                      => 
lang('Date search'),
-                               'lang_date_search_help'         => lang('Narrow 
the search by dates'),
-                               'link_date_search'                      => 
$link_date_search,
-                               'lang_date_search'                      => 
lang('Date search'),
+//-BEGIN----------------------------- JSON CODE ------------------------------
 
-                               'allow_allrows'                         => true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($entity_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                               'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                               'records'                       => array()
+                       );
 
-                               'district_list'                         => 
$district_list,
-                               'lang_no_district'                      => 
lang('no district'),
-                               'lang_district_statustext'      => lang('Select 
the district the selection belongs to. To do not use a district select NO 
DISTRICT'),
-                               'select_district_name'          => 
'district_id',
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                       // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
+                       {
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                         
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>" 
.$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                       
$json_row[$column['name']] = $column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                               'lang_no_cat'                           => 
lang('no category'),
-                               'lang_cat_statustext'           => lang('Select 
the category. To do not use a category select NO CATEGORY'),
-                               'select_name'                           => 
'cat_id',
-                               'cat_list'                                      
=> $this->bo->select_category_list($group_filters,$this->cat_id),
+                       //---no exits depended filters
+                       $json['hidden']['dependent'][] = array ( );
 
-                               'lang_status_statustext'        => lang('Select 
the status. To do not use a status select NO STATUS'),
-                               'status_name'                           => 
'status',
-                               'lang_no_status'                        => 
lang('No status'),
-                               'status_list'                           => 
$this->bo->select_status_list($group_filters,$this->status),
+                       // checks right in datatable
+                       if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                       {
+                               $json ['rights'] = 
$datatable['rowactions']['action'];
+                       }
 
-                               'lang_user_statustext'          => lang('Select 
the user. To do not use a category select NO USER'),
-                               'select_user_name'                      => 
'filter',
-                               'lang_no_user'                          => 
lang('No user'),
+                       return $json;
+                       }
+//-END------------------- JSON CODE ----------------------
 
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                           => 
lang('search'),
-                               'table_header'                          => 
$table_header,
-                               'values'                                        
=> $content,
-                               'table_add'                                     
=> $table_add
-                       );
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
$template_vars);
 
-                       if(!$this->entity_id || !$this->cat_id)
+                       if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
                        {
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
-                               $receipt['error'][]=array('msg'=>lang('Please 
select type'));
-                               $msgbox_data = 
$this->bocommon->msgbox_data($receipt);
+                                       $GLOBALS['phpgw']->css = 
createObject('phpgwapi.css');
+                       }
 
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname;
-                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('empty' => $data));
-                       }
-                       else
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
+                       if($this->entity_id && $this->cat_id)
                        {
-                               $data['user_list']      = 
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl_location,array('all'),$default='all');
-                               
$GLOBALS['phpgw']->js->set_onload('document.search.query.focus();');
-                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-                               $this->save_sessiondata();
+                               $entity    = 
$this->soadmin_entity->read_single($this->entity_id,false);
+                               $appname          = $entity['name'];
+                               $category        = 
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+                               $function_msg = 'list ' . $category['name'];
+                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        }
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'entity.index', 'property' );
+
+                       //$this->save_sessiondata();
+                       //die(_debug_array($datatable));
                }
 
                function edit()
                {
+                       $id                             = phpgw::get_var('id', 
'int');
+
                        if(!$this->acl_add && !$this->acl_edit)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array(
+                                       'menuaction'    => 
'property.uientity.view', 'id'=> $id, 'entity_id'    => $this->entity_id,
+                                       'cat_id'                => 
$this->cat_id,
+                                       'type'                  => 
$this->type));
                        }
 
                //      $config         = 
CreateObject('phpgwapi.config','property');
                        $bolocation     = CreateObject('property.bolocation');
 
-                       $id                             = phpgw::get_var('id', 
'int');
                        $values                         = 
phpgw::get_var('values');
                        $values_attribute       = 
phpgw::get_var('values_attribute');
                        $bypass                         = 
phpgw::get_var('bypass', 'bool');
@@ -539,7 +874,7 @@
                        if($_POST && !$bypass)
                        {
                                $insert_record          = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
-                               $insert_record_entity   = 
$GLOBALS['phpgw']->session->appsession('insert_record_values' . 
$this->acl_location,'property');
+                               $insert_record_entity   = 
$GLOBALS['phpgw']->session->appsession('insert_record_values' . 
$this->acl_location,$this->type_app[$this->type]);
 
                                if(is_array($insert_record_entity))
                                {
@@ -568,14 +903,14 @@
 
                                if($p_entity_id && $p_cat_id)
                                {
-                                       $entity_category = 
$this->boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
+                                       $entity_category = 
$this->soadmin_entity->read_single_category($p_entity_id,$p_cat_id);
                                        
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
                                }
 
 
                                if($location_code)
                                {
-                                       $values['location_data'] = 
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+                                       $values['location_data'] = 
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num,
 'view' => true));
                                }
 
                        }
@@ -607,20 +942,25 @@
 
                        if($this->cat_id)
                        {
-                               $category = 
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+                               $category = 
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
                        }
                        else
                        {
-                               $cat_list = 
$this->bo->select_category_list('select',$this->cat_id);
+                               $cat_list = 
$this->bo->select_category_list('select');
                        }
 
                        if (isset($values['cancel']) && $values['cancel'])
                        {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id,'type' => $this->type));
                        }
 
                        if ((isset($values['save']) && $values['save']) || 
(isset($values['apply']) && $values['apply']))
                        {
+                               if($GLOBALS['phpgw']->session->is_repost())
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+                               }
+
                                if(!$values['location'] && 
isset($category['location_level']) && $category['location_level'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
@@ -632,12 +972,11 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select entity type !'));
                                        $error_id=true;
                                }
-
                                if(isset($values_attribute) && 
is_array($values_attribute))
                                {
                                        foreach ($values_attribute as 
$attribute )
                                        {
-                                               if($attribute['nullable'] != 1 
&& !$attribute['value'])
+                                               if($attribute['nullable'] != 1 
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
                                                }
@@ -649,57 +988,105 @@
                                        $values['id']=$id;
                                        $action='edit';
                                }
-                               else
-                               {
-                                       
$values['id']=$this->bo->generate_id(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));
-                               }
 
                                if(!isset($receipt['error']))
                                {
                                        $receipt = 
$this->bo->save($values,$values_attribute,$action,$this->entity_id,$this->cat_id);
-                                       $id = $values['id'];
+                                       $id = $receipt['id'];
                                        $function_msg = lang('edit entity');
 //--------------files
+                                       $loc1 = 
isset($values['location']['loc1']) && $values['location']['loc1'] ? 
$values['location']['loc1'] : 'dummy';
+                                       if($this->type_app[$this->type] == 
'catch')
+                                       {
+                                               $loc1 = 'dummy';
+                                       }
+
                                        $bofiles        = 
CreateObject('property.bofiles');
                                        if(isset($values['file_action']) && 
is_array($values['file_action']))
                                        {
-                                               
$bofiles->delete_file("/{$this->category_dir}/{$values['location']['loc1']}/{$id}/",
 $values);
+                                               
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/", $values);
                                        }
 
+                                       if(isset($values['file_jasperaction']) 
&& is_array($values['file_jasperaction']))
+                                       {
+                                               $values['file_action'] = 
$values['file_jasperaction'];
+                                               
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/", $values);
+                                       }
+
+                                       $files = array();
                                        if(isset($_FILES['file']['name']) && 
$_FILES['file']['name'])
                                        {
-                                               
$values['file_name']=str_replace (' ','_',$_FILES['file']['name']);
-                                               $to_file = 
"{$bofiles->fakebase}/{$this->category_dir}/{$values['location']['loc1']}/{$values['id']}/{$values['file_name']}";
+                                               $file_name = str_replace (' 
','_',$_FILES['file']['name']);
+                                               $to_file        = 
"{$bofiles->fakebase}/{$this->category_dir}/{$loc1}/{$id}/{$file_name}";
 
-                                               
if((!isset($values['document_name_orig']) || !$values['document_name_orig']) && 
$bofiles->vfs->file_exists(array(
+                                               if 
($bofiles->vfs->file_exists(array(
                                                                'string' => 
$to_file,
                                                                'relatives' => 
Array(RELATIVE_NONE)
                                                        )))
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
                                                }
+                                               else
+                                               {
+                                                       $files[] = array
+                                                       (
+                                                               'from_file'     
=> $_FILES['file']['tmp_name'],
+                                                               'to_file'       
=> $to_file
+                                                       );
+                                               }
+
+                                               unset($to_file);
+                                               unset($file_name);
                                        }
 
-                                       if(isset($values['file_name']) && 
$values['file_name'])
+                                       if(isset($_FILES['jasperfile']['name']) 
&& $_FILES['jasperfile']['name'])
                                        {
-                                               
$bofiles->create_document_dir("{$this->category_dir}/{$values['location']['loc1']}/{$values['id']}");
+                                               $file_name = 'jasper::' . 
str_replace (' ','_',$_FILES['jasperfile']['name']);
+                                               $to_file        = 
"{$bofiles->fakebase}/{$this->category_dir}/{$loc1}/{$id}/{$file_name}";
+
+                                               
if($bofiles->vfs->file_exists(array(
+                                                               'string' => 
$to_file,
+                                                               'relatives' => 
Array(RELATIVE_NONE)
+                                                       )))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+                                               }
+                                               else
+                                               {
+                                                       $files[] = array
+                                                       (
+                                                               'from_file'     
=> $_FILES['jasperfile']['tmp_name'],
+                                                               'to_file'       
=> $to_file
+                                                       );
+                                               }
+
+                                               unset($to_file);
+                                               unset($file_name);
+                                       }
+
+                                       foreach ($files as $file)
+                                       {
+                                               
$bofiles->create_document_dir("{$this->category_dir}/{$loc1}/{$id}");
                                                $bofiles->vfs->override_acl = 1;
 
                                                if(!$bofiles->vfs->cp (array (
-                                                       'from'  => 
$_FILES['file']['tmp_name'],
-                                                       'to'    => $to_file,
+                                                       'from'  => 
$file['from_file'],
+                                                       'to'    => 
$file['to_file'],
                                                        'relatives'     => 
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
                                                }
                                                $bofiles->vfs->override_acl = 0;
                                        }
+                                       unset($loc1);
+                                       unset($files);
+                                       unset($file);                           
        
 //-------------end files
 
                                        if (isset($values['save']) && 
$values['save'])
                                        {
                                                
$GLOBALS['phpgw']->session->appsession('session_data','entity_receipt_' . 
$this->entity_id . '_' . $this->cat_id,$receipt);
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id));
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id,'type' => $this->type));
                                        }
                                }
                                else
@@ -707,6 +1094,7 @@
                                        if($values['location'])
                                        {
                                                $location_code=implode("-", 
$values['location']);
+                                               $values['extra']['view'] = true;
                                                $values['location_data'] = 
$bolocation->read_single($location_code,$values['extra']);
                                        }
                                        if($values['extra']['p_num'])
@@ -727,7 +1115,7 @@
                        {
                                if($this->cat_id)
                                {
-                                       $values = 
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));
+                                       $values = 
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id),$values);
                                }
 
                        }
@@ -740,7 +1128,7 @@
 
                        $lookup_type='form';
 
-                       $entity = 
$this->boadmin_entity->read_single($this->entity_id,false);
+                       $entity = 
$this->soadmin_entity->read_single($this->entity_id);
 
                        if ($id)
                        {
@@ -757,11 +1145,16 @@
                        }
 
                        if (isset($entity['lookup_entity']) && 
is_array($entity['lookup_entity']))
-                       {       for 
($i=0;$i<count($entity['lookup_entity']);$i++)
                                {
-                                       $lookup_entity[$i]['id'] = 
$entity['lookup_entity'][$i];
-                                       $entity_lookup = 
$this->boadmin_entity->read_single($entity['lookup_entity'][$i],false);
-                                       $lookup_entity[$i]['name'] = 
$entity_lookup['name'];
+                               $lookup_entity = array();
+                               foreach ($entity['lookup_entity'] as $lookup_id)
+                               {
+                                       $entity_lookup = 
$this->soadmin_entity->read_single($lookup_id);
+                                       $lookup_entity[] = array
+                                       (
+                                               'id'            => $lookup_id,
+                                               'name'          => 
$entity_lookup['name']
+                                       );
                                }
                        }
 
@@ -770,12 +1163,12 @@
                                $lookup_tenant=true;
                        }
 
-                       if($bypass && $location_code)
+                       if($location_code)
                        {
                                $category['location_level']= 
count(explode('-',$location_code));
                        }
 
-                       if(!$category['location_level'])
+                       if( $this->cat_id && ( 
!isset($category['location_level']) || !$category['location_level']) )
                        {
                                $category['location_level']= -1;
                        }
@@ -788,26 +1181,11 @@
                                                'no_link'       => false, // 
disable lookup links for location type less than type_id
                                                'lookup_type'   => $lookup_type,
                                                'tenant'        => 
$lookup_tenant,
-                                               'lookup_entity' => 
isset($lookup_entity)?$lookup_entity:'',
+                                               'lookup_entity' => 
$lookup_entity,
                                                'entity_data'   => 
isset($values['p'])?$values['p']:''
                                                ));
                        }
 
-/*                     if($category['lookup_vendor'])
-                       {
-                               
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
-                                               'vendor_id'             => 
$values['vendor_id'],
-                                               'vendor_name'   => 
$values['vendor_name']));
-                       }
-*/
-
-                       $attributes_header[]    = array(
-                                       'lang_name'     => lang('Name'),
-                                       'lang_descr'    => lang('Description'),
-                                       'lang_datatype' => lang('Datatype'),
-                                       'lang_value'    => lang('Value')
-                               );
-
                        if(isset($error_id) && $error_id)
                        {
                                unset($values['id']);
@@ -819,49 +1197,14 @@
                                'menuaction'    => 'property.uientity.edit',
                                'id'            => $id,
                                'entity_id'     => $this->entity_id,
-                               'cat_id'        => $this->cat_id
+                               'cat_id'                => $this->cat_id,
+                               'type'                  => $this->type
                        );
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       $link_file_data = array
-                       (
-                               'menuaction'    => 
'property.uientity.view_file',
-                               'loc1'          => 
$values['location_data']['loc1'],
-                               'id'            => $id,
-                               'cat_id'        => $this->cat_id,
-                               'entity_id'     => $this->entity_id
-                       );
 
-       //              $config->read_repository();
+       //              $config->read();
        //              $link_to_files = $config->config_data['files_url'];
 
                        if(isset($values['files']) && 
is_array($values['files']))
@@ -878,11 +1221,11 @@
                                'menuaction'            => 
'property.uiproject.edit',
                                'bypass'                        => true,
                                'location_code'         => 
$values['location_code'],
-                               'p_num'                         => 
$values['p_num'],
-                               'p_entity_id'           => 
$values['p_entity_id'],
-                               'p_cat_id'                      => 
$values['p_cat_id'],
+                               'p_num'                         => $id,
+                               'p_entity_id'           => $this->entity_id,
+                               'p_cat_id'                      => 
$this->cat_id,
                                'tenant_id'                     => 
$values['tenant_id'],
-                               'origin'                        => 
".entity.{$this->entity_id}.{$this->cat_id}",
+                               'origin'                        => 
".{$this->type}.{$this->entity_id}.{$this->cat_id}",
                                'origin_id'                     => $id
                        );
 
@@ -891,17 +1234,39 @@
                                'menuaction'            => 'property.uitts.add',
                                'bypass'                        => true,
                                'location_code'         => 
$values['location_code'],
-                               'p_num'                         => 
$values['p_num'],
-                               'p_entity_id'           => 
$values['p_entity_id'],
-                               'p_cat_id'                      => 
$values['p_cat_id'],
+                               'p_num'                         => $id,
+                               'p_entity_id'           => $this->entity_id,
+                               'p_cat_id'                      => 
$this->cat_id,
                                'tenant_id'                     => 
$values['tenant_id'],
-                               'origin'                        => 
".entity.{$this->entity_id}.{$this->cat_id}",
+                               'origin'                        => 
".{$this->type}.{$this->entity_id}.{$this->cat_id}",
                                'origin_id'                     => $id
                        );
 
 
 //_debug_array($values['origin']);
 
+                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+
+                       $table_apply[] = array
+                       (
+                               'lang_save'                                     
        => lang('save'),
+                               'lang_cancel'                                   
=> lang('cancel'),
+                               'lang_apply'                                    
=> lang('apply'),
+                       );
+
+                       $pdf_data = array
+                       (
+                               'menuaction'    => 
'property.uientity.print_pdf',
+                               'id'            => $id,
+                               'entity_id'     => $this->entity_id,
+                               'cat_id'        => $this->cat_id,
+                               'type'          => $this->type
+                       );
+
+                       $tabs = array();
+
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
+                       {
                        foreach ($values['attributes'] as & $attribute)
                        {
                                if($attribute['history'] == true)
@@ -909,37 +1274,114 @@
                                        $link_history_data = array
                                        (
                                                'menuaction'    => 
'property.uientity.attrib_history',
-                                               'entity_id'     => 
$this->entity_id,
-                                               'cat_id'        => 
$this->cat_id,
+                                                       'acl_location'  => 
".{$this->type}.{$this->entity_id}.{$this->cat_id}",
+                                       //              'entity_id'     => 
$this->entity_id,
+                                       //              'cat_id'        => 
$this->cat_id,
                                                'attrib_id'     => 
$attribute['id'],
                                                'id'            => $id,
-                                               'edit'          => true
+                                                       'edit'          => true,
+                                                       'type'          => 
$this->type
                                        );
 
                                        $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
                                }
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
+                               
phpgwapi_yui::tabview_setup('entity_edit_tabview');
+                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
 
-                       $table_apply[] = array
-                       (
-                               'lang_save'                                     
        => lang('save'),
-                               'lang_cancel'                                   
=> lang('cancel'),
-                               'lang_apply'                                    
=> lang('apply'),
-                       );
+                               $location = 
".{$this->type}.{$this->entity_id}.{$this->cat_id}";
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $values['attributes']);
 
-                       $pdf_data = array
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $tabs[str_replace(' ', '_', 
$group['name'])] = array('label' => $group['name'], 'link' => '#' . 
str_replace(' ', '_', $group['name']));
+                                               $group['link'] = str_replace(' 
', '_', $group['name']);
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($values['attributes']);
+
+                               if($category['fileupload'] || 
(isset($values['files']) || $values['files']))
+                               {
+                                       $tabs['files']  = array('label' => 
lang('files'), 'link' => '#files');
+                               }
+
+                               if($category['jasperupload'])
+                               {
+                                       $tabs['jasper'] = array('label' => 
lang('jasper reports'), 'link' => '#jasper');
+                               }
+                       }
+
+                       $link_file_data = array
                        (
-                               'menuaction'    => 
'property.uientity.print_pdf',
+                               'menuaction'    => 
'property.uientity.view_file',
+                               'loc1'                  => 
$values['location_data']['loc1'],
                                'id'            => $id,
+                               'cat_id'                => $this->cat_id,
                                'entity_id'     => $this->entity_id,
-                               'cat_id'        => $this->cat_id
+                               'type'                  => $this->type
                        );
 
+                       
+                       for($z=0; $z<count($values['files']); $z++)
+                       {
+                               $content_files[$z]['file_name'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&amp;file_name='.$values['files'][$z]['name'].'"
 target="_blank" title="'.lang('click to view 
file').'">'.$values['files'][$z]['name'].'</a>';                     
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'">';
+                       }                                                       
                
+
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array(key => 
file_name,label=>lang('Filename'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => delete_file,label=>lang('Delete 
file'),sortable=>false,resizeable=>true,formatter=>FormatterCenter)))
+                       );
+
+                       $link_file_data['jasper']               = true;
+                       for($z=0; $z<count($values['jasperfiles']); $z++)
+                       {
+                               $link_file_data['file_name']    = 
$values['jasperfiles'][$z]['name'];
+                               $content_jasperfiles[$z]['file_name'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'" 
target="_blank" title="'.lang('click to view 
file').'">'.$values['jasperfiles'][$z]['name'].'</a>';                        
+                               $content_jasperfiles[$z]['delete_file'] = 
'<input type="checkbox" name="values[file_jasperaction][]" 
value="'.$values['jasperfiles'][$z]['name'].'" title="'.lang('Check to delete 
file').'">';
+                       }                                                       
                
+
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($content_jasperfiles),
+                                       'total_records'                 => 
count($content_jasperfiles),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      json_encode(array(      
array('key' => 
'file_name','label'=>lang('Filename'),sortable=>false,resizeable=>true),
+                                                                               
                array('key' => 'delete_file','label'=>lang('Delete 
file'),sortable=>false,resizeable=>true,formatter=>FormatterCenter)))
+                       );
+
                        $data = array
                        (
+                               'property_js'                                   
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
                => $datavalues,
+                               'myColumnDefs'                                  
        => $myColumnDefs,       
+                               
                                'link_pdf'                                      
        => $GLOBALS['phpgw']->link('/index.php',$pdf_data),
                                'start_project'                                 
=> $category['start_project'],
                                'lang_start_project'                    => 
lang('start project'),
@@ -948,9 +1390,11 @@
                                'lang_start_ticket'                     => 
lang('start ticket'),
                                'ticket_link'                                   
=> $GLOBALS['phpgw']->link('/index.php',$ticket_link_data),
                                'fileupload'                                    
=> $category['fileupload'],
+                               'jasperupload'                                  
=> $category['jasperupload'],
                                'link_view_file'                                
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
                //              'link_to_files'                                 
=> $link_to_files,
                                'files'                                         
        => isset($values['files'])?$values['files']:'',
+                               'jasperfiles'                                   
=> isset($values['jasperfiles'])?$values['jasperfiles']:'',
                                'lang_files'                                    
=> lang('files'),
                                'lang_filename'                                 
=> lang('Filename'),
                                'lang_file_action'                              
=> lang('Delete file'),
@@ -977,21 +1421,13 @@
                                'lang_category'                                 
=> lang('category'),
                                'category_name'                                 
=> $category['name'] . ' - ' . $category['descr'],
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'lang_dateformat'                               
=> lang(strtolower($dateformat)),
-                               'dateformat_validate'                   => 
$dateformat_validate,
-                               'onKeyUp'                                       
        => $onKeyUp,
-                               'onBlur'                                        
        => $onBlur,
-                               'lang_attributes'                               
=> lang('Attributes'),
-                               'attributes_header'                             
=> $attributes_header,
-                               'attributes_values'                             
=> $values['attributes'],
+                               'attributes_group'                              
=> $attributes,
                                'lookup_functions'                              
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
-                               'dateformat'                                    
=> $dateformat,
                                'lang_none'                                     
        => lang('None'),
-       //                      'vendor_data'                                   
=> isset($vendor_data)?$vendor_data:'',
                                'location_data'                                 
=> $location_data,
                                'lookup_type'                                   
=> $lookup_type,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id)),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id, 'type' => $this->type)),
                                'lang_id'                                       
        => lang('ID'),
                                'value_id'                                      
        => $values['id'],
                                'value_num'                                     
        => $values['num'],
@@ -1005,14 +1441,33 @@
                                'lang_date'                                     
        => lang('date'),
                                'table_apply'                                   
=> $table_apply,
                                'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, 'general')
                        );
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
                        $appname        = $entity['name'];
-//_debug_array($attributes_values);
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'entity.edit', 'property' );
+                                               
+
                }
 
                function attrib_help()
@@ -1033,13 +1488,13 @@
                                'attrib_id'     => $attrib_id
                                );
 
-                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
+                       $entity_category = 
$this->soadmin_entity->read_single_category($entity_id,$cat_id);
 
-                       $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-
                        $help_msg       = 
$this->bo->read_attrib_help($data_lookup);
 
-                       $attrib_data    = 
$this->boadmin_entity->read_single_attrib($entity_id,$cat_id,$attrib_id);
+                       $custom                 = 
createObject('phpgwapi.custom_fields');
+                       $attrib_data    = 
$custom->get($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id);
+
                        $attrib_name    = $attrib_data['input_text'];
                        $function_msg   = lang('Help');
 
@@ -1055,19 +1510,30 @@
 
                function delete()
                {
+                       $id = phpgw::get_var('id', 'int');
+
+                       //cramirez add JsonCod for Delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id);
+                               return "id ".$id." ".lang("has been deleted");
+                       }
+
+
                        if(!$this->acl_delete)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
                        }
 
-                       $id = phpgw::get_var('id', 'int');
+
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
                        $link_data = array
                        (
                                'menuaction'    => 'property.uientity.index',
                                'entity_id'     => $this->entity_id,
-                               'cat_id'        => $this->cat_id
+                               'cat_id'        => $this->cat_id,
+                               'type'          => $this->type
                        );
 
                        if (phpgw::get_var('confirm', 'bool', 'POST'))
@@ -1081,7 +1547,7 @@
                        $data = array
                        (
                                'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'delete_action'         => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.delete', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id, 'id'=> $id)),
+                               'delete_action'         => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.delete', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id, 'id'=> $id, 'type' => $this->type)),
                                'lang_confirm_msg'      => lang('do you really 
want to delete this entry'),
                                'lang_yes'              => lang('yes'),
                                'lang_yes_statustext'   => lang('Delete the 
entry'),
@@ -1092,9 +1558,8 @@
                        $appname                = lang('entity');
                        $function_msg           = lang('delete entity');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
                function view()
@@ -1124,8 +1589,8 @@
                                $this->cat_id = $values['cat_id'];
                        }
 
-                       $entity = 
$this->boadmin_entity->read_single($this->entity_id,false);
-                       $category = 
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+                       $entity = 
$this->soadmin_entity->read_single($this->entity_id);
+                       $category = 
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
 
                        if (isset($entity['lookup_entity']) && 
is_array($entity['lookup_entity']))
                        {       for 
($i=0;$i<count($entity['lookup_entity']);$i++)
@@ -1133,7 +1598,7 @@
                                        
if(isset($values['p'][$entity['lookup_entity'][$i]]) && 
$values['p'][$entity['lookup_entity'][$i]])
                                        {
                                                $lookup_entity[$i]['id'] = 
$entity['lookup_entity'][$i];
-                                               $entity_lookup = 
$this->boadmin_entity->read_single($entity['lookup_entity'][$i],false);
+                                               $entity_lookup = 
$this->soadmin_entity->read_single($entity['lookup_entity'][$i]);
                                                $lookup_entity[$i]['name'] = 
$entity_lookup['name'];
                                        }
                                }
@@ -1167,7 +1632,8 @@
                                'menuaction'    => 'property.uientity.edit',
                                'id'            => $id,
                                'entity_id'     => $this->entity_id,
-                               'cat_id'        => $this->cat_id
+                               'cat_id'                => $this->cat_id,
+                               'type'                  => $this->type
                        );
 
                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
@@ -1185,10 +1651,11 @@
                                'loc1'          => 
$values['location_data']['loc1'],
                                'id'            => $id,
                                'cat_id'        => $this->cat_id,
-                               'entity_id'     => $this->entity_id
+                               'entity_id'             => $this->entity_id,
+                               'type'                  => $this->type
                        );
 
-               //      $config->read_repository();
+               //      $config->read();
                //      $link_to_files = $config->config_data['files_url'];
 
                        if(isset($values['files']) && 
is_array($values['files']))
@@ -1210,7 +1677,8 @@
                                                'entity_id'     => 
$this->entity_id,
                                                'cat_id'        => 
$this->cat_id,
                                                'attrib_id'     => 
$values['attributes'][$i]['attrib_id'],
-                                               'id'            => $id
+                                               'id'                    => $id,
+                                               'type'                  => 
$this->type
                                        );
 
                                        
$attributes_values[$i]['link_history']=$GLOBALS['phpgw']->link('/index.php',$link_history_data);
@@ -1224,7 +1692,8 @@
                                'menuaction'    => 
'property.uientity.print_pdf',
                                'id'            => $id,
                                'entity_id'     => $this->entity_id,
-                               'cat_id'        => $this->cat_id
+                               'cat_id'        => $this->cat_id,
+                               'type'          => $this->type
                        );
 
                        $data = array
@@ -1256,7 +1725,7 @@
                                'location_data'                                 
=> $location_data,
                                'lookup_type'                                   
=> $lookup_type,
                                'edit_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id)),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'property.uientity.index', 'entity_id'=> $this->entity_id, 'cat_id'=> 
$this->cat_id,'type' => $this->type)),
                                'lang_category'                                 
=> lang('category'),
                                'lang_edit'                                     
=> lang('Edit'),
                                'lang_done'                                     
=> lang('done'),
@@ -1275,10 +1744,8 @@
                                'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
                                );
 
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
                function attrib_history()
@@ -1286,16 +1753,20 @@
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('attrib_history','nextmatchs'));
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
 
+                       $acl_location = phpgw::get_var('acl_location', 
'string');
                        $id             = phpgw::get_var('id', 'int');
-                       $entity_id      = phpgw::get_var('entity_id', 'int');
-                       $cat_id         = phpgw::get_var('cat_id', 'int');
+       //              $entity_id      = phpgw::get_var('entity_id', 'int');
+       //              $cat_id         = phpgw::get_var('cat_id', 'int');
                        $attrib_id      = phpgw::get_var('attrib_id', 'int');
+                       $detail_id      = phpgw::get_var('detail_id', 'int');
 
                        $data_lookup= array(
+                               'acl_location'  => $acl_location,
                                'id'            => $id,
-                               'entity_id'     => $entity_id,
-                               'cat_id'        => $cat_id,
-                               'attrib_id'     => $attrib_id
+               //              'entity_id'     => $entity_id,
+               //              'cat_id'        => $cat_id,
+                               'attrib_id'     => $attrib_id,
+                               'detail_id'     => $detail_id,
                                );
 
                        $delete = phpgw::get_var('delete', 'bool');
@@ -1315,13 +1786,16 @@
                                $link_delete_history_data = array
                                        (
                                                'menuaction'    => 
'property.uientity.attrib_history',
-                                               'entity_id'     => 
$data_lookup['entity_id'],
-                                               'cat_id'        => 
$data_lookup['cat_id'],
+                                       'acl_location'  => $acl_location,
+                       //              'entity_id'             => 
$data_lookup['entity_id'],
+                       //              'cat_id'                => 
$data_lookup['cat_id'],
                                                'id'            => 
$data_lookup['id'],
                                                'attrib_id'     => 
$data_lookup['attrib_id'],
+                                       'detail_id'     => 
$data_lookup['detail_id'],
                                                'history_id'    => $entry['id'],
                                                'delete'        => true,
-                                               'edit'          => true
+                                       'edit'                  => true,
+                                       'type'                  => $this->type
                                        );
                                if($edit)
                                {
@@ -1353,15 +1827,125 @@
                        $link_data = array
                        (
                                'menuaction'    => 
'property.uientity.attrib_history',
+                               'acl_location'  => $acl_location,
                                'id'                    => $id,
-                               'entity_id'             => $entity_id,
-                               'cat_id'                => $cat_id,
-                               'entity_id'             => $entity_id,
-                               'edit'                  => $edit
+                               'detail_id'     => $data_lookup['detail_id'],
+               //              'entity_id'             => $entity_id,
+               //              'cat_id'                => $cat_id,
+               //              'entity_id'             => $entity_id,
+                               'edit'                  => $edit,
+                               'type'                  => $this->type
                        );
 
+
+//--- asynchronous response --------------------------------------------       
                        
+               
+                       if( phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               if(count($content))
+                               {
+                                       return json_encode($content);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }               
+//---datatable settings---------------------------------------------------     
                        
+                       $parameters['delete'] = array('parameter' => array(
+                               array(
+                                       'name'  => 'acl_location',
+                               'source' => $data_lookup['acl_location'],
+                               'ready'  => 1
+                               ),
+       /*                      array(
+                                       'name'  => 'entity_id',
+                               'source' => $data_lookup['entity_id'],
+                               'ready'  => 1
+                               ),
+                               array(
+                                       'name'  => 'cat_id',
+                               'source' => $data_lookup['cat_id'],
+                               'ready'  => 1
+                               ),
+               */
+                               array(
+                                       'name'  => 'id',
+                               'source' => $data_lookup['id'],
+                               'ready'  => 1
+                               ),
+                               array(
+                                       'name'  => 'attrib_id',
+                               'source' => $data_lookup['attrib_id'],
+                               'ready'  => 1
+                               ),
+                               array(
+                                       'name'  => 'detail_id',
+                               'source' => $data_lookup['detail_id'],
+                               'ready'  => 1
+                               ),
+                               array(
+                                       'name'  => 'history_id',
+                               'source' => 'id',
+                       ),
+                       array(
+                                       'name'  => 'delete',
+                               'source' => true,
+                               'ready'  => 1
+                               ),
+                               array(
+                                       'name'  => 'edit',
+                               'source' => true,
+                               'ready'  => 1
+                               ),
+                               array(
+                                       'name'  => 'type',
+                               'source' => $this->type,
+                               'ready'  => 1
+                               )                               
+                   )
+                   );
+                   
+                       if($edit && $this->acl->check($acl_location, 
PHPGW_ACL_DELETE, $this->type_app[$this->type]))
+                       {
+                               $permissions['rowactions'][] = array(
+                                       'text'          => lang('delete'),
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uientity.attrib_history' )),
+                                       'confirm_msg'=> lang('do you really 
want to delete this entry'),
+                                       'parameters'=> $parameters['delete']
+                               );
+                       }
+                                                          
+                       $datavalues[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                => 
json_encode($content),
+                               'total_records' => count($content),
+                               'permission'    => 
json_encode($permissions['rowactions']),
+                               'is_paginator'  => 1,
+                               'footer'                => 0
+                       );                         
+                               
+                       $myColumnDefs[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array(key => id,                        hidden=>true),
+                                                                               
                                array(key => value,                     
label=>lang('value'),           sortable=>true,resizeable=>true),
+                                                                               
                        array(key => time_created,      label=>lang('time 
created'),sortable=>true,resizeable=>true),
+                                                                               
                        array(key => user,                      
label=>lang('user'),            sortable=>true,resizeable=>true)
+                                                                               
                        ))
+                       );                              
+                       
+                       
+                       
+//----------------------------------------------datatable settings--------     
                
                        $data = array
                        (
+                               'property_js'           => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'         => 
json_encode(array(menuaction => "property.uientity.attrib_history")),
+                               'datatable'                     => $datavalues,
+                               'myColumnDefs'          => $myColumnDefs,
+                               
                                'allow_allrows'         => false,
                                'start_record'          => $this->start,
                                'record_limit'          => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
@@ -1372,16 +1956,37 @@
                                'values'                => $content,
                                'table_header'          => $table_header,
                        );
-//_debug_array($data);
-                       $attrib_data    = 
$this->boadmin_entity->read_single_attrib($entity_id,$cat_id,$attrib_id);
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'entity.attrib_history', 'property' );
+                       //-----------------------datatable settings---  
+                       
+//_debug_array($data);die();
+                       $custom                 = 
createObject('phpgwapi.custom_fields');
+                       $attrib_data    = 
$custom->get($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", $attrib_id);
                        $appname        = $attrib_data['input_text'];
                        $function_msg   = lang('history');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
                        
//_debug_array($GLOBALS['phpgw_info']['flags']['app_header']);
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('attrib_history' => $data));
                }
 
+
                function print_pdf()
                {
                        if(!$this->acl_read)
@@ -1419,8 +2024,8 @@
                                $this->cat_id = $values['cat_id'];
                        }
 
-                       $entity = 
$this->boadmin_entity->read_single($this->entity_id,false);
-                       $category = 
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+                       $entity = 
$this->soadmin_entity->read_single($this->entity_id);
+                       $category = 
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
 
                        if (isset($entity['lookup_entity']) && 
is_array($entity['lookup_entity']))
                        {       for 
($i=0;$i<count($entity['lookup_entity']);$i++)
@@ -1428,7 +2033,7 @@
                                        
if(isset($values['p'][$entity['lookup_entity'][$i]]) && 
$values['p'][$entity['lookup_entity'][$i]])
                                        {
                                                $lookup_entity[$i]['id'] = 
$entity['lookup_entity'][$i];
-                                               $entity_lookup = 
$this->boadmin_entity->read_single($entity['lookup_entity'][$i],false);
+                                               $entity_lookup = 
$this->soadmin_entity->read_single($entity['lookup_entity'][$i]);
                                                $lookup_entity[$i]['name'] = 
$entity_lookup['name'];
                                        }
                                }
@@ -1576,4 +2181,3 @@
                        $pdf->print_pdf($document,$entity['name'] . '_' . 
str_replace(' ','_',$GLOBALS['phpgw']->accounts->id2name($this->account)));
                }
        }
-

Added: people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,876 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free 
Software Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage admin
+       * @version $Id$
+       */
+       phpgw::import_class('phpgwapi.yui');
+       phpgw::import_class('property.uicommon');
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_uievent extends property_uicommon
+       {
+               var $grants;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $sub;
+               var $currentapp;
+               var $location_info;
+
+               var $public_functions = array
+               (
+                       'index'         => true,
+                       'view'          => true,
+                       'edit'          => true,
+                       'delete'        => true,
+                       'schedule'      => true,
+                       'schedule2'     => true,
+                       'schedule_week' => true
+               );
+
+               function __construct()
+               {
+//                     parent::__construct();
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo                                       = 
CreateObject('property.boevent',true);
+                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->custom                           = & 
$this->bo->custom;
+
+                       $this->location_info            = 
$this->bo->location_info;
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
$this->location_info['menu_selection'];
+                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
+                       $this->acl_location                     = 
'.entity.1.1';//$this->location_info['acl_location'];
+                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
+                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
+                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
+                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
+                       $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, 'property');
+
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+                       $this->allrows                          = 
$this->bo->allrows;
+               }
+
+               function save_sessiondata()
+               {
+                       $data = array
+                       (
+                               'start'         => $this->start,
+                               'query'         => $this->query,
+                               'sort'          => $this->sort,
+                               'order'         => $this->order,
+                               'allrows'       => $this->allrows
+                       );
+                       $this->bo->save_sessiondata($data);
+               }
+
+               function index()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $type           = phpgw::get_var('type');
+                       $type_id        = phpgw::get_var('type_id', 'int');
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data', 
"general_receipt_{$type}_{$type_id}");
+                       $this->save_sessiondata();
+
+                       $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
"general.index.{$type}";
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 'property.uievent.index',
+                                       'type'          => $type,
+                                       'type_id'               => $type_id
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uievent.index',"
+                                                                               
                        ."type:'{$type}',"
+                                                                               
                        ."type_id:'{$type_id}'";
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uievent.index',
+                                       'type'          => $type,
+                                       'type_id'               => $type_id
+                               );
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array
+                               (
+                                       array
+                                       (
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array
+                                                               (
+                                                                       
'menuaction'    => 'property.uievent.index',
+                                                                       'type'  
                => $type,
+                                                                       
'type_id'               => $type_id
+                                                               )
+                                                       ),
+                                       'fields'        => array
+                                       (
+                                       'field' => array
+                                       (
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_done',
+                                                                       'value' 
=> lang('done'),
+                                                                       
'tab_index' => 9
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_new',
+                                                                       'value' 
=> lang('add'),
+                                                                       
'tab_index' => 8
+                                                               ),
+                                                               array
+                                                               ( //button     
SEARCH
+                                                                       'id' => 
'btn_search',
+                                                                       'name' 
=> 'search',
+                                                                       'value' 
   => lang('search'),
+                                                                       'type' 
=> 'button',
+                                                                       
'tab_index' => 7
+                                                               ),
+                                                               array
+                                                               ( // TEXT INPUT
+                                                                       'name'  
   => 'query',
+                                                                       'id'    
 => 'txt_query',
+                                                                       'value' 
   => $this->query,
+                                                                       'type' 
=> 'text',
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'size'  
  => 28,
+                                                                       
'tab_index' => 6
+                                                               )
+                                                       )
+                                               )
+                                       )
+                               );
+                               $dry_run = true;
+                       }
+
+                       $values = $this->bo->read();
+                       $uicols = $this->bo->uicols;
+
+/*                     $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('category ID');
+                       $uicols['name'][1]      = 'descr';
+                       $uicols['descr'][1]     = lang('Descr');
+*/
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($values) AND is_array($values))
+                       {
+                               foreach($values as $category_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $category_entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'               => 'edit',
+                                       'statustext'    => lang('edit the 
actor'),
+                                       'text'                  => lang('edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uievent.edit',
+                                                                               
        'type'                          => $type,
+                                                                               
        'type_id'                       => $type_id
+                                                                               
)),
+                                       'parameters'    => $parameters
+                               );
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'               => 'edit',
+                                       'text'                  => lang('open 
edit in new window'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uievent.edit',
+                                                                               
        'type'                          => $type,
+                                                                               
        'type_id'                       => $type_id,
+                                                                               
        'target'                        => '_blank'
+                                                                               
)),
+                                       'parameters'    => $parameters
+                               );
+                       }
+
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'               => 'delete',
+                                       'statustext'    => lang('delete the 
actor'),
+                                       'text'                  => 
lang('delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uievent.delete',
+                                                                               
        'type'                  => $type,
+                                                                               
        'type_id'               => $type_id
+                                                                               
)),
+                                       'parameters'    => $parameters
+                               );
+                       }
+                       unset($parameters);
+
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array
+                               (
+                                       'my_name'                       => 
'add',
+                                       'statustext'    => lang('add'),
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uievent.edit',
+                                                                               
        'type'                  => $type,
+                                                                               
        'type_id'               => $type_id
+                                                                               
))
+                               );
+                       }
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']                 = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($values);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                        =  
$this->location_info['name'];
+                       $function_msg           = lang('list %1', $appname);
+
+                       if ( ($this->start == 0) && (!$this->order))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= $this->order; // name of column of Database
+                               $datatable['sorting']['sort']                   
= $this->sort; // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'category.index', 'property' );
+               }
+
+               function edit()
+               {
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+                       if(!$this->acl_add)
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+
+                       $location       = phpgw::get_var('location');
+                       $attrib_id      = phpgw::get_var('attrib_id');
+                       $item_id        = phpgw::get_var('item_id', 'int');
+                       $id                     = phpgw::get_var('id', 'int');
+                       $values         = phpgw::get_var('values');
+
+               
+//                     $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
'general.edit.' . $type;
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('event'));
+                       $receipt = array();
+
+                       if (is_array($values))
+                       {
+                               $values['location_id']  =  
$GLOBALS['phpgw']->locations->get_id('property', $location);
+                               $values['attrib_id']    =  $attrib_id;
+                               $values['item_id']              =  $item_id;
+                               $attrib = $this->custom->get('property', 
$location, $attrib_id);
+                               $field_name = $attrib ? $attrib['column_name'] 
: $attrib_id;
+
+                               if ((isset($values['save']) && $values['save']) 
|| (isset($values['apply']) && $values['apply']))
+                               {
+                                       if(!isset($values['descr']) || 
!$values['descr'])
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please enter a description'));           
                                                        
+                                       }
+                                       if(!isset($values['responsible']) || 
!$values['responsible'])
+                                       {
+               //                              
$receipt['error'][]=array('msg'=>lang('Please select a responsible'));          
                                                        
+                                       }
+                                       if(!isset($values['action']) || 
!$values['action'])
+                                       {
+               //                              
$receipt['error'][]=array('msg'=>lang('Please select an action'));              
                                                        
+                                       }
+                                       
+/*                                     if(isset($values['repeat_day']))
+                                       {
+                                               $values['repeat_interval'] = 0;
+                                       }
+*/
+                                       if($id)
+                                       {
+                                               $values['id']=$id;
+                                       }
+                                       else
+                                       {
+                                               $id =   $values['id'];
+                                       }
+
+                                       if(!$receipt['error'])
+                                       {
+                                               $receipt = 
$this->bo->save($values,$action);
+                                               
+                                               $js = 
"opener.document.form.{$field_name}.value = '{$receipt['id']}';\n";
+                                               $js .= 
"opener.document.form.{$field_name}_descr.value = '{$values['descr']}';\n";
+
+                                               if (isset($values['save']) && 
$values['save'])
+                                               {
+                                                       $js .= 
"window.close();";
+                                               }
+                                               
$GLOBALS['phpgw']->js->add_event('load', $js);
+                                               $id = $receipt['id'];
+                                       }
+                                       else
+                                       {
+                                               unset($values['id']);
+                                               $id = '';
+                                       }
+                                       
+                               }
+                               else if ((isset($values['delete']) && 
$values['delete']))
+                               {
+                                               $attrib = 
$this->custom->get('property', $location, $attrib_id);
+                                               $js = 
"opener.document.form.{$field_name}.value = '';\n";
+                                               $js .= 
"opener.document.form.{$field_name}_descr.value = '';\n";
+                                               if($this->delete($id))
+                                               {
+                                                       
$GLOBALS['phpgw']->js->add_event('load', $js);
+                                                       unset($values);
+                                                       unset($id);
+                                               }
+                               }
+                               else
+                               {
+                                       
$GLOBALS['phpgw']->js->add_event('load', "window.close();");
+                               }
+                               unset($js);
+                               unset($attrib);
+                       }
+
+                       if ($id)
+                       {
+                               $values = $this->bo->read_single($id);
+                               $function_msg = lang('edit event');
+                       }
+                       else
+                       {
+                               $function_msg = lang('add event');
+                               $values['enabled'] = true;
+                       }
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 'property.uievent.edit',
+                               'location'              => $location,
+                               'attrib_id'             => $attrib_id,
+                               'item_id'               => $item_id,
+                               'id'                    => $id
+                       );
+
+                       $link_schedule_data = array
+                       (
+                               'menuaction'    => 
'property.uievent.schedule_week',
+                               'location'              => $location,
+                               'attrib_id'             => $attrib_id,
+                               'item_id'               => $item_id,
+                               'id'                    => $id
+                       );
+
+//_debug_array($link_data);
+
+                       $tabs = array();
+
+                       phpgwapi_yui::tabview_setup('general_edit_tabview');
+                       $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
+                       $tabs['repeat']         = array('label' => 
lang('repeat'), 'link' => '#repeat');
+                       $schedule = array();
+
+                       if ($id)
+                       {
+                               $tabs['plan']           = array('label' => 
lang('plan'), 'link' => '#plan');
+                               $schedule = $this->schedule2($id);
+                       }
+
+
+                       $jscal = CreateObject('phpgwapi.jscalendar');
+                       $jscal->add_listener('values_start_date');
+                       $jscal->add_listener('values_end_date');
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'link_schedule'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_schedule_data),
+                               'img_cal'                                       
        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                               'lang_datetitle'                        => 
lang('Select date'),
+
+                               'lang_start_date_statustext'    => lang('Select 
the date for the event'),
+                               'lang_start_date'                               
=> lang('date'),
+                               'value_start_date'                              
=> $values['start_date'],
+       //                      'start_date'                                    
=> $start_date,
+
+                               'value_enabled'                                 
=> isset($values['enabled']) ? $values['enabled'] : '',
+                               'lang_enabled'                                  
=> lang('enabled'),
+                               'lang_end_date_statustext'              => 
lang('Select the estimated end date for the event'),
+                               'lang_end_date'                                 
=> lang('end date'),
+                               'value_end_date'                                
=> $values['end_date'],
+                               'repeat_type'                                   
=> $this->bo->get_rpt_type_list(isset($values['repeat_type']) ? 
$values['repeat_type'] : ''),
+                               'lang_repeat_type'                              
=> lang('repeat type'),
+                               
+                               'repeat_day'                                    
=> $this->bo->get_rpt_day_list(isset($values['repeat_day']) ? 
$values['repeat_day'] : ''),
+                               'lang_repeat_day'                               
=> lang('repeat day'),
+
+                               'lang_repeat_interval'                  => 
lang('interval'),
+                               'value_repeat_interval'                 => 
isset($values['repeat_interval']) ? $values['repeat_interval'] : 0,
+                               'lang_repeat_interval_statustext'=> 
lang('interval'),
+                               
+                               'lang_responsible'                              
=> lang('responsible'),
+                               'responsible'                                   
=> $this->bo->get_responsible(isset($values['responsible']) ? 
$values['responsible'] : ''),
+
+                               'lang_action'                                   
=> lang('action'),
+                               'action'                                        
        => $this->bo->get_action(isset($values['action']) ? $values['action'] : 
''),
+
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uievent.index', 'type'=> $type, 'type_id'=> $type_id)),
+                               'lang_id'                                       
        => lang('ID'),
+                               'lang_descr'                                    
=> lang('Description'),
+                               'lang_save'                                     
        => lang('save'),
+                               'lang_cancel'                                   
=> lang('cancel'),
+                               'lang_apply'                                    
=> lang('apply'),
+                               'value_id'                                      
        => isset($values['id']) ? $values['id'] : '',
+
+                               'lang_next_run'                                 
=> lang('next run'),
+                               'value_next_run'                                
=> isset($values['next']) ? $values['next'] : '',                               
+                               'value_descr'                                   
=> $values['descr'],
+                               'lang_descr_text'                               
=> lang('Enter a description of the record'),
+                               'lang_save_text'                                
=> lang('Save the record'),
+                               'lang_apply_statustext'                 => 
lang('Apply the values'),
+                               'lang_cancel_statustext'                => 
lang('Leave the actor untouched and return back to the list'),
+                               'lang_save_statustext'                  => 
lang('Save the actor and return back to the list'),
+
+                               'lang_delete'                                   
=> lang('delete'),
+                               'lang_delete_text'                              
=> lang('delete the record'),
+                               'lang_delete_statustext'                => 
lang('delete the record'),
+
+                               'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 10,
+                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, 'general'),
+                       );
+
+                       $data = array_merge($schedule, $data);
+                       $appname        =  lang('event');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+               }
+
+               function delete($id)
+               {
+                       if(!$this->acl_delete)
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+
+                       return $this->bo->delete($id);
+               }
+
+
+               public function schedule()
+               {
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $id = phpgw::get_var('id', 'int', 'GET');
+
+                       $resource = $this->bo->read_single($id);
+                       $resource['cols'][] = array('label' => lang('date'), 
'key' => 'date');
+                       $resource['cols'][] = array('label' => 
lang('exception'), 'key' => 'exception');
+
+                       $lang['resource_schedule'] = lang('Resource schedule');
+                       $lang['schedule'] = lang('Schedule');
+                       $lang['time'] = lang('Time');
+
+                       self::add_javascript('property', 'yahoo', 
'schedule.js');
+                       self::render_template('event_schedule', 
array('resource' => $resource, 'lang' => $lang));
+               }
+
+
+
+               function schedule2($id = 0)
+               {
+                       if(!$id)
+                       {
+                               $id = phpgw::get_var('id', 'int');
+                       }
+                       $values                 = phpgw::get_var('values');
+
+                       if (is_array($values))
+                       {
+                               if($values['alarm'])
+                               {
+                                       $receipt = $this->bo->set_exceptions(
+                                               array(
+                                               'event_id' => $id,
+                                               'alarm' => 
array_keys($values['alarm']),
+                                               'exception' => 
!!$values['disable_alarm']));
+                               }
+                       }
+
+
+//------------------------------get data
+                       $event = $this->bo->so->read_single($id);
+
+                       $criteria = array
+                       (
+                               'start_date'            => $event['start_date'],
+                               'end_date'                      => 
$event['end_date'],
+                               'location_id'           => 
$event['location_id'],
+                               'location_item_id'      => 
$event['location_item_id']
+                       );
+
+                       $this->bo->find_scedules($criteria);
+                       $schedules =  $this->bo->cached_events;
+//_debug_array($schedules);die();
+                       $total_records = 0;
+
+                       $lang_exception  = lang('exception');
+
+                       $values = array();
+
+                       $i = 1;
+                       foreach($schedules as $_date => $set)
+                       {
+                               $__date = substr($_date,0,4) . '-' . 
substr($_date,4,2) . '-' . substr($_date,6,2);
+                               $date = phpgwapi_datetime::convertDate($__date, 
'Y-m-d', $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+
+                               foreach($set as $entry)
+                               {
+
+                                       $values[] = array
+                                       (
+                                               'number'                        
=> $i,
+                                               'time'                          
=> $date,
+                                               'alarm_id'                      
=> $_date,
+                                               'enabled'                       
=> isset($entry['exception']) && $entry['exception']==true ? '' : 1,
+                                               'location_id'           => 
$entry['location_id'],
+                                               'location_item_id'      => 
$entry['location_item_id'],
+                                               'url'                           
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'booking.uievent.show', 'location_id' => $entry['location_id'], 
'location_item_id' => $entry['location_item_id']))
+                                       );
+
+                                       $i++;
+                               }
+                       }
+
+//------------------------------end get data
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'property.uis_agreement.edit',
+                               'id'            => $id,
+                               'role'          => $this->role
+                       );
+
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+
+                       $link_download = array
+                       (
+                               'menuaction'    => 
'property.uis_agreement.download',
+                               'id'            => $id
+                       );
+
+                       $tabs = array();
+
+
+                       //----------JSON CODE 
----------------------------------------------
+
+
+                       //---GET ALARM
+                       if( phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               if(count($values))
+                               {
+                                       return json_encode($values);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+
+                       //--------------------JSON code-----
+
+
+                       //------- alarm--------
+                       $datavalues[0] = array
+                       (
+                               'name'   => "0",
+                               'values'   => json_encode($values),
+                               'total_records' => count($values),
+                               'is_paginator' => 1,
+                               'permission'=> '""',
+                               'footer'  => 1
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'   => "0",
+                               'values'  => json_encode(array( 
+                                       array('key' => 'number', 'label'=>'#', 
'sortable'=>true,'resizeable'=>true,'width'=>20),
+                                       array('key' => 'time', 
'label'=>lang('plan'), 'sortable'=>true,'resizeable'=>true,'width'=>80),
+                                       array('key' => 'performed', 
'label'=>lang('performed'), 'sortable'=>true,'resizeable'=>true,'width'=>80),   
                                    
+                                       array('key' => 'remark', 
'label'=>lang('remark'), 'sortable'=>true,'resizeable'=>true,'width'=>140),     
                               
+                                       array('key' => 'enabled','label'=> 
lang('enabled'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterCenter','width'=>30),
+                                       array('key' => 'alarm_id','label'=> 
'alarm_id','sortable'=>true,'resizeable'=>true,'hidden'=>false),
+                                       array('key' => 'select','label'=> 
lang('select'), 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)))
+                         );
+
+                       $myButtons[0] = array
+                       (
+                               'name'   => "0",
+                               'values'  => json_encode(array( 
+                                       array('id' 
=>'values[enable_alarm]','type'=>'buttons', 'value'=>'Enable', 'label'=> 
lang('enable'), 'funct'=> 'onActionsClick' , 'classname'=> 'actionButton', 
'value_hidden'=>""),
+                                       array('id' 
=>'values[disable_alarm]','type'=>'buttons', 'value'=>'Disable', 
'label'=>lang('disable'), 'funct'=> 'onActionsClick' , 'classname'=> 
'actionButton', 'value_hidden'=>""),
+                                       ))
+                       );
+
+                       $td_count = 0;
+
+//--------------------------------------------JSON CODE------------
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 'property.uievent.schedule2',
+                               'id'            =>              $id
+                       );
+
+
+                       $data = array
+                       (
+                               'td_count'                                      
=> 6,
+                               'property_js'                           => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                         => 
json_encode(array('menuaction' => "property.uievent.schedule2",'id'=>$id)),
+                               'datatable'                                     
=> $datavalues,
+                               'myColumnDefs'                          => 
$myColumnDefs,
+                               'myButtons'                                     
=> $myButtons,
+
+                               'value_location_id'                     => 
$event['location_id'],
+                               'value_location_item_id'        => 
$event['location_item_id'],
+
+
+                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'edit_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'tabs'                                          
=> phpgwapi_yui::tabview_generate($tabs, $active_tab)
+                       );
+
+//_debug_array($data);die;
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('schedule');
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('event'));
+       //              
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('schedule' => $data));
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'event.schedule', 'property' );
+                       return $data;
+               }
+
+ 
+               public function schedule_week()
+               {
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $id = phpgw::get_var('id', 'int', 'GET');
+                       $resource = $this->bo->init_schedule_week($id, 
'property.uievent', 'property.uievent');
+
+                       $lang['resource_schedule'] = lang('Resource schedule');
+                       $lang['prev_week'] = lang('Previous week');
+                       $lang['next_week'] = lang('Next week');
+                       $lang['week'] = lang('Week');
+                       $lang['buildings'] = lang('Buildings');
+                       $lang['schedule'] = lang('Schedule');
+                       $lang['time'] = lang('Time');
+
+                       self::add_javascript('property', 'yahoo', 
'schedule.js');
+                       self::render_template('event_schedule_week', 
array('resource' => $resource, 'lang' => $lang));
+               }
+
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.uievent.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision

Modified: people/sigurdne/modules/property/trunk/inc/class.uigab.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uigab.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uigab.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,13 +24,14 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage location
-       * @version $Id$
+       * @version $Id$
        */
 
        /**
         * Description
         * @package property
         */
+       phpgw::import_class('phpgwapi.yui');
 
        class property_uigab
        {
@@ -60,14 +61,12 @@
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::location::gabnr';
 
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                                       = 
CreateObject('property.bogab',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
                        $this->bolocation                               = 
CreateObject('property.bolocation');
 
-                       $this->config                           = 
CreateObject('phpgwapi.config');
+                       $this->config                           = 
CreateObject('phpgwapi.config','property');
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location             = '.location';
                        $this->acl_read                         = 
$this->acl->check('.location', PHPGW_ACL_READ, 'property');
@@ -180,9 +179,6 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('gab',
-                                                                               
'nextmatchs'));
-
                        $address                = phpgw::get_var('address');
                        $check_payments         = 
phpgw::get_var('check_payments', 'bool');
                        $location_code          = 
phpgw::get_var('location_code');
@@ -190,285 +186,538 @@
                        $bruksnr                = phpgw::get_var('bruksnr', 
'int');
                        $feste_nr               = phpgw::get_var('feste_nr', 
'int');
                        $seksjons_nr            = phpgw::get_var('seksjons_nr', 
'int');
-                       $reset_query            = phpgw::get_var('reset_query', 
'bool');
 
-                       if($reset_query)
+                       $datatable = array();
+                       $values_combo_box = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
-                               unset($address);
-                               unset($check_payments);
-                               unset($location_code);
-                               unset($gaards_nr);
-                               unset($bruksnr);
-                               unset($feste_nr);
-                               unset($seksjons_nr);
-                       }
+                               $datatable['menu']                              
= $this->bocommon->get_menu();
 
-                       $gab_list = 
$this->bo->read($location_code,$gaards_nr,$bruksnr,$feste_nr,$seksjons_nr,$address,$check_payments);
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uigab.index',
+                                                       'location_code'         
=> $location_code,
+                                                       'gaards_nr'             
=> $gaards_nr,
+                                                       'bruksnr'               
=> $bruksnr,
+                                                       'feste_nr'              
=> $feste_nr,
+                                                       'seksjons_nr'   => 
$seksjons_nr,
+                                                       'address'               
=> $address,
+                                                       'check_payments'        
=> $check_payments
+
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uigab.index',"
+                                                                               
                ."location_code:'{$location_code}',"
+                                                                               
                ."gaards_nr:'{$gaards_nr}',"
+                                                                               
."bruksnr: '{$bruksnr}',"
+                                                                               
."feste_nr:'{$feste_nr}',"
+                                                                               
."seksjons_nr:'{$seksjons_nr}',"
+                                                                               
."address:'{$address}',"
+                                                                               
."check_payments:'{$check_payments}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uigab.index',
+                                                                       
'location_code'         => $location_code,
+                                                                       
'gaards_nr'             => $gaards_nr,
+                                                                       
'bruksnr'               => $bruksnr,
+                                                                       
'feste_nr'              => $feste_nr,
+                                                                       
'seksjons_nr'   => $seksjons_nr,
+                                                                       
'address'               => $address,
+                                                                       
'check_payments'        => $check_payments
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+
+                                                                       array( 
// address label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_address',
+                                                                               
                                'value' => lang('Address'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'address',
+                                                                   'id'     => 
'txt_address',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   'tab_index' 
=> 1,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// check label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_check',
+                                                                               
                                'value' => lang('check payments'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'check',
+                                                                   'id'     => 
'txt_check',
+                                                                   'value'    
=> 0,//$query,
+                                                                   'type' => 
'checkbox',
+                                                                   'tab_index' 
=> 2,
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                               
                        array( //hidden check_payments
+                                                                               
'type'  => 'hidden',
+                                                                               
'name'     => 'check_payments',
+                                                                               
'id'    => 'txt_check_payments',
+                                                                               
'value' => 0,
+                                                                               
'style' => 'filter'
+                                                                           ),
+                                                                       array( 
// location_code label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_property_id',
+                                                                               
                                'value' => lang('property id'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'location_code',
+                                                                   'id'     => 
'txt_location_code',
+                                                                   'value'    
=> $location_code,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 3,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// gaards_nr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_gaards_nr',
+                                                                               
                                'value' => lang('gaards nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'gaards_nr',
+                                                                   'id'     => 
'txt_gaards_nr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 4,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// bruksnr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_bruksnr',
+                                                                               
                                'value' => lang('bruks nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'bruksnr',
+                                                                   'id'     => 
'txt_bruksnr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 5,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// feste_nr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_feste_nr',
+                                                                               
                                'value' => lang('Feste nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'feste_nr',
+                                                                   'id'     => 
'txt_feste_nr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 6,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// seksjons_nr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_seksjons_nr',
+                                                                               
                                'value' => lang('Seksjons nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'seksjons_nr',
+                                                                   'id'     => 
'txt_seksjons_nr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 7,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 8,
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                               array( //boton  
   reset
+                                                                   'id' => 
'btn_reset',
+                                                                   'name' => 
'reset',
+                                                                   'value'    
=> lang('reset'),
+                                                                   'type' => 
'reset',
+                                                                   'tab_index' 
=> 9,
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                               array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'tab_index' => 10,
+                                                                               
'value' => lang('add'),
+                                                                               
'style' => 'filter'
+                                                                           ),
+                                                               array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_export',
+                                                                               
'tab_index' => 11,
+                                                                               
'value' => lang('download'),
+                                                                               
'style' => 'filter'
+                                                                           )
+
+
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
 
-                       if($this->acl_read)
-                       {
-                               $text_view      = lang('view');
-                               $lang_view_statustext   = lang('view gab 
detail');
                        }
 
+                       $gab_list = 
$this->bo->read($location_code,$gaards_nr,$bruksnr,$feste_nr,$seksjons_nr,$address,$check_payments);
+
                        $config         = 
CreateObject('phpgwapi.config','property');
 
                        $config->read_repository();
 
                        $link_to_map = 
(isset($config->config_data['map_url'])?$config->config_data['map_url']:'');
-
                        if($link_to_map)
                        {
                                $text_map=lang('Map');
-                               $lang_map_statustext    = lang('View map');
                        }
+
                        $link_to_gab = 
(isset($config->config_data['gab_url'])?$config->config_data['gab_url']:'');
                        if($link_to_gab)
                        {
                                $text_gab=lang('GAB');
-                               $lang_gab_statustext    = lang('View gab-info');
                        }
 
                        $payment_date = $this->bo->payment_date;
 
-                       $i=0;
+                       $uicols = array (
+                               'input_type'    =>      
array('hidden','text','text','text','text','hidden','text','text','text','link','link'),
+                               'name'                  =>      
array('gab_id','gaards_nr','bruksnr','feste_nr','seksjons_nr','hits','owner','location_code','address','map','gab'),
+                               'formatter'             =>      
array('','','','','','','','','','',''),
+                               'descr'                 =>      
array('dummy',lang('Gaards nr'),lang('Bruks nr'),lang('Feste 
nr'),lang('Seksjons 
nr'),lang('hits'),lang('Owner'),lang('Location'),lang('Address'),lang('Map'),lang('Gab')),
+                               'className'             =>      
array('','','','','','','','','','','')
+                               );
 
-                       $content=array();
-                       while (is_array($gab_list) && list(,$gab) = 
each($gab_list))
+                       while (is_array($payment_date) && list(,$date) = 
each($payment_date))
                        {
-                               if(is_array($payment_date))
+                               $uicols['input_type'][] = 'date';
+                               $uicols['name'][] = str_replace('/','_',$date);
+                               $uicols['formatter'][] = '';
+                               $uicols['descr'][] = $date;
+                               $uicols['className'][] = 'rightClasss';
+
+                               $uicols_add['input_type'][] = 'date';
+                               $uicols_add['name'][] = 
str_replace('/','_',$date);
+                               $uicols_add['formatter'][] = '';
+                               $uicols_add['descr'][] = $date;
+                               $uicols_add['className'][] = 'rightClasss';
+                       }
+
+                       $content = array();
+                       $j=0;
+                       if (isset($gab_list) && is_array($gab_list))
                                {
-                                       reset($payment_date);
+                               foreach($gab_list as $gab)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       if ($uicols['name'][$i] 
== 'gaards_nr')
+                                                       {
+                                                               
$value_gaards_nr        = substr($gab['gab_id'],4,5);
+                                                               $value  = 
$value_gaards_nr;
+
+                                                       }
+                                                       else if 
($uicols['name'][$i] == 'bruksnr')
+                                                       {
+                                                               $value_bruks_nr 
        = substr($gab['gab_id'],9,4);
+                                                               $value  = 
$value_bruks_nr;
+
+                                                       }
+                                                       else if 
($uicols['name'][$i] == 'feste_nr')
+                                                       {
+                                                               $value_feste_nr 
        = substr($gab['gab_id'],13,4);
+                                                               $value  = 
$value_feste_nr;
+
+                                                       }
+                                                       else if 
($uicols['name'][$i] == 'seksjons_nr')
+                                                       {
+                                                               
$value_seksjons_nr      = substr($gab['gab_id'],17,3);
+                                                               $value  = 
$value_seksjons_nr;
+
+                                                       }
+                                                       else
+                                                       {
+                                                               $value  = 
isset($gab[$uicols['name'][$i]]) ? $gab[$uicols['name'][$i]] : '';
                                }
+
+                                                   
$datatable['rows']['row'][$j]['column'][$i]['value']                        = 
$value;
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
'center';
+
+                                                       
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'map' )
+                                                       {
+                                                               
$value_gaards_nr        = substr($gab['gab_id'],4,5);
+                                                               $value_bruks_nr 
        = substr($gab['gab_id'],9,4);
+                                                               $value_feste_nr 
        = substr($gab['gab_id'],13,4);
+                                                               $link = 
phpgw::safe_redirect($link_to_map . '?maptype=Eiendomskart&gnr=' . 
(int)$value_gaards_nr . '&bnr=' . (int)$value_bruks_nr . '&fnr=' . 
(int)$value_feste_nr);
+
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $text_map;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']             = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
+                                                       }
+                                                       
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'gab' )
+                                                       {
                                $value_gaards_nr        = 
substr($gab['gab_id'],4,5);
                                $value_bruks_nr         = 
substr($gab['gab_id'],9,4);
                                $value_feste_nr         = 
substr($gab['gab_id'],13,4);
                                $value_seksjons_nr      = 
substr($gab['gab_id'],17,3);
+                                                               $link = 
phpgw::safe_redirect($link_to_gab . '?type=eiendom&Gnr=' . 
(int)$value_gaards_nr . '&Bnr=' . (int)$value_bruks_nr . '&Fnr=' . 
(int)$value_feste_nr . '&Snr=' . (int)$value_seksjons_nr);
 
-                               $content[] = array
-                               (
-                                       'owner'                         => 
lang($gab['owner']),
-                                       'hits'                          => 
$gab['hits'],
-                                       'address'                       => 
$gab['address'],
-                                       'gaards_nr'                     => 
$value_gaards_nr,
-                                       'bruks_nr'                      => 
$value_bruks_nr,
-                                       'feste_nr'                      => 
$value_feste_nr,
-                                       'seksjons_nr'                   => 
$value_seksjons_nr,
-                                       'location_code'                 => 
$gab['location_code'],
-                                       'link_view'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uigab.list_detail','gab_id'=>$gab['gab_id'])),
-                                       'lang_view_statustext'          => 
$lang_view_statustext,
-                                       'text_view'                     => 
$text_view,
-                                       'link_map'                      => 
phpgw::safe_redirect($link_to_map . '?maptype=Eiendomskart&gnr=' . 
(int)$value_gaards_nr . '&bnr=' . (int)$value_bruks_nr . '&fnr=' . 
(int)$value_feste_nr),
-                                       'lang_map_statustext'           => 
$lang_map_statustext,
-                                       'text_map'                      => 
$text_map,
-                                       'link_gab'                      => 
phpgw::safe_redirect($link_to_gab . '?type=eiendom&Gnr=' . 
(int)$value_gaards_nr . '&Bnr=' . (int)$value_bruks_nr . '&Fnr=' . 
(int)$value_feste_nr . '&Snr=' . (int)$value_seksjons_nr),
-                                       'lang_gab_statustext'           => 
$lang_gab_statustext,
-                                       'text_gab'                      => 
$text_gab
-                               );
-                               while (is_array($payment_date) && list(,$date) 
= each($payment_date))
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $text_gab;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']             = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
+                                                       }
+
+                                                       if 
(isset($uicols['input_type'][$i]) && $uicols['input_type'][$i]=='date')
+                                                       {
+                                                           
$datatable['rows']['row'][$j]['column'][$i]['value']                        = 
$gab['payment'][str_replace('_','/',$uicols['name'][$i])];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
'right';
+                                                       }
+                                               }
+                                               else
                                {
-                                       $content[$i]['payment'][] = 
array('amount' => $gab['payment'][$date]);
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$gab[$uicols['name'][$i]];
                                }
 
-                               $i++;
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                    = 
isset($gab[$uicols['name'][$i]]) ? $gab[$uicols['name'][$i]] : '';
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                     = 
$uicols['name'][$i];
+                                       }
+
+                                       $j++;
+                               }
                        }
 
-                       $table_header[] = array
+                       // NO pop-up
+                       $datatable['rowactions']['action'] = array();
+//                     if(!$lookup)
+                       {
+                               $parameters = array
                        (
-                               'sort_gab_id'   => 
$this->nextmatchs->show_sort_order(array
+                                       'parameter' => array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'gab_id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra' => array('menuaction'=> 'property.uigab.index',
-                                                                               
                                'cat_id'        =>$this->cat_id,
-                                                                               
                        //      'district_id'   => $this->district_id,
-                                                                               
                                'filter'        =>$this->filter,
-                                                                               
                                'allrows'       => $this->allrows,
-                                                                               
                                'query'         =>$this->query,
-                                                                               
                                'location_code' =>$location_code,
-                                                                               
                                'gaards_nr'     =>$gaards_nr,
-                                                                               
                                'bruksnr'       =>$bruksnr,
-                                                                               
                                'feste_nr'      =>$feste_nr,
-                                                                               
                                'seksjons_nr'   =>$seksjons_nr,
-                                                                               
                                'address'       =>$address,
-                                                                               
                                'check_payments'        =>$check_payments)
-                                                                               
)),
-                               'lang_gab'      => lang('gab'),
-                               'sort_hits'     => 
$this->nextmatchs->show_sort_order(array
+                                               array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'hits',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra' => array('menuaction'=> 'property.uigab.index',
-                                                                               
                                'cat_id'        =>$this->cat_id,
-                                                                               
                        //      'district_id'   => $this->district_id,
-                                                                               
                                'filter'        =>$this->filter,
-                                                                               
                                'allrows'       => $this->allrows,
-                                                                               
                                'query'         =>$this->query,
-                                                                               
                                'location_code' =>$location_code,
-                                                                               
                                'gaards_nr'     =>$gaards_nr,
-                                                                               
                                'bruksnr'       =>$bruksnr,
-                                                                               
                                'feste_nr'      =>$feste_nr,
-                                                                               
                                'seksjons_nr'   =>$seksjons_nr,
-                                                                               
                                'address'       =>$address,
-                                                                               
                                'check_payments'        =>$check_payments)
-                                                                               
)),
-                               'sort_location_code'    => 
$this->nextmatchs->show_sort_order(array
+                                                       'name'          => 
'gab_id',
+                                                       'source'        => 
'gab_id'
+                                               ),
+                                       )
+                               );
+
+                               if($this->acl_read)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'location_code',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra' => array('menuaction'=> 'property.uigab.index',
-                                                                               
                                'cat_id'        =>$this->cat_id,
-                                                                               
                        //      'district_id'   => $this->district_id,
-                                                                               
                                'filter'        =>$this->filter,
-                                                                               
                                'allrows'       => $this->allrows,
-                                                                               
                                'query'         =>$this->query,
-                                                                               
                                'location_code' =>$location_code,
-                                                                               
                                'gaards_nr'     =>$gaards_nr,
-                                                                               
                                'bruksnr'       =>$bruksnr,
-                                                                               
                                'feste_nr'      =>$feste_nr,
-                                                                               
                                'seksjons_nr'   =>$seksjons_nr,
-                                                                               
                                'address'       =>$address,
-                                                                               
                                'check_payments'        =>$check_payments)
+                                                                               
        'menuaction'    => 'property.uigab.list_detail'
                                                                                
)),
-                               'lang_owner'            => lang('owner'),
-                               'lang_hits'             => lang('hits'),
-                               'lang_address'          => lang('Address'),
-                               'lang_gaards_nr'        => lang('gaards nr'),
-                               'lang_bruksnr'          => lang('bruks nr'),
-                               'lang_feste_nr'         => lang('Feste nr'),
-                               'lang_seksjons_nr'      => lang('Seksjons nr'),
-                               'lang_location_code'=> lang('Location'),
-                               'lang_view'                     => lang('view'),
-                               'lang_map'                      => lang('map'),
+                                               'parameters'    => $parameters
                                );
+                               }
 
-                       $colspan = count($table_header[0]);
-
-                       if(is_array($payment_date))
+                               if($this->acl_add)
                        {
-                               reset($payment_date);
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'add',
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
        (
+                                                                               
                'menuaction'    => 'property.uigab.edit',
+                                                                               
                'from'                  => 'index'
+                                                                               
        ))
+                                       );
+                               }
+                               unset($parameters);
                        }
 
-                       while (is_array($payment_date) && list(,$date) = 
each($payment_date))
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
+                       $uicols_count   = count($uicols['descr']);
+
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
-                               $table_header[0]['payment_header'][] = 
array('header'=>$date);
-                               $colspan++;
-                       }
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
 
-                       $search_field_header[] = array
-                       (
-                               'lang_property'         => lang('Property ID'),
-                               'lang_gaards_nr'        => lang('gaards nr'),
-                               'lang_bruksnr'          => lang('bruks nr'),
-                               'lang_feste_nr'         => lang('Feste nr'),
-                               'lang_seksjons_nr'      => lang('Seksjons nr')
-                               );
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
 
-                       if($this->acl_add)
+                                       if($uicols['name'][$i]=='gaards_nr'):
                        {
-                               $table_add[] = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
gab'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uigab.edit', 
'from'=>'index'))
-                               );
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'gab_id';
+                                       }
+                                       
elseif($uicols['name'][$i]=='location_code'):
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'location_code';
+                                       }
+                                       endif;
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
                        }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uigab.index',
-                                       'sort'          =>$this->sort,
-                                       'order'         =>$this->order,
-                                       'cat_id'        =>$this->cat_id,
-                                       'filter'        =>$this->filter,
-                                       'location_code' =>$location_code,
-                                       'gaards_nr'     =>$gaards_nr,
-                                       'bruksnr'       =>$bruksnr,
-                                       'feste_nr'      =>$feste_nr,
-                                       'seksjons_nr'   =>$seksjons_nr,
-                                       'address'       =>$address,
-                                       'check_payments'        
=>$check_payments
-                       );
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($gab_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       $link_download = array
-                       (
-                               'menuaction'    => 'property.uigab.download',
-                                       'sort'          =>$this->sort,
-                                       'order'         =>$this->order,
-                                       'cat_id'        =>$this->cat_id,
-                                       'filter'        =>$this->filter,
-                                       'location_code' =>$location_code,
-                                       'gaards_nr'     =>$gaards_nr,
-                                       'bruksnr'       =>$bruksnr,
-                                       'feste_nr'      =>$feste_nr,
-                                       'seksjons_nr'   =>$seksjons_nr,
-                                       'address'       =>$address,
-                                       'check_payments'        
=>$check_payments
-                       );
+                       $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // Column
 
+                       $appname                = lang('gab');
+                       $function_msg   = lang('list gab');
 
-                       if(!$this->allrows)
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                           $datatable['sorting']['order']              = 
'gab_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']           = 
'asc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                           $datatable['sorting']['order']      = 
phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']           = 
phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
 
-                       $data = array
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('tabview');
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       //values for Pagination
+                       $json = array
                        (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_download'                         => 
'download',
-                               'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                    => 
lang('Download table to your browser'),
-
-                               'search_field_header'                   => 
$search_field_header,
-                               'allrows'                               => 
$this->allrows,
-                               'allow_allrows'                         => true,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($gab_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'address'                               => 
$address,
-                               'location_code'                         => 
$location_code,
-                               'gaards_nr'                             => 
$gaards_nr,
-                               'bruksnr'                               => 
$bruksnr,
-                               'feste_nr'                              => 
$feste_nr,
-                               'seksjons_nr'                           => 
$seksjons_nr,
-                               'lang_search_location_statustext'       => 
lang('search by location_code. To show all entries, empty all fields and press 
the SUBMIT button again'),
-                               'lang_search_gaard_statustext'          => 
lang('search by gaards nr. To show all entries, empty all fields and press the 
SUBMIT button again'),
-                               'lang_search_bruk_statustext'           => 
lang('search by bruk. To show all entries, empty all fields and press the 
SUBMIT button again'),
-                               'lang_search_feste_statustext'          => 
lang('search by feste. To show all entries, empty all fields and press the 
SUBMIT button again'),
-                               'lang_search_seksjon_statustext'        => 
lang('search by seksjon. To show all entries, empty all fields and press the 
SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'lang_reset_query_statustext'           => 
lang('check to reset the query'),
-                               'lang_search'                           => 
lang('search'),
-                               'table_header_gab'                      => 
$table_header,
-                               'values_gab'                            => 
$content,
-                               'table_add'                             => 
$table_add,
-                               'lang_check_payments'                   => 
lang('check payments'),
-                               'lang_check_payments_statustext'        => 
lang('List payments history'),
-                               'value_check_payments'                  => 
$check_payments,
-                               'colspan'                               => 
$colspan
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                       //          'headers'                   => 
$uicols_add['name'],
+                                   'headers_all'               => 
$uicols['name']
                        );
 
-                       $appname                = lang('gab');
-                       $function_msg   = lang('list gab');
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && isset($column['java_link']) && 
$column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
 
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'gab.index', 'property' );
+
                        $this->save_sessiondata();
+
                }
 
                function list_detail()
@@ -478,218 +727,320 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('gab', 
'values', 'table_header', 'nextmatchs'));
-
                        $gab_id                 = phpgw::get_var('gab_id');
 
-                       $gab_list = $this->bo->read_detail($gab_id);
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'    => 
'property.uigab.list_detail',
+                                               'gab_id'                => 
$gab_id
+                                       ));
+                                       
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uigab.list_detail',"
+                                                                               
."gab_id: '{$gab_id}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uigab.list_detail'
+                                                                       
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                                               
                        array( // mensaje
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'msg_header',
+                                                                               
                                'value' => '',
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                        array( // boton done
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_done',
+                                                                               
                                'tab_index' => 1,
+                                                                               
                                'value' => lang('done')
+                                                                               
                        ),                                                      
                                        
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 2
+                                                                           )   
                                                                                
                
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                               
+                       }
+                       
+                       $gab_list = $this->bo->read_detail($gab_id, true);
 
                        $uicols = $this->bo->uicols;
 
+                       $content = array();
                        $j=0;
-                       while (is_array($gab_list) && list(,$gab_entry) = 
each($gab_list))
+                       if (isset($gab_list) && is_array($gab_list))
                        {
-                               for ($k=0;$k<count($uicols['name']);$k++)
+                               foreach($gab_list as $gab_entry)
                                {
-                                       if($uicols['input_type'][$k]!='hidden')
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
                                        {
-                                               
$content[$j]['row'][$k]['value']                        = 
$gab_entry[$uicols['name'][$k]];
-                                               $content[$j]['row'][$k]['name'] 
                        = $uicols['name'][$k];
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$gab_entry[$uicols['name'][$i]];
+                                               }
+                                       }
+                                       $j++;
                                        }
                                }
 
+                       $datatable['rowactions']['action'] = array();
                                if(!$lookup)
                                {
+                               $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'location_code',
+                                                       'source'        => 
'location_code'
+                                               ),
+                                       )
+                               );
+
                                        if($this->acl_read)
                                        {
-                                               
$content[$j]['row'][$k]['statustext']                   = lang('view the gab');
-                                               $content[$j]['row'][$k]['text'] 
                                = lang('view');
-                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.view', 'gab_id' => $gab_entry['gab_id'], 
'location_code'=>$gab_entry['location_code']));
-                                               $k++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uigab.view',
+                                                                               
        'gab_id'                =>      $gab_id
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
 
                                        if($this->acl_edit)
                                        {
-                                               
$content[$j]['row'][$k]['statustext']                   = lang('edit the gab');
-                                               $content[$j]['row'][$k]['text'] 
                                = lang('edit');
-                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.edit', 'gab_id'=> $gab_entry['gab_id'], 
'location_code'=>$gab_entry['location_code'], 'from'=>'list_detail'));
-                                               $k++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'edit',
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
        (
+                                                                               
                'menuaction'    => 'property.uigab.edit',
+                                                                               
                'from'                  => 'list_detail',
+                                                                               
                'gab_id'                =>      $gab_id
+                                                                               
        )),
+                                                       'parameters'    => 
$parameters
+                                       );
                                        }
 
                                        if($this->acl_delete)
                                        {
-                                               
$content[$j]['row'][$k]['statustext']                   = lang('delete the 
gab');
-                                               $content[$j]['row'][$k]['text'] 
                                = lang('delete');
-                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.delete', 'gab_id'=> $gab_entry['gab_id'], 'location_code'=> 
$gab_entry['location_code']));
-                                               $k++;
-                                       }
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'delete',
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
        (
+                                                                               
                'menuaction'    => 'property.uigab.delete',
+                                                                               
                'gab_id'                =>      $gab_id
+                                                                               
        )),
+                                                       'parameters'    => 
$parameters
+                                       );
                                }
 
-                               $j++;
+                               if($this->acl_add)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'add',
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
        (
+                                                                               
                'menuaction'    => 'property.uigab.edit',
+                                                                               
                'gab_id'                =>      $gab_id,
+                                                                               
                'from'                  => 'list_detail',
+                                                                               
                'new'                   =>      true                            
                                        
+                                                                               
        ))
+                                       );
+                               }                                       
+                               unset($parameters);
                        }
 
-                       for ($i=0;$i<count($uicols['descr']);$i++)
+                       $uicols_count   = count($uicols['descr']);
+
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
                                if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'location_code',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uigab.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
-                                       }
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
                                        if($uicols['name'][$i]=='gab_id')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'gab_id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uigab.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'gab_id';
                                        }
+                                       
                                        if($uicols['name'][$i]=='address')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'address',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uigab.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
-                                       }
-                               }
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'address';
                        }
 
-                       if(!$lookup)
-                       {
-                               if($this->acl_read)
-                               {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('view');
-                                       $i++;
                                }
-                               if($this->acl_edit)
+                               else
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('edit');
-                                       $i++;
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
                                }
-                               if($this->acl_delete)
-                               {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('delete');
-                                       $i++;
                                }
+
+                       $gaards_nr      = substr($gab_id,4,5);
+                       $bruks_nr = substr($gab_id,9,4);
+                       $feste_nr       = substr($gab_id,13,4);
+                       $seksjons_nr = substr($gab_id,17,3);
+                               
+                       $info = array ();
+                       $info[0]['name'] = lang('gaards nr');           
+                       $info[0]['value'] = $gaards_nr;
+                       $info[1]['name'] = lang('bruks nr');            
+                       $info[1]['value'] = $bruks_nr;                          
                                                                                
                                                                                
                                
+                       $info[2]['name'] = lang('Feste nr');            
+                       $info[2]['value'] = $feste_nr;          
+                       $info[3]['name'] = lang('Seksjons nr');         
+                       $info[3]['value'] = $seksjons_nr;               
+                       $info[4]['name'] = lang('owner');               
+                       $info[4]['value'] = lang($gab_list[0]['owner']);        
        
+                                                       
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+               
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($gab_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;                     
+                       
+                       $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // Column
+
+                       $appname                = lang('gab');
+                       $function_msg   = lang('list gab detail');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                           $datatable['sorting']['order']              = 
'address'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']           = 
'asc'; // ASC / DESC
                        }
                        else
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']             = 
lang('select');
+                           $datatable['sorting']['order']      = 
phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']           = 
phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-//_debug_array($content);
-                       if($this->acl_add)
-                       {
-                               $table_add[] = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
gab'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.edit', 'from' => 'list_detail', 'gab_id'=> $gab_id, 
'new'=>true))
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('tabview');
 
-                               );
-                       }
 
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $table_done[] = array
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       //values for Pagination
+                       $json = array
                        (
-                               'lang_done'             => lang('done'),
-                               'lang_done_statustext'  => lang('back to list'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.index'))
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'info'                          => $info
                        );
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uigab.list_detail',
-                                               'sort'                  
=>$this->sort,
-                                               'order'                 
=>$this->order,
-                                               'cat_id'                
=>$this->cat_id,
-                                               'filter'                
=>$this->filter,
-                                               'gab_id'                
=>$gab_id
-                       );
-
-                       if(!$this->allrows)
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
                        }
 
-                       $data = array
-                       (
-                               'gaards_nr'                                     
        => substr($gab_id,4,5),
-                               'bruks_nr'                                      
        => substr($gab_id,9,4),
-                               'feste_nr'                                      
        => substr($gab_id,13,4),
-                               'seksjons_nr'                                   
=> substr($gab_id,17,3),
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                               'value_owner'                                   
=> lang($gab_list[0]['owner']),
-                               'lang_owner'                                    
=> lang('owner'),
-                               'lang_gaards_nr'                                
=> lang('gaards nr'),
-                               'lang_bruksnr'                                  
=> lang('bruks nr'),
-                               'lang_feste_nr'                                 
=> lang('Feste nr'),
-                               'lang_seksjons_nr'                              
=> lang('Seksjons nr'),
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
-                               'allrows'                                       
        => $this->allrows,
-                               'allow_allrows'                                 
=> true,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($gab_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
        => $content,
-                               'table_add'                                     
        => $table_add,
-                               'table_done'                                    
=> $table_done
-                       );
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                       $appname                = lang('gab');
-                       $function_msg   = lang('list gab detail');
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
 
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab_detail' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'gab.list_detail', 'property' );
+                                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                        
                        $this->save_sessiondata();
                }
 
@@ -863,6 +1214,13 @@
                        $location_code = phpgw::get_var('location_code');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
+                       //cramirez add JsonCod for Delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       $this->bo->delete($gab_id,$location_code);
+                       return "gab_id ".$gab_id." ".lang("has been deleted");
+                       }
+                       
                        $link_data = array
                        (
                                'menuaction' => 'property.uigab.list_detail',
@@ -968,4 +1326,3 @@
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
        }
-

Added: people/sigurdne/modules/property/trunk/inc/class.uigab.inc_.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uigab.inc_.php             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/class.uigab.inc_.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,1225 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage location
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+       phpgw::import_class('phpgwapi.yui');
+
+       class property_uigab
+       {
+               var $grants;
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+               var $part_of_town_id;
+               var $sub;
+               var $currentapp;
+
+               var $public_functions = array
+               (
+                       'index'         => true,
+                       'list_detail'   => true,
+                       'view'          => true,
+                       'edit'          => true,
+                       'delete'        => true,
+                       'download'      => true
+               );
+
+               function property_uigab()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::location::gabnr';
+
+               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
+                       $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo                                       = 
CreateObject('property.bogab',true);
+                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->bolocation                               = 
CreateObject('property.bolocation');
+
+                       $this->config                           = 
CreateObject('phpgwapi.config','property');
+                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
+                       $this->acl_location             = '.location';
+                       $this->acl_read                         = 
$this->acl->check('.location', PHPGW_ACL_READ, 'property');
+                       $this->acl_add                          = 
$this->acl->check('.location', PHPGW_ACL_ADD, 'property');
+                       $this->acl_edit                         = 
$this->acl->check('.location', PHPGW_ACL_EDIT, 'property');
+                       $this->acl_delete                       = 
$this->acl->check('.location', PHPGW_ACL_DELETE, 'property');
+
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+                       $this->filter                           = 
$this->bo->filter;
+                       $this->cat_id                           = 
$this->bo->cat_id;
+                       $this->allrows                          = 
$this->bo->allrows;
+                       $this->gab_insert_level                 = 
$this->bo->gab_insert_level;
+
+               }
+
+               function save_sessiondata()
+               {
+                       $data = array
+                       (
+                               'start'         => $this->start,
+                               'query'         => $this->query,
+                               'sort'          => $this->sort,
+                               'order'         => $this->order,
+                               'filter'        => $this->filter,
+                               'cat_id'        => $this->cat_id,
+                               'allrows'       => $this->allrows
+                       );
+                       $this->bo->save_sessiondata($data);
+               }
+
+               function download()
+               {
+                       $address                = phpgw::get_var('address');
+                       $check_payments         = 
phpgw::get_var('check_payments', 'bool');
+                       $location_code          = 
phpgw::get_var('location_code');
+                       $gaards_nr              = phpgw::get_var('gaards_nr', 
'int');
+                       $bruksnr                = phpgw::get_var('bruksnr', 
'int');
+                       $feste_nr               = phpgw::get_var('feste_nr', 
'int');
+                       $seksjons_nr            = phpgw::get_var('seksjons_nr', 
'int');
+
+
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $gab_list = 
$this->bo->read($location_code,$gaards_nr,$bruksnr,$feste_nr,$seksjons_nr,$address,$check_payments,$allrows=true);
+
+                       $payment_date = $this->bo->payment_date;
+
+                       $i=0;
+
+                       while (is_array($gab_list) && list(,$gab) = 
each($gab_list))
+                       {
+                               if(is_array($payment_date))
+                               {
+                                       reset($payment_date);
+                               }
+                               $value_gaards_nr        = 
substr($gab['gab_id'],4,5);
+                               $value_bruks_nr         = 
substr($gab['gab_id'],9,4);
+                               $value_feste_nr         = 
substr($gab['gab_id'],13,4);
+                               $value_seksjons_nr      = 
substr($gab['gab_id'],17,3);
+
+                               $content[] = array
+                               (
+                                       'owner'                         => 
lang($gab['owner']),
+                                       'hits'                          => 
$gab['hits'],
+                                       'address'                       => 
$gab['address'],
+                                       'gaards_nr'                     => 
$value_gaards_nr,
+                                       'bruks_nr'                      => 
$value_bruks_nr,
+                                       'feste_nr'                      => 
$value_feste_nr,
+                                       'seksjons_nr'                   => 
$value_seksjons_nr,
+                                       'location_code'                 => 
$gab['location_code'],
+                               );
+
+                               while (is_array($payment_date) && list(,$date) 
= each($payment_date))
+                               {
+                                       $content[$i][$date] = 
$gab['payment'][$date];
+                               }
+
+                               $i++;
+                       }
+
+                       //_debug_array($content);
+                       $table_header['name'] = 
array('owner','hits','address','gaards_nr','bruks_nr','feste_nr','seksjons_nr','location_code');
+                       $table_header['descr'] = 
array(lang('owner'),lang('hits'),lang('address'),'gaards_nr','bruks_nr','feste_nr','seksjons_nr','location_code');
+
+                       if(is_array($payment_date))
+                       {
+                               reset($payment_date);
+                       }
+
+                       while (is_array($payment_date) && list(,$date) = 
each($payment_date))
+                       {
+                               $table_header['name'][] = $date;
+                               $table_header['descr'][] = $date;
+                       }
+
+                       
$this->bocommon->download($content,$table_header['name'],$table_header['descr'],array());
+               }
+
+
+               function index()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $address                = phpgw::get_var('address');
+                       $check_payments         = 
phpgw::get_var('check_payments', 'bool');
+                       $location_code          = 
phpgw::get_var('location_code');
+                       $gaards_nr              = phpgw::get_var('gaards_nr', 
'int');
+                       $bruksnr                = phpgw::get_var('bruksnr', 
'int');
+                       $feste_nr               = phpgw::get_var('feste_nr', 
'int');
+                       $seksjons_nr            = phpgw::get_var('seksjons_nr', 
'int');
+
+                       $datatable = array();
+                       $values_combo_box = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                               $datatable['menu']                              
= $this->bocommon->get_menu();
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uigab.index',
+                                                       'location_code'         
=> $location_code,
+                                                       'gaards_nr'             
=> $gaards_nr,
+                                                       'bruksnr'               
=> $bruksnr,
+                                                       'feste_nr'              
=> $feste_nr,
+                                                       'seksjons_nr'   => 
$seksjons_nr,
+                                                       'address'               
=> $address,
+                                                       'check_payments'        
=> $check_payments
+
+                                       ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uigab.index',"
+                                                                               
                ."location_code:'{$location_code}',"
+                                                                               
                ."gaards_nr:'{$gaards_nr}',"
+                                                                               
."bruksnr: '{$bruksnr}',"
+                                                                               
."feste_nr:'{$feste_nr}',"
+                                                                               
."seksjons_nr:'{$seksjons_nr}',"
+                                                                               
."address:'{$address}',"
+                                                                               
."check_payments:'{$check_payments}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uigab.index',
+                                                                       
'location_code'         => $location_code,
+                                                                       
'gaards_nr'             => $gaards_nr,
+                                                                       
'bruksnr'               => $bruksnr,
+                                                                       
'feste_nr'              => $feste_nr,
+                                                                       
'seksjons_nr'   => $seksjons_nr,
+                                                                       
'address'               => $address,
+                                                                       
'check_payments'        => $check_payments
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+
+                                                                       array( 
// address label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_address',
+                                                                               
                                'value' => lang('Address'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'address',
+                                                                   'id'     => 
'txt_address',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   'tab_index' 
=> 1,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// check label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_check',
+                                                                               
                                'value' => lang('check payments'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'check',
+                                                                   'id'     => 
'txt_check',
+                                                                   'value'    
=> 0,//$query,
+                                                                   'type' => 
'checkbox',
+                                                                   'tab_index' 
=> 2,
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                               
                        array( //hidden check_payments
+                                                                               
'type'  => 'hidden',
+                                                                               
'name'     => 'check_payments',
+                                                                               
'id'    => 'txt_check_payments',
+                                                                               
'value' => 0,
+                                                                               
'style' => 'filter'
+                                                                           ),
+                                                                       array( 
// location_code label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_property_id',
+                                                                               
                                'value' => lang('property id'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'location_code',
+                                                                   'id'     => 
'txt_location_code',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 3,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// gaards_nr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_gaards_nr',
+                                                                               
                                'value' => lang('gaards nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'gaards_nr',
+                                                                   'id'     => 
'txt_gaards_nr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 4,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// bruksnr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_bruksnr',
+                                                                               
                                'value' => lang('bruks nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'bruksnr',
+                                                                   'id'     => 
'txt_bruksnr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 5,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// feste_nr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_feste_nr',
+                                                                               
                                'value' => lang('Feste nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'feste_nr',
+                                                                   'id'     => 
'txt_feste_nr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 6,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                                       array( 
// seksjons_nr label
+                                                                               
'type' => 'label',
+                                                                               
'id' => 'lbl_seksjons_nr',
+                                                                               
                                'value' => lang('Seksjons nr'),
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'seksjons_nr',
+                                                                   'id'     => 
'txt_seksjons_nr',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 6,
+                                                                   'tab_index' 
=> 7,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 8,
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                               array( //boton  
   reset
+                                                                   'id' => 
'btn_reset',
+                                                                   'name' => 
'reset',
+                                                                   'value'    
=> lang('reset'),
+                                                                   'type' => 
'reset',
+                                                                   'tab_index' 
=> 9,
+                                                                   'style' => 
'filter'
+                                                               ),
+                                                               array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'tab_index' => 10,
+                                                                               
'value' => lang('add'),
+                                                                               
'style' => 'filter'
+                                                                           ),
+                                                               array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_export',
+                                                                               
'tab_index' => 11,
+                                                                               
'value' => lang('download'),
+                                                                               
'style' => 'filter'
+                                                                           )
+
+
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+
+                       }
+
+                       $gab_list = 
$this->bo->read($location_code,$gaards_nr,$bruksnr,$feste_nr,$seksjons_nr,$address,$check_payments);
+
+                       $config         = 
CreateObject('phpgwapi.config','property');
+
+                       $config->read_repository();
+
+                       $link_to_map = 
(isset($config->config_data['map_url'])?$config->config_data['map_url']:'');
+                       if($link_to_map)
+                       {
+                               $text_map=lang('Map');
+                       }
+
+                       $link_to_gab = 
(isset($config->config_data['gab_url'])?$config->config_data['gab_url']:'');
+                       if($link_to_gab)
+                       {
+                               $text_gab=lang('GAB');
+                       }
+
+                       $payment_date = $this->bo->payment_date;
+
+                       $uicols = array (
+                               'input_type'    =>      
array(hidden,text,text,text,text,hidden,text,text,text,link,link),
+                               'name'                  =>      
array(gab_id,gaards_nr,bruksnr,feste_nr,seksjons_nr,hits,owner,location_code,address,map,gab),
+                               'formatter'             =>      
array('','','','','','','','','','',''),
+                               'descr'                 =>      
array(dummy,lang('Gaards nr'),lang('Bruks nr'),lang('Feste nr'),lang('Seksjons 
nr'),lang('hits'),lang('Owner'),lang('Location'),lang('Address'),lang('Map'),lang('Gab')),
+                               'className'             =>      
array('','','','','','','','','','','')
+                               );
+
+                       while (is_array($payment_date) && list(,$date) = 
each($payment_date))
+                       {
+                               $uicols['input_type'][] = 'date';
+                               $uicols['name'][] = str_replace('/','_',$date);
+                               $uicols['formatter'][] = '';
+                               $uicols['descr'][] = $date;
+                               $uicols['className'][] = 'rightClasss';
+
+                               $uicols_add['input_type'][] = 'date';
+                               $uicols_add['name'][] = 
str_replace('/','_',$date);
+                               $uicols_add['formatter'][] = '';
+                               $uicols_add['descr'][] = $date;
+                               $uicols_add['className'][] = 'rightClasss';
+                       }
+
+                       $content = array();
+                       $j=0;
+                       if (isset($gab_list) && is_array($gab_list))
+                       {
+                               foreach($gab_list as $gab)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       if ($uicols['name'][$i] 
== 'gaards_nr')
+                                                       {
+                                                               
$value_gaards_nr        = substr($gab['gab_id'],4,5);
+                                                               $value  = 
$value_gaards_nr;
+
+                                                       } elseif 
($uicols['name'][$i] == 'bruksnr') {
+
+                                                               $value_bruks_nr 
        = substr($gab['gab_id'],9,4);
+                                                               $value  = 
$value_bruks_nr;
+
+                                                       } elseif 
($uicols['name'][$i] == 'feste_nr') {
+
+                                                               $value_feste_nr 
        = substr($gab['gab_id'],13,4);
+                                                               $value  = 
$value_feste_nr;
+
+                                                       } elseif 
($uicols['name'][$i] == 'seksjons_nr') {
+
+                                                               
$value_seksjons_nr      = substr($gab['gab_id'],17,3);
+                                                               $value  = 
$value_seksjons_nr;
+
+                                                       } else {
+                                                               $value  = 
$gab[$uicols['name'][$i]];
+                                                   }
+
+                                                   
$datatable['rows']['row'][$j]['column'][$i]['value']                        = 
$value;
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
'center';
+
+                                                       
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'map' )
+                                                       {
+                                                               
$value_gaards_nr        = substr($gab['gab_id'],4,5);
+                                                               $value_bruks_nr 
        = substr($gab['gab_id'],9,4);
+                                                               $value_feste_nr 
        = substr($gab['gab_id'],13,4);
+                                                               $link = 
phpgw::safe_redirect($link_to_map . '?maptype=Eiendomskart&gnr=' . 
(int)$value_gaards_nr . '&bnr=' . (int)$value_bruks_nr . '&fnr=' . 
(int)$value_feste_nr);
+
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $text_map;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']             = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
+                                                       }
+                                                       
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'gab' )
+                                                       {
+                                                               
$value_gaards_nr        = substr($gab['gab_id'],4,5);
+                                                               $value_bruks_nr 
        = substr($gab['gab_id'],9,4);
+                                                               $value_feste_nr 
        = substr($gab['gab_id'],13,4);
+                                                               
$value_seksjons_nr      = substr($gab['gab_id'],17,3);
+                                                               $link = 
phpgw::safe_redirect($link_to_gab . '?type=eiendom&Gnr=' . 
(int)$value_gaards_nr . '&Bnr=' . (int)$value_bruks_nr . '&Fnr=' . 
(int)$value_feste_nr . '&Snr=' . (int)$value_seksjons_nr);
+
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $text_gab;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']             = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
+                                                       }
+
+                                                       if 
(isset($uicols['input_type'][$i]) && $uicols['input_type'][$i]=='date')
+                                                       {
+                                                           
$datatable['rows']['row'][$j]['column'][$i]['value']                        = 
$gab['payment'][str_replace('_','/',$uicols['name'][$i])];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
'right';
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$gab[$uicols['name'][$i]];
+                                               }
+
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                    = 
$gab[$uicols['name'][$i]];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                     = 
$uicols['name'][$i];
+                                       }
+
+                                       $j++;
+                               }
+                       }
+
+                       // NO pop-up
+                       $datatable['rowactions']['action'] = array();
+                       if(!$lookup)
+                       {
+                               $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'gab_id',
+                                                       'source'        => 
'gab_id'
+                                               ),
+                                       )
+                               );
+
+                               if($this->acl_read)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uigab.list_detail'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+                               }
+
+                               if($this->acl_add)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'add',
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
        (
+                                                                               
                'menuaction'    => 'property.uigab.edit',
+                                                                               
                'from'                  => 'index'
+                                                                               
        ))
+                                       );
+                               }
+                               unset($parameters);
+                       }
+
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
+                       $uicols_count   = count($uicols['descr']);
+
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       if($uicols['name'][$i]=='gaards_nr'):
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'gab_id';
+                                       }
+                                       
elseif($uicols['name'][$i]=='location_code'):
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'location_code';
+                                       }
+                                       endif;
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
+
+                       if(!$this->allrows)
+                       {
+                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $record_limit   = $this->bo->total_records;
+                       }
+
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($gab_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // Column
+                       $datatable['sorting']['sort']   = 
phpgw::get_var('sort', 'string'); // ASC / DESC
+
+                       $appname                = lang('gab');
+                       $function_msg   = lang('list gab');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                          {
+                           $datatable['sorting']['order']    = 'gab_id'; // 
name key Column in myColumnDef
+                          }
+                          else
+                          {
+                           $datatable['sorting']['order']   = 
phpgw::get_var('order', 'string'); // name of column of Database
+                          }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('tabview');
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                   'headers'                   => 
$uicols_add['name'],
+                                   'headers_all'               => 
$uicols['name']
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'gab.index', 'property' );
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'json-min', 'phpgwapi' );
+
+                       $this->save_sessiondata();
+
+               }
+
+               function list_detail()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('gab', 
'values', 'table_header', 'nextmatchs'));
+
+                       $gab_id                 = phpgw::get_var('gab_id');
+
+                       $gab_list = $this->bo->read_detail($gab_id);
+
+                       $uicols = $this->bo->uicols;
+
+                       $j=0;
+                       while (is_array($gab_list) && list(,$gab_entry) = 
each($gab_list))
+                       {
+                               for ($k=0;$k<count($uicols['name']);$k++)
+                               {
+                                       if($uicols['input_type'][$k]!='hidden')
+                                       {
+                                               
$content[$j]['row'][$k]['value']                        = 
$gab_entry[$uicols['name'][$k]];
+                                               $content[$j]['row'][$k]['name'] 
                        = $uicols['name'][$k];
+                                       }
+                               }
+
+                               if(!$lookup)
+                               {
+                                       if($this->acl_read)
+                                       {
+                                               
$content[$j]['row'][$k]['statustext']                   = lang('view the gab');
+                                               $content[$j]['row'][$k]['text'] 
                                = lang('view');
+                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.view', 'gab_id' => $gab_entry['gab_id'], 
'location_code'=>$gab_entry['location_code']));
+                                               $k++;
+                                       }
+
+                                       if($this->acl_edit)
+                                       {
+                                               
$content[$j]['row'][$k]['statustext']                   = lang('edit the gab');
+                                               $content[$j]['row'][$k]['text'] 
                                = lang('edit');
+                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.edit', 'gab_id'=> $gab_entry['gab_id'], 
'location_code'=>$gab_entry['location_code'], 'from'=>'list_detail'));
+                                               $k++;
+                                       }
+
+                                       if($this->acl_delete)
+                                       {
+                                               
$content[$j]['row'][$k]['statustext']                   = lang('delete the 
gab');
+                                               $content[$j]['row'][$k]['text'] 
                                = lang('delete');
+                                               $content[$j]['row'][$k]['link'] 
                                = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.delete', 'gab_id'=> $gab_entry['gab_id'], 'location_code'=> 
$gab_entry['location_code']));
+                                               $k++;
+                                       }
+                               }
+
+                               $j++;
+                       }
+
+                       for ($i=0;$i<count($uicols['descr']);$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
+                                       $table_header[$i]['width']              
= '5%';
+                                       $table_header[$i]['align']              
= 'center';
+                                       if($uicols['name'][$i]=='loc1')
+                                       {
+                                               $table_header[$i]['sort_link']  
=true;
+                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'location_code',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 'property.uigab.index',
+                                                                               
                                                        'type_id'       
=>$type_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
));
+                                       }
+                                       if($uicols['name'][$i]=='gab_id')
+                                       {
+                                               $table_header[$i]['sort_link']  
=true;
+                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'gab_id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 'property.uigab.index',
+                                                                               
                                                        'type_id'       
=>$type_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
));
+                                       }
+                                       if($uicols['name'][$i]=='address')
+                                       {
+                                               $table_header[$i]['sort_link']  
=true;
+                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'address',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 'property.uigab.index',
+                                                                               
                                                        'type_id'       
=>$type_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'cat_id'        
=>$this->cat_id)
+                                                                               
));
+                                       }
+                               }
+                       }
+
+                       if(!$lookup)
+                       {
+                               if($this->acl_read)
+                               {
+                                       $table_header[$i]['width']              
        = '5%';
+                                       $table_header[$i]['align']              
        = 'center';
+                                       $table_header[$i]['header']             
        = lang('view');
+                                       $i++;
+                               }
+                               if($this->acl_edit)
+                               {
+                                       $table_header[$i]['width']              
        = '5%';
+                                       $table_header[$i]['align']              
        = 'center';
+                                       $table_header[$i]['header']             
        = lang('edit');
+                                       $i++;
+                               }
+                               if($this->acl_delete)
+                               {
+                                       $table_header[$i]['width']              
        = '5%';
+                                       $table_header[$i]['align']              
        = 'center';
+                                       $table_header[$i]['header']             
        = lang('delete');
+                                       $i++;
+                               }
+                       }
+                       else
+                       {
+                               $table_header[$i]['width']                      
= '5%';
+                               $table_header[$i]['align']                      
= 'center';
+                               $table_header[$i]['header']             = 
lang('select');
+                       }
+
+//_debug_array($content);
+                       if($this->acl_add)
+                       {
+                               $table_add[] = array
+                               (
+                                       'lang_add'              => lang('add'),
+                                       'lang_add_statustext'   => lang('add a 
gab'),
+                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.edit', 'from' => 'list_detail', 'gab_id'=> $gab_id, 
'new'=>true))
+
+                               );
+                       }
+
+
+                       $table_done[] = array
+                       (
+                               'lang_done'             => lang('done'),
+                               'lang_done_statustext'  => lang('back to list'),
+                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.index'))
+                       );
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 'property.uigab.list_detail',
+                                               'sort'                  
=>$this->sort,
+                                               'order'                 
=>$this->order,
+                                               'cat_id'                
=>$this->cat_id,
+                                               'filter'                
=>$this->filter,
+                                               'gab_id'                
=>$gab_id
+                       );
+
+                       if(!$this->allrows)
+                       {
+                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $record_limit   = $this->bo->total_records;
+                       }
+
+                       $data = array
+                       (
+                               'gaards_nr'                                     
        => substr($gab_id,4,5),
+                               'bruks_nr'                                      
        => substr($gab_id,9,4),
+                               'feste_nr'                                      
        => substr($gab_id,13,4),
+                               'seksjons_nr'                                   
=> substr($gab_id,17,3),
+
+                               'value_owner'                                   
=> lang($gab_list[0]['owner']),
+                               'lang_owner'                                    
=> lang('owner'),
+                               'lang_gaards_nr'                                
=> lang('gaards nr'),
+                               'lang_bruksnr'                                  
=> lang('bruks nr'),
+                               'lang_feste_nr'                                 
=> lang('Feste nr'),
+                               'lang_seksjons_nr'                              
=> lang('Seksjons nr'),
+
+                               'allrows'                                       
        => $this->allrows,
+                               'allow_allrows'                                 
=> true,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> $record_limit,
+                               'num_records'                                   
=> count($gab_list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                               'table_header'                                  
=> $table_header,
+                               'values'                                        
        => $content,
+                               'table_add'                                     
        => $table_add,
+                               'table_done'                                    
=> $table_done
+                       );
+
+                       $appname                = lang('gab');
+                       $function_msg   = lang('list gab detail');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab_detail' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $this->save_sessiondata();
+               }
+
+
+               function edit()
+               {
+                       if(!$this->acl_add && !$this->acl_edit)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>2, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $from                   = phpgw::get_var('from');
+                       $new                    = phpgw::get_var('new', 'bool');
+                       $gab_id                 = phpgw::get_var('gab_id');
+                       $location_code  = phpgw::get_var('location_code');
+                       $values                 = phpgw::get_var('values');
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
+
+                       if(!$values && $location_code)
+                       {
+                               $values['location_data'] = 
$this->bolocation->read_single($location_code,$values['extra']);
+                       }
+
+//_debug_array($values);
+
+                       if ($values['save'])
+                       {
+                               $insert_record          = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+                               $values = 
$this->bocommon->collect_locationdata($values,$insert_record);
+
+                               $values['gab_id'] = $gab_id;
+
+                               $values['location_code'] = $location_code;
+
+                               if(!$values['location_code'] && 
!$values['location'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+                               }
+
+                               if((count($values['location']) < 
$this->gab_insert_level) && !$values['propagate'] && !$values['location_code'])
+                               {
+                                       $receipt['error'][] = 
array('msg'=>lang('Either select propagate - or choose location level %1 
!',$this->gab_insert_level));
+                               }
+
+//_debug_array($values);
+                               if(!$receipt['error'])
+                               {
+                                       $receipt                = 
$this->bo->save($values);
+                                       $location_code  = 
$receipt['location_code'];
+                                       $gab_id                 = 
$receipt['gab_id'];
+//_debug_array($receipt);
+                               }
+                       }
+
+                       if ($gab_id && !$new)
+                       {
+                               $values = 
$this->bo->read_single($gab_id,$location_code);
+                       }
+                       if ($values['location_code'])
+                       {
+                               $function_msg = lang('Edit gab');
+                               $action='edit';
+                               $lookup_type ='view';
+
+                       }
+                       else
+                       {
+                               $function_msg = lang('Add gab');
+                               $action='add';
+                               $lookup_type ='form';
+                       }
+
+                       if ($values['cat_id'])
+                       {
+                               $this->cat_id = $values['cat_id'];
+                       }
+
+
+                       if($values['location_data'])
+                       {
+                               $type_id        = 
count(explode('-',$values['location_code']));
+                       }
+                       else
+                       {
+                               $type_id        = $this->gab_insert_level;
+                       }
+                       
$location_data=$this->bolocation->initiate_ui_location(array(
+                                               'values'                => 
$values['location_data'],
+                                               'type_id'               => 
$type_id,
+                                               'no_link'               => 
false, // disable lookup links for location type less than type_id
+                                               'tenant'                => 
false,
+                                               'lookup_type'   => $lookup_type
+                                               ));
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 'property.uigab.edit',
+                               'gab_id'                        => $gab_id,
+                               'location_code'         => $location_code,
+                               'from'                          => $from
+                       );
+
+
+
+                       $done_data = array('menuaction'=> 
'property.uigab.'.$from);
+                       if($from=='list_detail')
+                       {
+                               $done_data['gab_id'] = $gab_id;
+                       }
+
+                       $kommune_nr             = substr($gab_id,0,4);
+                       if(!$kommune_nr > 0)
+                       {
+                               $this->config->read_repository();
+                               $kommune_nr= 
$this->config->config_data['default_municipal'];
+                       }
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'value_owner'                                   
=> $values['owner'],
+                               'lang_owner'                                    
=> lang('owner'),
+                               'kommune_nr'                                    
=> $kommune_nr,
+                               'gaards_nr'                                     
        => substr($gab_id,4,5),
+                               'bruks_nr'                                      
        => substr($gab_id,9,4),
+                               'feste_nr'                                      
        => substr($gab_id,13,4),
+                               'seksjons_nr'                                   
=> substr($gab_id,17,3),
+
+                               'lang_kommune_nr'                               
=> lang('kommune nr'),
+                               'lang_gaards_nr'                                
=> lang('gaards nr'),
+                               'lang_bruksnr'                                  
=> lang('bruks nr'),
+                               'lang_feste_nr'                                 
=> lang('Feste nr'),
+                               'lang_seksjons_nr'                              
=> lang('Seksjons nr'),
+
+                               'action'                                        
=> $action,
+                               'lookup_type'                                   
=> $lookup_type,
+                               'location_data'                                 
=> $location_data,
+                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$done_data),
+                               'lang_save'                                     
=> lang('save'),
+                               'lang_done'                                     
=> lang('done'),
+
+                               'lang_propagate'                                
=> lang('propagate'),
+                               'lang_propagate_statustext'             => 
lang('check to inherit from this location'),
+
+                               'lang_remark_statustext'                => 
lang('Enter a remark for this entity'),
+                               'lang_remark'                                   
=> lang('remark'),
+                               'value_remark'                                  
=> $values['remark'],
+                               'lang_done_statustext'                  => 
lang('Back to the list'),
+                               'lang_save_statustext'                  => 
lang('Save the gab')
+                       );
+
+                       $appname                = lang('gab');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function delete()
+               {
+                       if(!$this->acl_delete)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 8, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $gab_id = phpgw::get_var('gab_id');
+                       $location_code = phpgw::get_var('location_code');
+                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+
+                       $link_data = array
+                       (
+                               'menuaction' => 'property.uigab.list_detail',
+                                       'gab_id' => $gab_id
+                       );
+
+                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       {
+                               $this->bo->delete($gab_id,$location_code);
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+                       $data = array
+                       (
+                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'delete_action'         => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.delete', 'gab_id'=> $gab_id, 'location_code'=>$location_code)),
+                               'lang_confirm_msg'      => lang('do you really 
want to delete this entry'),
+                               'lang_yes'              => lang('yes'),
+                               'lang_yes_statustext'   => lang('Delete the 
entry'),
+                               'lang_no_statustext'    => lang('Back to the 
list'),
+                               'lang_no'               => lang('no')
+                       );
+
+                       $appname                        = lang('gab');
+                       $function_msg                   = lang('delete gab 
at:') . ' ' . $location_code;
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function view()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $gab_id                 = phpgw::get_var('gab_id');
+                       $location_code  = phpgw::get_var('location_code');
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
+
+//_debug_array($values);
+
+
+                       if ($gab_id && !$new)
+                       {
+                               $values = 
$this->bo->read_single($gab_id,$location_code);
+                       }
+
+                       $function_msg = lang('View gab');
+                       $location_type ='view';
+
+
+                       
$location_data=$this->bolocation->initiate_ui_location(array(
+                                               'values'                => 
$values['location_data'],
+                                               'type_id'               => 
count(explode('-',$values['location_code'])),
+                                               'no_link'               => 
false, // disable lookup links for location type less than type_id
+                                               'tenant'                => 
false,
+                                               'lookup_type'   => 'view'
+                                               ));
+
+
+                       $data = array
+                       (
+                               'kommune_nr'                                    
=> substr($gab_id,0,4),
+                               'gaards_nr'                                     
        => substr($gab_id,4,5),
+                               'bruks_nr'                                      
        => substr($gab_id,9,4),
+                               'feste_nr'                                      
        => substr($gab_id,13,4),
+                               'seksjons_nr'                                   
=> substr($gab_id,17,3),
+
+                               'value_owner'                                   
=> lang($values['owner']),
+                               'lang_owner'                                    
=> lang('owner'),
+
+                               'lang_kommune_nr'                               
=> lang('kommune nr'),
+                               'lang_gaards_nr'                                
=> lang('gaards nr'),
+                               'lang_bruksnr'                                  
=> lang('bruks nr'),
+                               'lang_feste_nr'                                 
=> lang('Feste nr'),
+                               'lang_seksjons_nr'                              
=> lang('Seksjons nr'),
+
+                               'location_type'                                 
=> $location_type,
+                               'location_data'                                 
=> $location_data,
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.list_detail','gab_id' => $gab_id)),
+                               'lang_save'                                     
=> lang('save'),
+                               'lang_done'                                     
=> lang('done'),
+
+                               'lang_remark'                                   
=> lang('remark'),
+                               'value_remark'                                  
=> $values['remark'],
+                               'lang_done_statustext'                          
=> lang('Back to the list'),
+
+                               'edit_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uigab.edit', 'from'=>'list_detail', 'gab_id'=> $gab_id, 
'location_code'=> $location_code)),
+                               'lang_edit_statustext'                          
=> lang('Edit this entry'),
+                               'lang_edit'                                     
=> lang('Edit')
+                       );
+
+                       $appname                = lang('gab');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/class.uigab.inc_.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/inc/class.uiinvestment.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiinvestment.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiinvestment.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -31,7 +31,7 @@
         * Description
         * @package property
         */
-
+       phpgw::import_class('phpgwapi.yui');
        class property_uiinvestment
        {
                var $grants;
@@ -97,6 +97,7 @@
                        $this->bo->save_sessiondata($data);
                }
 
+               
                function index()
                {
                        if(!$this->acl_read)
@@ -104,13 +105,10 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('investment',
-                                                                               
'nextmatchs'));
-
                        $preserve       = phpgw::get_var('preserve', 'bool');
                        $values         = phpgw::get_var('values');
+                       $msgbox_data= "";
 
-
                        if($preserve)
                        {
                                $this->bo->read_sessiondata();
@@ -125,15 +123,210 @@
                                $this->allrows                  = 
$this->bo->allrows;
                        }
 
-                       if($values)
+                       if($values && phpgw::get_var('phpgw_return_as') == 
'json')
                        {
-                               $receipt=$this->update_investment($values);
+                               _debug_array($values);
+                               $receipt        
=$this->update_investment($values);
+                               $msgbox_data = 
$this->bocommon->msgbox_data($receipt);
                        }
 
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                               (
+                                       'menuaction'            => 
'property.uiinvestment.index',
+                                       'chapter_id'            => 
$this->chapter_id,
+                                               'cat_id'                        
=> $this->cat_id,
+                                               'part_of_town_id'       => 
$this->part_of_town_id,
+                                               'filter'                        
=> $this->filter                       
+                                       ));
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction     :'property.uiinvestment.index',"
+                                                                               
                        ."chapter_id: '{$this->chapter_id}',"
+                                                                               
        ."cat_id: '{$this->chapter_id}',"
+                                                                               
        ."part_of_town_id: '{$this->part_of_town_id}',"
+                                                                               
        ."filter: '{$this->filter}'";
+
+                               $values_combo_box[0] = 
$this->bo->select_category('select',$this->cat_id);                             
 
+                               $default_value = array ('id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->select_part_of_town('',$this->part_of_town_id);
+                               //$values_combo_box[1] =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('Part of town'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+                               
+                               $values_combo_box[2]  = 
$this->bo->filter('select',$this->filter);
+                               $default_value = array 
('id'=>'','name'=>lang('Show all'));
+                               array_unshift 
($values_combo_box[2],$default_value);    
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uiinvestment.index'/*,
+                                                               'query'         
        => $this->query,
+                                               'chapter_id'            => 
$this->chapter_id*/
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                               
                                array( //container of  control's Form
+                                                                               
                                        'type'  => 'label',
+                                                                               
                                        'id'    => 'controlsForm_container',
+                                                                               
                                        'value' => ''
+                                                                               
                                ),
+                                                                       array( 
//category
+                                                                           
'id' => 'btn_cat_id',
+                                                                           
'name' => 'cat_id',
+                                                                           
'value'     => lang('Category'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//User pafrt of town
+                                                                           
'id' => 'btn_part_of_town_id',
+                                                                           
'name' => 'part_of_town_id',
+                                                                           
'value'     => lang('Part of Town'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                               
array( //User filter
+                                                                           
'id' => 'btn_filter',
+                                                                           
'name' => 'filter',
+                                                                           
'value'     => lang('Filter'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( // boton ADD
+                                                                               
        'type'  => 'button',//'submit',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'tab_index' => 4,
+                                                                               
        'value' => lang('add')
+                                                                               
    )
+                                                                               
),
+                                                       'hidden_value' => array
+                                                                               
          (
+                                                                               
        array
+                                                                               
        ( //div values  combo_box_0
+                                                                               
                        'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0])
+                                                                               
                ),
+                                                                               
                array
+                                                                               
                ( //div values  combo_box_1
+                                                                               
                        'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
                ),
+                                                                               
                array
+                                                                               
                ( //div values  combo_box_2
+                                                                               
                        'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
                )
+                                                                               
          )
+                                                                               
)
+                                        )
+                               );
+                               $datatable['actions']['down-toolbar'] = 
array('fields'  => array('field' => array (
+                                       array( //container of  control's Form
+                                                                               
        'type'  => 'label',
+                                                                               
        'id'    => 'controlsForm_container',
+                                                                               
        'value' => ''
+                                                                       
),array( // Voucher link
+                                               'type'  => 'link',
+                                               'id'    => 'lnk_index',
+                                               'url'   => "",
+                                                                               
'value' => lang('New index'),
+                                                                               
'tab_index' => 5,
+                                                                               
'style' => 'filter'
+                                                                       ),
+                                       array( // Voucher box
+                                           'name'      => 'values[new_index]',
+                                           'id'        => 'txt_index',
+                                           'value' => '',
+                                           'type'      => 'text',
+                                           'size'      => 8,
+                                           'tab_index' => 6,
+                                               'class' => 'myValuesForPHP 
down-toolbar_button',
+                                           'style' => 'filter'
+                                       ),
+                                      array( // imag calendar1
+                                           'type'      => 'img',
+                                                                               
'id'    => 'start_date-trigger',
+                                           'src'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                                           'alt'       => lang('Select date'),
+                                           'tab_index' => 7,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
// calendar1 start_date
+                                           'type'      => 'text',
+                                                                               
'name'  => 'values[date]',
+                                           'id'        => 'start_date',
+                                           'value' => '',
+                                           'size'  => 7,
+                                           'readonly' => 'readonly',
+                                           'tab_index' => 8,
+                                                                               
'class' => 'myValuesForPHP down-toolbar_button',
+                                           'style' => 'filter'
+                                       ),
+                                       array( //boton   SEARCH
+                                           'id' => 'btn_update',
+                                           'name' => 'update',
+                                           'value'    => lang('Update'),
+                                           'tab_index' => 9,
+                                           'type' => 'button',
+                                           'style' => 'filter'
+                                       ))));
+                       }       
+       
+               
+                       $uicols = array (
+                               array(
+                                       'visible'=>false,       
'name'=>order_dummy,    'label'=>'',                                    
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>district_id,    'label'=>lang('District'),              
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>part_of_town,   'label'=>lang('Part of town'),  
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>entity_id,              'label'=>lang('entity id'),             
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>investment_id,  'label'=>lang('investment id'), 
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        'name'=>descr,  
                'label'=>lang('Descr'),                 
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>entity_name,    'label'=>lang('Entity name'),   
'className'=>'leftClasss',      'sortable'=>false,      'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>false,       
'name'=>initial_value_ex,'label'=>'',                                   
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>initial_value,  'label'=>lang('Initial value'), 
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
'formatter'=>'myFormatCount2'),
+                               array(
+                                       'visible'=>false,       
'name'=>value_ex,               'label'=>'',                                    
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        'name'=>value,  
                'label'=>lang('Value'),                 
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
'formatter'=>'myFormatCount2'),
+                               array(
+                                       'visible'=>true,        
'name'=>this_index,             'label'=>lang('Last index'),    
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>false,       
'name'=>this_write_off_ex,'label'=>'',                                  
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>this_write_off, 'label'=>lang('Write off'),             
'className'=>'rightClasss',     'sortable'=>false,      'sort_field'=>'',       
'formatter'=>'myFormatCount2'),
+                               array(
+                                       'visible'=>true,        'name'=>date,   
                'label'=>lang('Date'),                  
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>index_count,    'label'=>lang('Index count'),   
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        
'name'=>link_history,   'label'=>lang('History'),               
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>''),
+                               array(
+                                       'visible'=>true,        'name'=>check,  
                'label'=>lang('Select'),                
'className'=>'centerClasss','sortable'=>false,  'sort_field'=>'',       
'formatter'=>'')
+                               );
                        $investment_list = $this->bo->read();
 
-//_debug_array($values);
-
                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        $sep = '/';
                        $dlarr[strpos($dateformat,'y')]                 = 'Y';
@@ -142,172 +335,223 @@
                        ksort($dlarr);
                        $dateformat                                             
                = (implode($sep,$dlarr));
 
+                       $jscal = CreateObject('phpgwapi.jscalendar');
+                       $jscal->add_listener('start_date');
+                       
+                       $counter = $sum_initial_value = $sum_value = 0;
+
                        while (is_array($investment_list) && list(,$investment) 
= each($investment_list))
                        {
+                               $link_history = $check = "";
+                               if($this->admin_invoice)
+                               {
+                                       $link_history = "<a 
href=\"".$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.history', 'entity_id'=> $investment['entity_id'], 
'investment_id'=> $investment['investment_id'], 'entity_type'=> 
$this->cat_id))."\">".lang('History')."</a>";
+                                       if($investment['value']!= 0)
+                                       {
+                                               $check = "<input 
type=\"hidden\" name=\"values[update][".$counter."]\" value=\"\" 
class=\"myValuesForPHP select_hidden\"  />";
+                                               $check .= "<input 
type=\"checkbox\" name=\"values[update_tmp][".$counter."]\" 
value=\"".$counter."\" class=\"select_check\"  />";
+                                       }
+                               }
+                               
+                               $my_district = "";
+                               $my_district .= "<input type=\"hidden\" 
name=\"values[entity_id][".$counter."]\" value=\"".$investment['entity_id']."\" 
class=\"myValuesForPHP\"  />";
+                               $my_district .= "<input type=\"hidden\" 
name=\"values[investment_id][".$counter."]\" 
value=\"".$investment['investment_id']."\" class=\"myValuesForPHP\"  />";
+                               $my_district .= "<input type=\"hidden\" 
name=\"values[initial_value][".$counter."]\" 
value=\"".$investment['initial_value']."\" class=\"myValuesForPHP\"  />";
+                               $my_district .= "<input type=\"hidden\" 
name=\"values[value][".$counter."]\" value=\"".$investment['value']."\" 
class=\"myValuesForPHP\"  />";
+                               $my_district .= $investment['district_id'];
 
                                $content[] = array
                                (
+                               'order_dummy'           => 
$investment['part_of_town'],
+                               'district_id'           => $my_district,        
+                               'part_of_town'          => 
$investment['part_of_town'],                 
                                        'entity_id'                             
=> $investment['entity_id'],
                                        'investment_id'                         
=> $investment['investment_id'],
-                                       'district_id'                           
=> $investment['district_id'],
-                                       'date'                                  
=> date($dateformat,strtotime($investment['date'])),
-                                       'counter'                               
=> $investment['counter'],
-                                       'part_of_town'                          
=> $investment['part_of_town'],
                                        'descr'                                 
=> $investment['descr'],
-                                       'initial_value_ex'                      
=> $investment['initial_value'],
-                                       'initial_value'                         
=> number_format($investment['initial_value'], 0, ',', ''),
-                                       'value_ex'                              
=> $investment['value'],
-                                       'value'                                 
=> number_format($investment['value'], 0, ',', ''),
-                                       'this_index'                            
=> $investment['this_index'],
-                                       'index_count'                           
=> $investment['index_count'],
                                        'entity_name'                           
=> $investment['entity_name'],
+                               'initial_value_ex'      => 
($investment['initial_value']==""?0:$investment['initial_value']),
+                               'initial_value'         => 
number_format($investment['initial_value'], 0, ',', ''), //to avoid error in 
YUI's sum
+                               'value_ex'                      => 
($investment['value']==""?0:$investment['value']),
+                               'value'                         => 
number_format($investment['value'], 0, ',', ''),//to avoid error in YUI's sum
+                               'this_index'            => 
$investment['this_index'],
+                               'this_write_off_ex'     => 
$investment['this_write_off'],
                                        'this_write_off'                        
=> number_format($investment['this_write_off'], 0, ',', ''),
-                                       'link_history'                          
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.history', 'entity_id'=> $investment['entity_id'], 
'investment_id'=> $investment['investment_id'], 'entity_type'=> $this->cat_id)),
-                                       'lang_history'                          
=> lang('History'),
-                                       'lang_history_statustext'               
=> lang('View/Edit the history'),
-                                       'is_admin'                              
=> $this->admin_invoice
+                               'date'                          => 
date($dateformat,strtotime($investment['date'])),
+                               'index_count'           => 
$investment['index_count'],
+                               'link_history'          => $link_history,
+                               'check'                         => $check
                                );
 
-                               $sum_initial_value      = $sum_initial_value + 
$investment['initial_value'];
-                               $sum_value              = $sum_value + 
$investment['value'];
+                               //$sum_initial_value    += 
$investment['initial_value'];
+                               //$sum_value                    += 
$investment['value'];
+                               //$sum_this_write_off_ex                        
+= $investment['this_write_off'];
+                               $counter++;
+                       }       
 
+                       $j=0;
+                       if (isset($content) && is_array($content))
+                       {
+                               foreach($content as $investment)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']             = 
$uicols[$i]['name'];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']            = 
$investment[$uicols[$i]['name']];
+                                       }
+                                       $j++;
+                               }
                        }
 
-                       $table_header[] = array
-                       (
-                               'lang_district'                 => 
lang('District'),
-                               'lang_part_of_town'             => lang('Part 
of town'),
-                               'lang_entity_id'                => lang('entity 
id'),
-                               'lang_investment_id'            => 
lang('investment id'),
-                               'lang_descr'                    => 
lang('Descr'),
-                               'lang_entity_name'              => lang('Entity 
name'),
-                               'lang_initial_value'            => 
lang('Initial value'),
-                               'lang_value'                    => 
lang('Value'),
-                               'lang_last_index'               => lang('Last 
index'),
-                               'lang_write_off'                => lang('Write 
off'),
-                               'lang_date'                     => lang('Date'),
-                               'lang_index_count'              => lang('Index 
count'),
-                               'lang_history'                  => 
lang('History'),
-                               'lang_select'                   => 
lang('Select')
+                       $datatable['rowactions']['action'] = array();
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.add'))
                        );
 
-                       $jscal = CreateObject('phpgwapi.jscalendar');
-                       $jscal->add_listener('values_date');
 
-                       $table_update[] = array
-                       (
-                               'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
-                               'lang_datetitle'                => lang('Select 
date'),
+                       for ($i=0;$i<count($uicols);$i++)
+                       {
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols[$i]['name'];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols[$i]['label'];
+                               $datatable['headers']['header'][$i]['visible']  
        = $uicols[$i]['visible'];
+                               $datatable['headers']['header'][$i]['sortable'] 
        = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols[$i]['sort_field'];
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols[$i]['className'];
+                               
$datatable['headers']['header'][$i]['formatter']        = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
+                       }
 
-                               'lang_new_index'                => lang('New 
index'),
-                               'lang_new_index_statustext'     => lang('Enter 
a new index'),
-                               'lang_date_statustext'          => lang('Select 
the date for the update'),
-                               'lang_update'                   => 
lang('Update'),
-                               'lang_update_statustext'        => lang('update 
selected investments')
-                       );
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $table_add[] = array
-                       (
-                               'lang_add'              => lang('Add'),
-                               'lang_add_statustext'   => lang('add an 
investment'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.add'))
-                       );
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       //$datatable['pagination']['records_returned']= 
count($content);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       $link_data = array
-                       (
-                               'menuaction'            => 
'property.uiinvestment.index',
-                               'order'                 => $this->order,
-                               'sort'                  => $this->sort,
-                               'cat_id'                => $this->cat_id,
-                               'part_of_town_id'       => 
$this->part_of_town_id,
-                               'query'                 => $this->query,
-                               'start'                 => $this->start,
-                               'filter'                => $this->filter
-                       );
-
-
-                       if(!$this->allrows)
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               //avoid ,in the last page, reformate paginator 
when records are lower than records_returned
+                               if(count($content) <= 
$datatable['pagination']['records_limit'])
+                               {
+                                       
$datatable['pagination']['records_returned']= count($content);
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                                       
$datatable['pagination']['records_returned']= 
$datatable['pagination']['records_limit'];
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                               $datatable['sorting']['currentPage']    = 1;
+                               $datatable['sorting']['order']                  
= $uicols[0]['name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['currentPage']    = 
phpgw::get_var('currentPage');
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                               $datatable['pagination']['records_returned']= 
phpgw::get_var('recordsReturned', 'int');
+                       }
+                       
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       
$GLOBALS['phpgw']->js->validate_file('core','check','property');
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $data = array
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'lang_search'                                   
=> lang('Search'),
-                               'lang_search_statustext'                        
=> lang('Search for investment entries'),
-//                             'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.index')),
-                               'lang_select_all'                               
=> lang('Select All'),
-                               'img_check'                                     
=> $GLOBALS['phpgw']->common->get_image_path('property').'/check.png',
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($investment_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the investment belongs to. To do not use a 
category select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
=> $this->bo->select_category('select',$this->cat_id),
-                               'lang_town_statustext'                          
=> lang('Select the part of town the investment belongs to. To do not use a 
part of town -  select NO PART OF TOWN'),
-                               'lang_part_of_town'                             
=> lang('Part of town'),
-                               'lang_no_part_of_town'                          
=> lang('Show all'),
-                               'part_of_town_list'                             
=> $this->bocommon->select_part_of_town('select',$this->part_of_town_id),
-                               'select_name_part_of_town'                      
=> 'part_of_town_id',
-                               'filter_list'                                   
=> $this->bo->filter('select',$this->filter),
-                               'filter_name'                                   
=> 'filter',
-                               'lang_filter_statustext'                        
=> lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_show_all'                                 
=> lang('Show all'),
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                               'currentPage'           => 
$datatable['sorting']['currentPage'],
+                                       'records'                       => 
array()
+                       );
 
-                               'lang_submit'                                   
=> lang('submit'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
=> $content,
-                               'sum_initial_value'                             
=> number_format($sum_initial_value, 0, ',', ''),
-                               'sum_value'                                     
=> number_format($sum_value, 0, ',', ''),
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               $json_row[$column['name']] = 
$column['value'];
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                               'table_update'                                  
=> $table_update,
-                               'update_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.index')),
-                               'table_add'                                     
=> $table_add
-                       );
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               $json['message']                        = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+                               //$json ['sum_initial_value'] = 
number_format($sum_initial_value, 0, ',', '');
+                               //$json ['sum_value']           = 
number_format($sum_value, 0, ',', '');
+                               //$json['sum_this_write_off_ex']                
= number_format($sum_this_write_off_ex, 0, ',', '');
+                               //_debug_array($json);
+                               
+                       return $json;
+               }
+//-------------------- JSON CODE ----------------------
 
-                       $appname                = lang('investment');
-                       $function_msg           = lang('list investment');
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . lang('investment') . ': ' . lang('list investment');
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'investment.index', 'property' );
+
+                       //$this->save_sessiondata();                    
                }
+               
 
                function update_investment($values='')
                {
 //_debug_array($values);
 
-                       $errorcount = 0;
+                       $receipt = array();
 
                        if(!$values['date'])
                        {
-                               
$receipt['error'][$errorcount++]=array('msg'=>lang('Please select a date !'));
+                               $receipt['error'][]=array('msg'=>lang('Please 
select a date !'));
                        }
                        if(!$values['new_index'])
                        {
-                               
$receipt['error'][$errorcount++]=array('msg'=>lang('Please set a new index !'));
+                               $receipt['error'][]=array('msg'=>lang('Please 
set a new index !'));
                        }
                        if(!$values['update'])
                        {
-                               
$receipt['error'][$errorcount++]=array('msg'=>lang('Nothing to do!'));
+                               $receipt['error'][]=array('msg'=>lang('Nothing 
to do!'));
                        }
 
                        if(!$receipt['error'])
@@ -319,25 +563,145 @@
 
                function history()
                {
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('investment',
-                                                                               
'nextmatchs'));
 
                        $values         = phpgw::get_var('values');
                        $entity_type    = phpgw::get_var('entity_type');
                        $entity_id      = phpgw::get_var('entity_id', 'int');
                        $investment_id  = phpgw::get_var('investment_id', 
'int');
 
-//_debug_array($values);
-
                        if($values)
                        {
                                $receipt= $this->update_investment($values);
+                               $msgbox_data = 
$this->bocommon->msgbox_data($receipt);
                        }
 
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'    => 
'property.uiinvestment.history',
+                                                       'entity_id'     => 
$entity_id, 
+                                                       'investment_id' => 
$investment_id, 
+                                                       'entity_type'           
=> $entity_type
+                                       ));
+                                       
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiinvestment.history',"
+                                                                               
                        ."entity_id:'{$entity_id}',"
+                                                                               
                        ."investment_id:'{$investment_id}',"
+                                                                               
                        ."entity_type:'{$entity_type}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uiinvestment.history',
+                                                                       
'entity_id'     => $entity_id, 
+                                                                       
'investment_id' => $investment_id, 
+                                                                       
'entity_type'           => $entity_type                                         
                
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                                               
                        array( // mensaje
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'msg_header',
+                                                                               
                                'value' => '',
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),
+                                                                               
                        array( // mensaje
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'msg',
+                                                                               
                                'value' => '',
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),                                                      
                                                
+                                                                               
                        array( // boton done
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_done',
+                                                                               
                                'tab_index' => 1,
+                                                                               
                                'value' => lang('done')
+                                                                               
                        )                                                       
                                                                                
                                                        
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                               
+                       }
+
+                       $datatable['actions']['down-toolbar'] = array('fields'  
=> array('field' => array (
+                                       array( // link New index
+                                               'type'  => 'link',
+                                               'id'    => 'lnk_index',
+                                               'url'   => "",
+                                                                               
'value' => lang('New index'),
+                                                                               
'tab_index' => 6,
+                                                                               
'style' => 'filter'
+                                                                       ),
+                                       array( // New index box
+                                           'name'      => 'values[new_index]',
+                                           'id'        => 'txt_index',
+                                           'value' => '',
+                                           'type'      => 'text',
+                                           'size'      => 8,
+                                           'tab_index' => 2,
+                                               'class' => 'myValuesForPHP 
down-toolbar_button',
+                                           'style' => 'filter'
+                                       ),
+                                      array( // imag calendar1
+                                           'type'      => 'img',
+                                                                               
'id'    => 'start_date-trigger',
+                                           'src'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                                           'alt'       => lang('Select date'),
+                                           'tab_index' => 5,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
// calendar1 start_date
+                                           'type'      => 'text',
+                                                                               
'name'  => 'values[date]',
+                                           'id'        => 'start_date',
+                                           'value' => '',
+                                           'size'  => 7,
+                                           'readonly' => 'readonly',
+                                           'tab_index' => 3,
+                                                                               
'class' => 'myValuesForPHP down-toolbar_button',
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
//hidden update
+                                               'type'  => 'hidden',
+                                               'name'     => 
'values[update][0]',
+                                               'value' => 0,
+                                               'class' => 'myValuesForPHP',
+                                               'style' => 'filter'
+                                           ),     
+                                                                       array( 
//hidden entity_id
+                                               'type'  => 'hidden',
+                                               'name'     => 
'values[entity_id][0]',
+                                               'value' => $entity_id,
+                                               'class' => 'myValuesForPHP',
+                                               'style' => 'filter'
+                                           ),  
+                                                                       array( 
//hidden investment_id
+                                               'type'  => 'hidden',
+                                               'name'     => 
'values[investment_id][0]',
+                                               'value' => $investment_id,
+                                               'class' => 'myValuesForPHP',
+                                               'style' => 'filter'
+                                           ),                                  
                                                                                
 
+                                       array( //boton   SEARCH
+                                           'id' => 'btn_update',
+                                           'name' => 'update',
+                                           'value'    => lang('Update'),
+                                           'tab_index' => 4,
+                                           'type' => 'button',
+                                           'style' => 'filter'
+               )))); 
+                                                                               
                        
                        $investment_list = 
$this->bo->read_single($entity_id,$investment_id);
-//_debug_array($investment_list);
 
-
                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        $sep = '/';
                        $dlarr[strpos($dateformat,'y')]                 = 'Y';
@@ -346,124 +710,199 @@
                        ksort($dlarr);
                        $dateformat                                             
                = (implode($sep,$dlarr));
 
-                       while (is_array($investment_list) && list(,$investment) 
= each($investment_list))
-                       {
+                       $jscal = CreateObject('phpgwapi.jscalendar');
+                       $jscal->add_listener('start_date');
 
-                               $content[] = array
-                               (
-                                       'date'                                  
=> @date($dateformat,strtotime($investment['date'])),
-                                       'initial_value_ex'                      
=> $investment['initial_value'],
-                                       'initial_value'                         
=> number_format($investment['initial_value'], 0, ',', ''),
-                                       'value_ex'                              
=> $investment['value'],
-                                       'value'                                 
=> number_format($investment['value'], 0, ',', ''),
-                                       'this_index'                            
=> $investment['this_index'],
-                                       'current_index'                         
=> $investment['current_index'],
-                                       'index_count'                           
=> $investment['index_count'],
-                                       'this_write_off'                        
=> number_format($investment['this_write_off'], 0, ',', ''),
-                                       'link_delete'                           
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.delete', 'entity_id'=> $entity_id, 'investment_id'=> 
$investment_id, 'index_count'=> $investment['index_count'], 'entity_type'=> 
$entity_type)),
-                                       'lang_delete'                           
=> lang('Delete'),
-                                       'lang_delete_statustext'                
=> lang('Delete last entry'),
-                                       'is_admin'                              
=> $this->admin_invoice
+                       $uicols = array (
+                               'input_type'    =>      
array(text,text,text,text,text,text,hidden),
+                               'name'                  =>      
array(initial_value,value,this_index,this_write_off,date,index_count,is_admin),
+                               'formatter'             =>      
array('','','','','','',''),
+                               'descr'                 =>      
array(lang('Initial value'),lang('Value'),lang('Last index'),lang('Write 
off'),lang('Date'),lang('Index count'),''),
+                               'className'             =>      
array('rightClasss','rightClasss','rightClasss','rightClasss','','rightClasss','')
                                );
 
+                       
+                       $j=0;
+                       if (isset($investment_list) && 
is_array($investment_list))
+                       {
+                               foreach($investment_list as $investment)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                               if ($uicols['name'][$i] == 
'date')
+                                               {                               
                        
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
date($dateformat,strtotime($investment[$uicols['name'][$i]]));                  
                                              
+                                               }
+                                               else if ($uicols['name'][$i] == 
'is_admin') 
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = $this->admin_invoice;
                        }
+                                               else {
 
-//_debug_array($content);
-                       $table_header[] = array
-                       (
-                               'lang_initial_value'            => 
lang('Initial value'),
-                               'lang_value'                    => 
lang('Value'),
-                               'lang_last_index'               => lang('Last 
index'),
-                               'lang_write_off'                => lang('Write 
off'),
-                               'lang_date'                     => lang('Date'),
-                               'lang_index_count'              => lang('Index 
count'),
-                               'lang_delete'                   => 
lang('Delete')
-                       );
+                                                       if ($uicols['name'][$i] 
== 'initial_value' || $uicols['name'][$i] == 'value' || $uicols['name'][$i] == 
'this_write_off')
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
number_format($investment[$uicols['name'][$i]], 0, ',', '');                    
                              
+                                                       } else {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$investment[$uicols['name'][$i]];
+                                                       }
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }                       
 
+                       $datatable['rowactions']['action'] = array();
 
-                       $jscal = CreateObject('phpgwapi.jscalendar');
-                       $jscal->add_listener('values_date');
+                       $info = array ();
+                       $info[0]['name'] = lang('Entity Type');         
+                       $info[0]['value'] = lang($entity_type);
+                       $info[1]['name'] = lang('Entity Id');           
+                       $info[1]['value'] = $entity_id;                         
                                                                                
                                                                                
                                
+                       $info[2]['name'] = lang('Investment Id');               
+                       $info[2]['value'] = $investment_id;                     
 
-                       $table_update[] = array
-                       (
-                               'lang_new_index'                => lang('New 
index'),
-                               'lang_new_index_statustext'     => lang('Enter 
a new index'),
+                       $uicols_count   = count($uicols['descr']);
 
-                               'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
-                               'lang_datetitle'                => lang('Select 
date'),
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
 
-                               'lang_date_statustext'          => lang('Select 
the date for the update'),
-                               'lang_update'                   => 
lang('Update'),
-                               'lang_update_statustext'        => lang('update 
selected investments')
-                       );
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['className']                = 
$uicols['className'][$i];
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('done'),
-                               'lang_done_statustext'  => lang('Back to 
investment list '),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.index', 'preserve'=>1))
-                       );
+                                       
/*if($uicols['name'][$i]=='initial_value')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = false;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = '';
+                                       }               */
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }       
 
-                       $link_data = array
-                       (
-                               'menuaction'            => 
'property.uiinvestment.index',
-                               'order'                 => $this->order,
-                               'sort'                  => $this->sort,
-                               'cat_id'                => $this->cat_id,
-                               'part_of_town_id'       => 
$this->part_of_town_id,
-                               'sub'                   => $this->sub,
-                               'query'                 => $this->query,
-                               'start'                 => $this->start,
-                               'filter'                => $this->filter,
-                               'entity_type'           => $entity_type
-                       );
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+               
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($investment_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;                     
 
+                       $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // Column
 
-                       if(!$this->allrows)
+                       $appname        = lang('investment');
+                       $function_msg   = lang('investment history');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                           $datatable['sorting']['order']              = ''; 
// name key Column in myColumnDef
+                               $datatable['sorting']['sort']           = ''; 
// ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                           $datatable['sorting']['order']      = 
phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']           = 
phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('tabview');
 
-                       $data = array
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       //values for Pagination
+                       $json = array
                        (
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'entity_id'                                     
=> $entity_id,
-                               'lang_entity_id'                                
=> lang('Entity Id'),
-                               'investment_id'                                 
=> $investment_id,
-                               'lang_investment_id'                            
=> lang('Investment Id'),
-                               'entity_type'                                   
=> lang($entity_type),
-                               'lang_entity_type'                              
=> lang('Entity Type'),
-                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($investment_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.history', 'entity_id'=> $entity_id, 'investment_id'=> 
$investment_id, 'entity_type'=> $entity_type)),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'entity_id'                                     
=> $entity_id,
-                               'investment_id'                                 
=> $investment_id,
-                               'table_header_history'                          
=> $table_header,
-                               'values_history'                                
=> $content,
-                               'table_update'                                  
=> $table_update,
-                               'update_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvestment.history', 'entity_id'=> $entity_id, 'investment_id'=> 
$investment_id, 'entity_type'=> $entity_type)),
-                               'table_done'                                    
=> $table_done
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'info'                          => $info
                        );
 
-                       $appname        = lang('investment');
-                       $function_msg   = lang('investment history');
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               $json ['message']                       = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+               
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('history' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-//                     $this->save_sessiondata();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'investment.history', 'property' );
+                       
                }
 
 

Modified: people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -31,7 +31,7 @@
         * Description
         * @package property
         */
-
+       phpgw::import_class('phpgwapi.yui');
        class property_uiinvoice
        {
                var $grants;
@@ -65,12 +65,10 @@
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::invoice';
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs               = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo                       = 
CreateObject('property.boinvoice',true);
-                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->bocommon                 = &$this->bo->bocommon;
 
                        $this->start                    = $this->bo->start;
                        $this->query                    = $this->bo->query;
@@ -154,6 +152,7 @@
 
                                $name = array(
                                        'workorder_id',
+                                       'project_group',
                                        'status',
                                        'voucher_id',
                                        'invoice_id',
@@ -170,6 +169,7 @@
 
                                $descr = array(
                                        lang('Workorder'),
+                                       lang('project group'),
                                        lang('status'),
                                        lang('voucher'),
                                        lang('Invoice Id'),
@@ -190,15 +190,12 @@
 
                function index()
                {
+                       //--validacion para permisos
                        if(!$this->acl_read)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
-
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
-
+                       //-- captura datos de URL
                        $paid                   = phpgw::get_var('paid', 
'bool');
                        $start_date     = phpgw::get_var('start_date');
                        $end_date               = phpgw::get_var('end_date');
@@ -209,150 +206,56 @@
                        $voucher_id     = phpgw::get_var('voucher_id', 'int');
                        $b_account_class= phpgw::get_var('b_account_class', 
'int');
 
+                       //-- ubica focus del menu derecho
                        if ( $paid )
                        {
                                
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::paid';
                        }
-
+                       //-- captura datos de URL
                        $start_date=urldecode($start_date);
                        $end_date=urldecode($end_date);
 
+                       //-- si end_date no existe
                        if(!$end_date)
                        {
+                               //-- fecha actual
                                $end_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                                $start_date = $end_date;
                        }
-
+                       //-- edicion de registro
                        $values  = phpgw::get_var('values');
                        $receipt = array();
 
-                       if(isset($values['save']) && $values['save'] && 
isset($values['counter']) && $values['counter'])
+                       if( phpgw::get_var('phpgw_return_as') == 'json' && 
is_array($values) && isset($values))
                        {
+                               $values["save"]="Save";
+//                             _debug_array($values);
                                $receipt = $this->bo->update_invoice($values);
-                       }
 
-                       $content = 
$this->bo->read_invoice($paid,$start_date,$end_date,$vendor_id,$loc1,$workorder_id,$voucher_id);
+                                       }
 
-                       $sum = 0;
-                       $i=0;
-                       if(is_array($content))
+                        // Edit Period
+                       $period  = phpgw::get_var('period');
+                       $voucher_id_for_period  = 
phpgw::get_var('voucher_id_for_period');
+                       if( phpgw::get_var('phpgw_return_as') == 'json' &&  
isset($period) &&  $period != '')
                        {
-                               foreach($content as $extra)
-                               {
-
-                                       $sum                                    
                        = $sum + $extra['amount'];
-                                       $content[$i]['amount']                  
        = number_format($extra['amount'], 2, ',', ' ');
-                                       $content[$i]['lang_payment_date']       
= lang('Payment Date');
-                                       $content[$i]['link_sub']                
        = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.list_sub', 'user_lid'=> $this->user_lid, 'query'=> 
$this->query));
-                                       $content[$i]['lang_sub']                
        = lang('Voucher ID');
-                                       $content[$i]['lang_sub_help']           
= lang('click this link to enter the list of sub-invoices');
-                                       $content[$i]['link_period']             
= $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.edit_period'));
-                                       $content[$i]['lang_period']             
= lang('Period');
-                                       $content[$i]['lang_period_help']        
= lang('click this link to edit the period');
-
-                                       if($this->acl_delete && !$paid)
-                                       {
-                                               $content[$i]['link_delete']     
                        = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.delete', 'voucher_id'=> $extra['voucher_id']));
-                                               
$content[$i]['lang_delete_statustext']  = lang('delete the voucher');
-                                               $content[$i]['text_delete']     
                        = lang('delete');
-                                       }
-
-                                       $content[$i]['link_front']              
                = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.receipt', 'voucher_id'=> $extra['voucher_id']));
-                                       $content[$i]['lang_front_statustext']   
= lang('A printout version of the frontpage');
-                                       $content[$i]['text_front']              
                = 'F';
-
-                                       $i++;
-                               }
+                               $receipt        = 
$this->bo->update_period($voucher_id_for_period,$period);
                        }
 
-                       $table_header[] = array
-                       (
-                               'sort_voucher'          => 
$this->nextmatchs->show_sort_order(array
-                                                                               
                (
-                                                                               
                        'sort'  => $this->sort,
-                                                                               
                        'var'   => 'bilagsnr',
-                                                                               
                        'order' => $this->order,
-                                                                               
                        'extra' => array(
-                                                                               
                                        'menuaction'            => 
'property.uiinvoice.index',
-                                                                               
                                        'cat_id'                => 
$this->cat_id,
-                                                                               
                                        'sub'                   => $this->sub,
-                                                                               
                                        'paid'                  => $paid,
-                                                                               
                                        'vendor_id'             => $vendor_id,
-                                                                               
                                        'user_lid'              => 
$this->user_lid,
-                                                                               
                                        'b_account_class'       => 
$b_account_class,
-                                                                               
                                        'district_id'           => 
$this->district_id,
-                                                                               
                                        'start_date'            => $start_date,
-                                                                               
                                        'end_date'              => $end_date
-                                                                               
                                        )
-                                                                               
                )),
-                               'lang_voucher'          => lang('voucher'),
-                               'sort_voucher_date'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
                (
-                                                                               
                        'sort'  => $this->sort,
-                                                                               
                        'var'   => 'fakturadato',
-                                                                               
                        'order' => $this->order,
-                                                                               
                        'extra' => array('menuaction' => 
'property.uiinvoice.index',
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'sub'                   
=> $this->sub,
-                                                                               
                                                        'paid'                  
=> $paid,
-                                                                               
                                                        'vendor_id'             
=> $vendor_id,
-                                                                               
                                                        'user_lid'              
=> $this->user_lid,
-                                                                               
                                                        'b_account_class'       
=> $b_account_class,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'start_date'            
=> $start_date,
-                                                                               
                                                        'end_date'              
=> $end_date
-                                                                               
                                                        )
-                                                                               
                )),
-                               'lang_voucher_date'     => lang('Voucher Date'),
-                               'lang_days'             => lang('Days'),
-                               'lang_sum'              => lang('Sum'),
-                               'sort_vendor_id'        => 
$this->nextmatchs->show_sort_order(array
-                                                                               
                (
-                                                                               
                        'sort'  => $this->sort,
-                                                                               
                        'var'   => 'spvend_code',
-                                                                               
                        'order' => $this->order,
-                                                                               
                        'extra' => array('menuaction' => 
'property.uiinvoice.index',
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'sub'                   
=> $this->sub,
-                                                                               
                                                        'paid'                  
=> $paid,
-                                                                               
                                                        'vendor_id'             
=> $vendor_id,
-                                                                               
                                                        'user_lid'              
=> $this->user_lid,
-                                                                               
                                                        'b_account_class'       
=> $b_account_class,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'start_date'            
=> $start_date,
-                                                                               
                                                        'end_date'              
=> $end_date
-                                                                               
                                                        )
-                                                                               
                )),
-                               'lang_vendor_id'                        => 
lang('Vendor'),
-                               'lang_num_sub_invoice'          => 
lang('Count'),
-                               'lang_type'                                     
=> lang('Type'),
-                               'lang_period'                           => 
lang('Period'),
-                               'lang_kredit'                           => 
lang('KreditNota'),
-                               'lang_none'                                     
=> lang('None'),
-                               'lang_janitor'                          => 
lang('Janitor'),
-                               'lang_supervisor'                       => 
lang('Supervisor'),
-                               'lang_budget_responsible'       => lang('Budget 
Responsible'),
-                               'lang_transfer'                         => 
lang('Transfer'),
-                               'lang_delete'                           => 
lang('delete'),
-                               'lang_front'                            => 'F'
-                       );
+                       $datatable = array();
+                       $values_combo_box = array();
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                                     
=> lang('Done'),
-                               'lang_done_statustext'          => lang('Close 
this window')
-                       );
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                               $datatable['menu']                              
= $this->bocommon->get_menu();
 
-                       $link_data = array
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
                        (
                                'menuaction'            => 
'property.uiinvoice.index',
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
                                'cat_id'                        => 
$this->cat_id,
                                'user_lid'                      => 
$this->user_lid,
                                'sub'                           => $this->sub,
                                'query'                         => $this->query,
-                               'start'                         => $this->start,
                                'paid'                          => $paid,
                                'vendor_id'                     => $vendor_id,
                                'workorder_id'          => $workorder_id,
@@ -361,33 +264,304 @@
                                'filter'                        => 
$this->filter,
                                'b_account_class'       => $b_account_class,
                                'district_id'           => $this->district_id
-                       );
+                                                                               
                ));
+                               $datatable['config']['allow_allrows'] = true;
 
-                       if($this->acl_add)
-                       {
-                               $table_add[] = array
-                               (
-                                       'lang_add'                              
=> lang('add'),
-                                       'lang_add_statustext'   => lang('add an 
invoice'),
-                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.add'))
-                               );
-                       }
 
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiinvoice.index',"
+                                                                               
."cat_id: '{$this->cat_id}',"
+                                                                               
."user_lid:'{$this->user_lid}',"
+                                                                               
."sub:'{$this->sub}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."paid:'{$paid}',"
+                                                                               
."vendor_id:'{$vendor_id}',"
+                                                                               
."workorder_id:'{$workorder_id}',"
+                                                                               
."start_date:'{$start_date}',"
+                                                                               
."end_date:'{$end_date}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."b_account_class:'{$b_account_class}',"
+                                                                               
."district_id:'{$this->district_id}'";
 
-                       if(!$this->allrows)
+                                // sin el primer parametro, para no hacer 
diferencia entre filtro o selecte
+                               $values_combo_box[0]  = 
$this->bo->select_category('',$this->cat_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bo->get_invoice_user_list('select',$this->user_lid,array('all'),$default='all');
+                               //$default_value = array ();
+                               $default_value = array 
('lid'=>'','firstname'=>lang('no user'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $values_combo_box[2]  = 
$this->bo->select_account_class($b_account_class);
+                               $default_value = array 
('id'=>'','name'=>lang('No account'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               if($paid)
+                               {
+                                       $jscal = 
CreateObject('phpgwapi.jscalendar');
+                                       $jscal->add_listener('start_date');
+                                       $jscal->add_listener('end_date');
+                               }
+                               if (!$paid)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $field_invoice = array(
+                                       array( //boton  CATEGORY
+                                           'id' => 'btn_cat_id',
+                                           'name' => 'cat_id',
+                                           'value'     => lang('Category'),
+                                           'type' => 'button',
+                                           'tab_index' => 1,
+                                           'style' => 'filter'
+                                       ),
+                                       array( //boton  OWNER
+                                           'id' => 'btn_user_lid',
+                                           'name' => 'user_lid',
+                                           'value'     => user_lid,
+                                           'type' => 'button',
+                                           'tab_index' => 2,
+                                           'style' => 'filter'
+                                       ),
+                                       array( // boton exportar
+                                               'type'  => 'button',
+                                               'id'    => 'btn_export',
+                                               'tab_index' => 7,
+                                               'value' => lang('download')
+                                           ),
+                                                                       array( 
// boton SAVE
+                                               'id'    => 'btn_save',
+                                               //'name' => 'save',
+                                               'value' => lang('save'),
+                                               'tab_index' => 6,
+                                                                               
'type'  => 'button'
+                                           ),
+                                                                       array( 
// boton ADD
+                                               'type'  => 'button',//'submit',
+                                               'id'    => 'btn_new',
+                                               'tab_index' => 5,
+                                               'value' => lang('add')
+                                           ),
+                                       array( //boton   SEARCH
+                                           'id' => 'btn_search',
+                                           'name' => 'search',
+                                           'value'    => lang('search'),
+                                           'tab_index' => 4,
+                                           'type' => 'button'
+                                       ),
+                                       array( // TEXT IMPUT
+                                           'name'     => 'query',
+                                           'id'     => 'txt_query',
+                                           'value'    => $this->query,//$query,
+                                           'type' => 'text',
+                                           'onkeypress' => 'return 
pulsar(event)',
+                                           'tab_index' => 3,
+                                           'size'    => 28
+                                       ),
+                                       array( // txtbox end_data hidden
+                                           'name'     => 'end_date',
+                                           'id'     => 'txt_end_date',
+                                           'value'    => "",
+                                           'type' => 'hidden',
+                                           'size'    => 8
+                                       ),
+                                       array( // txtbox start_data hidden
+                                           'name'     => 'start_date',
+                                           'id'     => 'txt_start_date',
+                                           'value'    => "",
+                                           'type' => 'hidden',
+                                           'size'    => 8
+                                           ),
+                                           array( //hidden paid
+                                               'type'  => 'hidden',
+                                               'id'    => 'paid',
+                                               'value' => $paid
+                                           ));
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $field_invoice = array(
+                                       array( // imag calendar1
+                                           'type' => 'img',
+                                                                               
'id'     => 'start_date-trigger',
+                                           'src'    => 
$GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                                           'alt'       => lang('Select date'),
+                                           'tab_index' => 1,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
// calendar1 start_date
+                                           'type' => 'text',
+                                                                               
'name'     => 'start_date',
+                                           'id'     => 'start_date',
+                                           'value'    => $start_date,
+                                           'size'    => 7,
+                                           'readonly' => 'readonly',
+                                           'tab_index' => 2,
+                                           'style' => 'filter'
+                                       ),
+                                       array( // imag calendar1
+                                           'type' => 'img',
+                                                                               
'id'     => 'end_date-trigger',
+                                           'src'    => 
$GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                                           'alt'       => lang('Select date'),
+                                           'tab_index' => 3,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
// calendar1 start_date
+                                           'type' => 'text',
+                                                                               
'name'     => 'end_date',
+                                           'id'     => 'end_date',
+                                           'value'    => $end_date,
+                                           'size'    => 7,
+                                           'readonly' => 'readonly',
+                                           'tab_index' => 4,
+                                           'style' => 'filter'
+                                       ),
+                                       array( // workorder link
+                                               'type' => 'link',
+                                               'id' => 'lnk_workorder',
+                                               'url' => "",
+                                                                               
'value' => lang('Workorder ID'),
+                                                                               
'tab_index' => 5,
+                                                                               
'style' => 'filter'
+                                                                       ),
+                                       array( // workorder box
+                                           'name'     => 'workorder_id',
+                                           'id'     => 'txt_workorder',
+                                           'value'    => $workorder_id,
+                                           'type' => 'text',
+                                           'size'    => 10,
+                                           'tab_index' => 6,
+                                           'style' => 'filter'
+                                       ),
+                                       array( //vendor link
+                                               'type' => 'link',
+                                               'id' => 'lnk_vendor',
+                                               'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                   array
+                                                                               
                      (
+                                                                               
                       'menuaction' => 'property.uilookup.vendor',
+                                                                               
                       
))."','Search','width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes')",
+                                                                               
'value' => lang('Vendor'),
+                                                                               
'tab_index' => 7,
+                                                                               
'style' => 'filter'
+                                                                       ),
+                                       array( // Vendor box HIDDEN
+                                           'name'     => 'vendor_name',
+                                           'id'     => 'txt_vendor_name',
+                                           'value'    => "",
+                                           'type' => 'hidden',
+                                           'size'    => 10,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
// Vendor box
+                                           'name'     => 'vendor_id',
+                                           'id'     => 'txt_vendor',
+                                           'value'    => $vendor_id,
+                                           'type' => 'text',
+                                           'size'    => 10,
+                                           'tab_index' => 8,
+                                           'style' => 'filter'
+                                       ),
+                                       array(
+                                               'type' => 'link',
+                                               'id' => 'lnk_property',
+                                               'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                   array
+                                                                               
                      (
+                                                                               
                       'menuaction' => 'property.uilocation.index',
+                                                                               
                       'lookup'         => 1,
+                                                                               
                       'type_id'        => 1,
+                                                                               
                                        'lookup_name'   => 0,
+                                                                               
                       
))."','Search','width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes')",
+                                                                               
'value' => lang('property'),
+                                                                               
 'tab_index' => 9,
+                                                                               
'style' => 'filter'
+                                                                       ),
+                                       array( // txt Facilities Management
+                                           'name'     => 'loc1_name',
+                                           'id'     => 'txt_loc1_name',
+                                           'value'    => "",
+                                           'type' => 'hidden',
+                                           'size'    => 8,
+                                           'style' => 'filter'
+                                       ),
+                                       array( // txt Facilities Management
+                                           'name'     => 'loc1',
+                                           'id'     => 'txt_loc1',
+                                           'value'    => $loc1,
+                                           'type' => 'text',
+                                           'size'    => 8,
+                                           'tab_index' => 10,
+                                           'style' => 'filter'
+                                       ),
+                                       array( // Voucher link
+                                               'type' => 'link',
+                                               'id' => 'lnk_voucher',
+                                               'url' => "",
+                                                                               
'value' => lang('Voucher ID'),
+                                                                               
'tab_index' => 11,
+                                                                               
'style' => 'filter'
+                                                                       ),
+                                       array( // Voucher box
+                                           'name'     => 'voucher_id',
+                                           'id'     => 'txt_voucher',
+                                           'value'    => $voucher_id,
+                                           'type' => 'text',
+                                           'size'    => 8,
+                                           'tab_index' => 12,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
//boton   SEARCH
+                                           'id' => 'btn_search',
+                                           'name' => 'search',
+                                           'value'    => lang('search'),
+                                           'type' => 'button',
+                                           'tab_index' => 13,
+                                           'style' => 'filter'
+                                       ),
+                                       array( // boton exportar
+                                               'type'  => 'button',
+                                               'id'    => 'btn_export',
+                                               'tab_index' => 13,
+                                               'value' => lang('download')
+                                           ),
+                                       array( //boton  CATEGORY
+                                           'id' => 'btn_cat_id',
+                                           'name' => 'cat_id',
+                                           'value'     => lang('Category'),
+                                           'type' => 'button',
+                                           'tab_index' => 14,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
//boton  OWNER
+                                           'id' => 'btn_user_lid',
+                                           'name' => 'user_lid',
+                                           'value'     => user_lid,
+                                           'type' => 'button',
+                                           'tab_index' => 15,
+                                           'style' => 'filter'
+                                       ),
+                                       array( //boton  ACCOUNT
+                                           'id' => 'btn_b_account_class',
+                                           'name' => 'b_account_class',
+                                           'value'     => lang('No account'),
+                                           'type' => 'button',
+                                           'tab_index' => 16,
+                                           'style' => 'filter'
+                                       ),
+                                           array( //hidden paid
+                                               'type'  => 'hidden',
+                                               'id'    => 'paid',
+                                               'name'  => 'paid',
+                                               'value' => $paid,
+                                               'style' => 'filter'
+                                           ));
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       $link_download = array
-                       (
-                               'menuaction'            => 
'property.uiinvoice.download',
+               $datatable['actions']['form'] = array(
+                       array(
+                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                               array(
+                                                               'menuaction'    
        => 'property.uiinvoice.index',
                                'order'                         => $this->order,
                                'sort'                          => $this->sort,
                                'cat_id'                        => 
$this->cat_id,
@@ -401,146 +575,651 @@
                                'start_date'            => $start_date,
                                'end_date'                      => $end_date,
                                'filter'                        => 
$this->filter,
-                               'allrows'                       => 
$this->allrows,
                                'b_account_class'       => $b_account_class,
                                'district_id'           => $this->district_id
+                                                       )
+                                       ),
+                               'fields'        => array(
+                                    'field' => $field_invoice,
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1],'lid','firstname','lastname')
+                                                                               
              ),
+                                                                               
      array( //div values  combo_box_2
+                                                                               
                    'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
                )
+                                                                               
)
+                                                                       )
+                                 )
                        );
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-                       
$GLOBALS['phpgw']->js->validate_file('core','check','property');
+                       } //-- of if( phpgw::get_var('phpgw_return_as') != 
'json' )
 
-                       $data['menu']                                           
        = $this->bocommon->get_menu();
-                       $data['lang_download']                                  
        = 'download';
-                       $data['link_download']                                  
        = $GLOBALS['phpgw']->link('/index.php',$link_download);
-                       $data['lang_download_help']                             
= lang('Download table to your browser');
+                       $content = array();
+                       //the first time, $content is empty, because 
$user_lid=''.In the seconfd time, user_lid=all; It is done using  base_java_url.
+                       $content = 
$this->bo->read_invoice($paid,$start_date,$end_date,$vendor_id,$loc1,$workorder_id,$voucher_id);
+                       //_debug_array($content);
+                       $uicols = array (
+                               'input_type'    =>      array(hidden,hidden     
,hidden ,hidden ,hidden,hidden,hidden,hidden,hidden     ,link,link              
,hidden,hidden,hidden,$paid?varchar:input,varchar,link  
,hidden,varchar,varchar,varchar,$paid?hidden:input,$paid?hidden:input,special,special,special,special2),
+                               'type'                  =>      array(number,'' 
        ,''             ,''             ,number,number,''         ,number,''    
,url ,msg_box   ,''    ,''    ,''    ,$paid?'':text             ,''     
,msg_box,''    ,''     ,''     ,''     ,$paid?'':checkbox ,$paid?'':radio       
 ,''     ,''     ,''     ,''     ),
 
-                       $data['msgbox_data']                                    
= $GLOBALS['phpgw']->common->msgbox($msgbox_data);
-                       $data['sum']                                            
        = number_format($sum, 2, ',', '');
-                       $data['allow_allrows']                                  
= true;
-                       $data['allrows']                                        
        = $this->allrows;
-                       $data['start_record']                                   
= $this->start;
-                       $data['record_limit']                                   
= $record_limit;
-                       $data['num_records']                                    
= count($content);
-                       $data['all_records']                                    
= $this->bo->total_records;
-                       $data['link_url']                                       
        = $GLOBALS['phpgw']->link('/index.php',$link_data);
-                       $data['img_path']                                       
        = $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default');
-                       $data['lang_no_cat']                                    
= lang('no category');
-                       $data['lang_cat_statustext']                    = 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY');
-                       $data['select_name']                                    
= 'cat_id';
-                       $data['select_action']                                  
= $GLOBALS['phpgw']->link('/index.php',$link_data);
-                       $data['lang_no_user']                                   
= lang('None');
-                       $data['lang_user_statustext']                   = 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER');
-                       $data['select_user_name']                               
= 'user_lid';
-                       $data['lang_searchfield_statustext']    = lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again');
-                       $data['lang_searchbutton_statustext']   = lang('Submit 
the search string');
-                       $data['lang_search']                                    
= lang('search');
-                       $data['query']                                          
        = $this->query;
-                       $data['form_action']                                    
= $GLOBALS['phpgw']->link('/index.php',$link_data);
+                               'col_name'              =>      
array(payment_date,transfer,kreditnota,sign,vendor_name,counter_num,counter,voucher_id_num,voucher_id,voucher_id_lnk,voucher_date_lnk,sign_orig
 
,num_days_orig,timestamp_voucher_date,num_days,amount_lnk,vendor_id_lnk,invoice_count,invoice_count_lnk,type_lnk,period,kreditnota_tmp,sign_tmp
      ,janitor_lnk,supervisor_lnk,budget_responsible_lnk,transfer_lnk),
+                               'name'                  =>      
array(payment_date,dummy,dummy,dummy,vendor,counter,counter,voucher_id    
,voucher_id,voucher_id    ,voucher_date    ,sign_orig,num_days     
,timestamp_voucher_date,num_days,amount    ,vendor_id    
,invoice_count,invoice_count    ,type    ,period,kreditnota,empty_fild,janitor  
  ,supervisor    ,budget_responsible    ,transfer_id),
 
-//_debug_array($content);
-                       $appname        = lang('invoice');
-                       $function_msg   = lang('list voucher');
+                               'formatter'             =>      
array('','','','','','','','','','','','','','','',myFormatDate,'','','','',$paid?'':myPeriodDropDown,'','','','','',''),
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                               'descr'                 =>      
array(dummy,dummy,dummy,dummy,dummy,dummy,dummy,dummy,dummy,lang('voucher'),lang('Voucher
 
Date'),dummy,dummy,dummy,lang('Days'),lang('Sum'),lang('Vendor'),dummy,lang('Count'),lang('Type'),lang('Period'),lang('KreditNota'),lang('None'),lang('Janitor'),lang('Supervisor'),lang('Budget
 Responsible'),lang('Transfer')),
+                               'className'             =>      
array('','','','','','','','','','','centerClasss','','','',$paid?'rightClasss':'','rightClasss','rightClasss','','rightClasss','',$paid?'centerClasss':'comboClasss','centerClasss','centerClasss','','','centerClasss','centerClasss')
+                               );
 
-                       if (isset($paid) && $paid)
+                       //url to detail of voucher
+                       $link_sub       =       
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.list_sub','user_lid'=>$this->user_lid));
+
+
+                       if($paid)
                        {
-                               $jscal = CreateObject('phpgwapi.jscalendar');
-                               $jscal->add_listener('start_date');
-                               $jscal->add_listener('end_date');
+                                $link_sub.="&paid=true";
+                       }
 
-                               $bolocation                                     
                        = CreateObject('property.bolocation');
-                               $data['user_list']                              
                = 
$this->bo->get_invoice_user_list('select',$this->user_lid,array('all'),$default='all');
-                               $location_data                                  
                = $bolocation->initiate_ui_location(array('type_id'=> 1));
+                       $j=0;
+                       //---- llena DATATABLE-ROWS con los valores del READ
+                       if (isset($content) && is_array($content))
+                       {
+                               foreach($content as $invoices)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               //values column kreditnota
+                                               
if($uicols['type'][$i]=='checkbox' && $uicols['col_name'][$i]=='kreditnota_tmp')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 'true';
+                                               }
+                                               //values column sign
+                                               
elseif($uicols['type'][$i]=='radio' && $uicols['col_name'][$i]=='sign_tmp')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 'sign_none';
+                       }
+                                               // others columnas
+                       else
+                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$invoices[$uicols['name'][$i]];
+                                               }
 
-                               $data['cat_list']                               
                = $this->bo->select_category('select',$this->cat_id);
-                               $data['start_date']                             
                = $start_date;
-                               $data['end_date']                               
                = $end_date;
-                               $data['vendor_id']                              
                = $vendor_id;
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']             = 
$uicols['col_name'][$i];
 
-                               $data['img_cal']                                
                = $GLOBALS['phpgw']->common->image('phpgwapi','cal');
-                               $data['lang_datetitle']                         
        = lang('Select date');
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                               //--- varchar--
+                                                               
if($uicols['input_type'][$i]=='varchar' && $invoices[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'varchar';
+                       }
 
-                               $data['lang_workorder']                         
        = lang('Workorder ID');
-                               $data['lang_workorder_statustext']              
= lang('enter the Workorder ID to search by workorder - at any date');
-                               $data['workorder_id']                           
        = $workorder_id;
+                                                               //--- link--
+                                                               
elseif($uicols['input_type'][$i]=='link' && $invoices[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']                             
= '#';
+                                                                       
if($uicols['type'][$i]=='url')
+                                                                       {
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']                     = 
$link_sub."&voucher_id=".$invoices[$uicols['name'][$i]];
+               }
 
-                               $data['addressbook_link']                       
        = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilookup.vendor'));
-                               $data['lang_select_vendor_statustext']  = 
lang('Select the vendor by clicking this link');
-                               $data['lang_vendor']                            
        = lang('Vendor');
-                               $data['property_link']                          
        = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.index', 'lookup'=> 1, 'type_id'=> 1, 'lookup_name'=> 0));
-                               $data['lang_select_property_statustext']= 
lang('Select the property by clicking this link');
-                               $data['lang_property_statustext']               
= lang('Search by property');
-                               $data['lang_property']                          
        = lang('property');
-                               $data['loc1']                                   
                = $loc1;
-                               $data['lang_search']                            
        = lang('Search');
-                               $data['lang_search_statustext']                 
= lang('Search for paid invoices');
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']                   = '';
+                                                               }
 
-                               $data['table_header_list_voucher_paid'] = 
$table_header;
-                               $data['values_list_voucher_paid']               
= $content;
+                                                               //--- special--
+                                                               
elseif($uicols['input_type'][$i]=='special')
+               {
 
-                               $data['lang_voucher_id_statustext']             
= lang('Search for voucher id');
-                               $data['lang_voucher_id']                        
        = lang('Voucher ID');
-                               $data['voucher_id']                             
                = $voucher_id;
+                                                                       // the 
same name of columns
+                                                                       
$type_sign =  $datatable['rows']['row'][$j]['column'][$i]['format'] = 
$uicols['name'][$i];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['for_json']                         
= $uicols['col_name'][$i];
 
-                               $data['account_class_list']                     
        = $this->bo->select_account_class($b_account_class);
-                               $data['lang_no_account_class']                  
= lang('No account');
-                               $data['lang_account_class_statustext']  = 
lang('Select the account class the selection belongs to');
-                               $data['select_account_class_name']              
= 'b_account_class';
+                                                                       //LOGICA
+                                                                       
if(!$paid)
+                                                                       {
+                                                                               
if( ($invoices['is_janitor']== 1 && $type_sign == 'janitor') || 
($invoices['is_supervisor']== 1 && $type_sign == 'supervisor') || 
($invoices['is_budget_responsible']== 1 && $type_sign == 'budget_responsible'))
+                                                                               
{
+                                                                               
        if( ( ($invoices['jan_date'] == '') && $type_sign == 'janitor') || 
(($invoices['super_date'] == '') && $type_sign == 'supervisor') || 
(($invoices['budget_date'] == '') && $type_sign == 'budget_responsible'))
+                                                                               
        {
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['name']             
        = 'sign_tmp';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['type']             
        = 'radio';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['value']            
= ($type_sign == 'janitor'? 'sign_janitor':($type_sign == 'supervisor'? 
'sign_supervisor' : 'sign_budget_responsible'));
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['extra_param']      
= "";
+                                                                               
        }
 
-                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_voucher_paid' => 
$data));
+                                                                               
        elseif( (($invoices['janitor'] == $invoices['current_user']) && 
$type_sign == 'janitor')  || (($invoices['supervisor'] == 
$invoices['current_user']) && $type_sign == 'supervisor') || 
(($invoices['budget_responsible'] == $invoices['current_user']) && $type_sign 
== 'budget_responsible'))
+                       {
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['name']             
= 'sign_tmp';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['type']             
= 'radio';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['value']            
= ($type_sign == 'janitor'? 'sign_janitor':($type_sign == 'supervisor'? 
'sign_supervisor' : 'sign_budget_responsible'));
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['extra_param']      
= " checked ";
                        }
+
+                                                                               
        else
+                                                                               
        {
+
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['name']             
        = '';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['type']             
        = 'checkbox';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['value']            
= '';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['extra_param']      
= " disabled=\"disabled\" checked ";
+                                                                               
        }
+                                                                               
}
+                                                                               
else
+                                                                               
{
+                                                                               
        if( ($invoices['jan_date']=='' && $type_sign == 'janitor') || 
($invoices['super_date']=='' && $type_sign == 'supervisor') || 
($invoices['budget_date']=='' && $type_sign == 'budget_responsible') )
+                                                                               
        {
+                                                                               
        }
+                                                                               
        else
+                                                                               
        {
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['name']             
        = '';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['type']             
        = 'checkbox';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['value']            
= '';
+                                                                               
                $datatable['rows']['row'][$j]['column'][$i]['extra_param']      
= " disabled=\"disabled\" checked ";
+                                                                               
        }
+                                                                               
}
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['value2'] = ($type_sign == 
'janitor'? $invoices['janitor']: ($type_sign == 'supervisor'? 
$invoices['supervisor'] : $invoices['budget_responsible']));
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['value0'] = ($type_sign == 
'supervisor'? $invoices['super_date']: "");
+                                                                       }
+                                                                       else 
//if($paid)
+                                                                       {
+                                                                               
        $datatable['rows']['row'][$j]['column'][$i]['value2'] = ($type_sign == 
'janitor'? ($invoices['jan_date']." - ".$invoices['janitor']): ($type_sign == 
'supervisor'? ($invoices['super_date']." - ".$invoices['supervisor']) : 
($invoices['budget_date']." - ".$invoices['budget_responsible'])));
+                                                                       }
+                                                               }
+                                                               //---- 
speciual2----
+                                                               
elseif($uicols['input_type'][$i]=='special2')
+                                                                       {
+
+                                                                               
// the same name of columns
+                                                                               
$type_sign =  $datatable['rows']['row'][$j]['column'][$i]['format'] = 
$uicols['name'][$i];
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['for_json']                         
= $uicols['col_name'][$i];
+
+
+                                                                               
if(!$paid)
+                       {
+                                                                               
        if( ($invoices['is_transfer']==1))
+                                                                               
        {
+                                                                               
                if( ($invoices['transfer_date']==''))
+                                                                               
                {
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['name']     
                = 'transfer_tmp';
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['type']     
                = 'checkbox';
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['value']    
        = 'true';
+                                                                               
                        
$datatable['rows']['row'][$j]['column'][$i]['extra_param']      = "";
+                       }
+
+                                                                               
                else
+                       {
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['name']     
                = 'transfer_tmp';
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['type']     
                = 'checkbox';
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['value']    
        = 'true';
+                                                                               
                        
$datatable['rows']['row'][$j]['column'][$i]['extra_param']      = " checked ";
+                                                                               
                }
+                                                                               
        }
+                                                                               
        else
+                               {
+                                                                               
                if( ($invoices['transfer_id']!=''))
+                                                                               
                {
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['name']     
                = '';
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['type']     
                = 'checkbox';
+                                                                               
                        $datatable['rows']['row'][$j]['column'][$i]['value']    
        = '';
+                                                                               
                        
$datatable['rows']['row'][$j]['column'][$i]['extra_param']      = " 
disabled=\"disabled\" checked ";
+
+                                                                               
                }
+                                                                               
        }
+
+                                                                               
        $datatable['rows']['row'][$j]['column'][$i]['value2'] = 
$invoices['transfer_id'];
+                                                                               
}
+                                                                               
else //if($paid)
+                                                                               
{
+                                                                               
        $datatable['rows']['row'][$j]['column'][$i]['value2'] = 
$invoices['transfer_date']." - ".$invoices['transfer_id'];
+
+                                                                               
}
+                                                                       }
+
+
+                                                               else //for 
input controls
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
$uicols['input_type'][$i];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['type']                     = 
$uicols['type'][$i];
+
+                                                                       
if($datatable['rows']['row'][$j]['column'][$i]['type']=='text')
+                                                                       {
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['extra_param']              = 
"size='1' ";
+                                                                       }
+                                                                       
elseif($uicols['col_name'][$i]=='kreditnota_tmp' && 
$invoices[$uicols['name'][$i]] == '1')
+                                                                       {
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['extra_param'] = " checked ";
+                                                                       }
+                                                                       else 
+                                                                       {
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['extra_param'] = " ";
+                                                                       }
+                                                               }
+                                               }
+                                               else
+                                               {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'hidden';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['type']                     = 
$uicols['type'][$i];
+                                               }
+
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       //---- RIGHTS
+                       $datatable['rowactions']['action'] = array();
+                       if(!$paid)
+                       {
+                               $parameters = array
+                       (
+                                       'parameter' => array
+                                                                               
                (
+                                               array
+                                                                               
                (
+                                                       'name'          => 
'voucher_id',
+                                                       'source'        => 
'voucher_id_num'
+                                               ),
+                                       )
+                               );
+
+                               if($this->acl_delete)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'delete',
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                (
+                                                                               
        'menuaction'    => 'property.uiinvoice.delete',
+                                                                               
                )),
+                                               'parameters'    => $parameters
+                                       );
+                               }
+
+                               $datatable['rowactions']['action'][] = array(
+                                       'my_name'                       => 'f',
+                                       'text'                  => lang('F'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                (
+                                                                               
'menuaction'    => 'property.uiinvoice.receipt'
+                                                                               
                )),
+                                       'parameters'    => $parameters
+                       );
+
+                               if($this->acl_add)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'add',
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                       (
+                                                                               
        'menuaction'    => 'property.uiinvoice.add'
+                                                                               
))
+                       );
+                               }
+
+                               unset($parameters);
+
+                       }
+
+                       $uicols_count   = count($uicols['descr']);
+
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['col_name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]=='' ?  '""' : $uicols['formatter'][$i]);
+                               
$datatable['headers']['header'][$i]['className']                = 
$uicols['className'][$i];
+                               $datatable['headers']['header'][$i]['editor']   
                = $uicols['editor'][$i];
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       //-- ordemanientos particulares para 
cada columna
+                                       if($uicols['name'][$i]=='voucher_id'):
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'bilagsnr';
+                                       }
+                                       
elseif($uicols['name'][$i]=='voucher_date'):
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'fakturadato';
+                                       }
+                                       
elseif($uicols['name'][$i]=='vendor_id'):
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'spvend_code';
+                                       }
+                                       endif;
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       //for maintein page number in datatable
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               //avoid ,in the last page, reformate paginator 
when records are lower than records_returned
+                               if(count($content) <= 
$datatable['pagination']['records_limit'])
+                               {
+                                       
$datatable['pagination']['records_returned']= count($content);
+                               }
+                               else
+                               {
+                                       
$datatable['pagination']['records_returned']= 
$datatable['pagination']['records_limit'];
+                               }
+
+                               $datatable['sorting']['currentPage']    = 1;
+                               $datatable['sorting']['order']                  
= 'voucher_id_lnk'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
                        else
                        {
-                               $data['user_list']                              
                = 
$this->bo->get_invoice_user_list('filter',$this->user_lid,array('all'),$default='none');
-                               $data['cat_list']                               
                = $this->bo->select_category('filter',$this->cat_id);
-                               $data['table_done']                             
                = $table_done;
-                               $data['img_check']                              
                = 
$GLOBALS['phpgw']->common->get_image_path('property').'/check.png';
-                               $data['lang_save']                              
                = lang('save');
-                               $data['done_action']                            
        = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.index'));
-                               $data['lang_done_statustext']                   
= lang('Back to the list');
-                               $data['lang_save_statustext']                   
= lang('Save the voucher');
-                               $data['lang_select_all']                        
        = lang('Select All');
-                               $data['message']                                
                = isset($receipt['message'])?$receipt['message']:'';
-                               $data['error']                                  
                = isset($receipt['error'])?$receipt['error']:'';
-                               $data['table_header_list_voucher']              
= $table_header;
-                               $data['values_list_voucher']                    
= $content;
-                               $data['acl_delete']                             
                = $this->acl_delete;
-                               $data['table_add_invoice']                      
        = $table_add;
+                               $datatable['sorting']['currentPage']    = 
phpgw::get_var('currentPage');
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                               $datatable['pagination']['records_returned']= 
phpgw::get_var('recordsReturned', 'int');
+                       }
 
-                               
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_voucher' => $data));
+
+                       $appname = lang('location');
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                               'currentPage'           => 
$datatable['sorting']['currentPage'],
+                                       'records'                       => 
array()
+                       );
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
+                       {
+                               $k=0;
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               //-- links a otros modulos
+                                               if($column['format']== "link")
+                                               {
+                                                       
$json_row[$column['name']] = "<a target='".$column['target']."' 
href='".$column['link']."' >".$column['value']."</a>";
+                                               }
+                                               elseif($column['format']== 
"input")
+                                               {
+                                                               //this class 
was used for botton selectAll in Footer Datatable
+                                                               
if($column['name']=='sign_tmp')
+                                                               {
+                                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]' class=' signClass' 
type='".$column['type']."' value='".$column['value']."' 
".$column['extra_param']."/>";
+                                                               }
+                                                       else 
if($column['name']=='kreditnota_tmp')
+                                                               {
+                                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]' class=' kreditnota_tmp' 
type='".$column['type']."' value='".$column['value']."' 
".$column['extra_param']."/>";
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]' class='myValuesForPHP' 
type='".$column['type']."' value='".$column['value']."' 
".$column['extra_param']."/>";
+                                                               }
+                                               }
+                                               elseif($column['format']== 
"varchar")
+                                               {
+                                                               
$json_row[$column['name']] = $column['value'];
+                                               }
+                                               elseif($column['format']== 
"janitor" || $column['format']== "supervisor" || $column['format']== 
"budget_responsible" || $column['format']== "transfer_id" )
+                                               {
+                                                               $tmp_lnk = "";
+                                                               //this class 
was used for botton selectAll in Footer Datatable
+                                                               $class = 
$column['format']."Class";
+                                                       if($column['type']!='')
+                                                       {
+                                                               
if($column['name']=='')
+                                                               {
+                                                                       
$tmp_lnk = " <input name='".$column['name']."' type='".$column['type']."' 
value='".$column['value']."' ".$column['extra_param']." class='".$class."' />";
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$tmp_lnk = " <input name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]' class='".$class."' 
type='".$column['type']."' value='".$column['value']."' 
".$column['extra_param']."/>";
+                                                               }
+                                                       }
+
+                                                       
$json_row[$column['for_json']] = $column['value0'].$tmp_lnk . $column['value2'];
+                                               }
+
+                                               else // for  hidden
+                       {
+                                                 if($column['type']== 
'number') // for values for delete,edit.
+                                                 {
+                                                       
$json_row[$column['name']] = $column['value'];
+                                                 }
+                                                 else if($column['name']== 
"sign_orig")
+                                                 {
+                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]'  class='myValuesForPHP sign_origClass' 
 type='hidden' value='".$column['value']."'/>";
+                                                 }
+                                                 else if($column['name']== 
"sign")
+                                                 {
+                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]'  class='myValuesForPHP sign_tophp'  
type='hidden' value='".$column['value']."'/>";
+                                                 }
+                                                 else if($column['name']== 
"kreditnota")
+                                                 {
+                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]'  class='myValuesForPHP 
kreditnota_tophp'  type='hidden' value='".$column['value']."'/>";
+                                                 }
+                                                 else if($column['name']== 
"transfer")
+                                                 {
+                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]'  class='myValuesForPHP transfer_tophp' 
 type='hidden' value='".$column['value']."'/>";
+                                                 }
+                                                 else // for imput hiddens  
(type == "")
+                                                 {
+                                                       
$json_row[$column['name']] = " <input 
name='values[".$column['name']."][".$k."]' 
id='values[".$column['name']."][".$k."]'  class='myValuesForPHP '  
type='hidden' value='".$column['value']."'/>";
+                                                 }
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                                       $k++;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                               // message when editting & deleting records
+                               if(isset($receipt) && is_array($receipt) && 
count($receipt))
+                               {
+                                       $json ['message'][] = $receipt;
+                               }
+
+                       return $json;
                        }
-                       $this->save_sessiondata();
+//-------------------- JSON CODE ----------------------
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-               }
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
 
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
+                       $appname        = lang('invoice');
+                       $function_msg   = lang('list voucher');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       // Prepare YUI Library
+                       if ($paid)
+                       {
+                               $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'invoice.paid.index', 'property' );
+                       }
+                       else
+                       {
+                               $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'invoice.index', 'property' );
+                       }
+
+       }
+
                function list_sub()
                {
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
-                                                                               
'nextmatchs'));
 
-                       $paid = phpgw::get_var('paid', 'bool');
+                       $paid           = phpgw::get_var('paid', 'bool');
+                       $values         = phpgw::get_var('values');
+                       $voucher_id = phpgw::get_var('voucher_id', 'int');
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+
+                               $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                                                                               
                                'menuaction'    => 
'property.uiinvoice.list_sub',
+                                                                               
                                'order'                 => $this->order,
+                                                                               
                                'sort'                  => $this->sort,
+                                                                               
                                'cat_id'                => $this->cat_id,
+                                                                               
                                'user_lid'              => $this->user_lid,
+                                                                               
                                'sub'                   => $this->sub,
+                                                                               
                                'query'                 => $this->query,
+                                                                               
                                'start'                 => $this->start,
+                                                                               
                                'paid'                  => $paid,
+                               'voucher_id'    => $voucher_id,
+                                                                               
                                'query'                 => $this->query
+                                                                               
                        ));
+                               $datatable['config']['allow_allrows'] = false;
+
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiinvoice.list_sub',"
+                                                                               
                                ."order:'{$this->order}',"
+                                                                               
                                ."sort:'{$this->sort}',"
+                                                                               
                                ."cat_id: '{$this->cat_id}',"
+                                                                               
                                ."user_lid:'{$this->user_lid}',"
+                                                                               
                                ."sub:'{$this->sub}',"
+                                                                               
                                ."query:'{$this->query}',"
+                                                                               
                                ."start:'{$this->start}',"
+                                                                               
                                ."paid:'{$paid}',"
+                                                                               
                                ."voucher_id:'{$voucher_id}',"
+                                                                               
                                ."query:'{$this->query}'";
+
+                               $field_invoice = array(array( // mensaje
+                                                                               
        'type'  => 'label',
+                                                                               
        'id'    => 'msg_header',
+                                                                               
        'value' => '',
+                                                                               
        'style' => 'filter'
+                                                                               
),
+                                                                               
array( // boton exportar
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_export',
+                                                                               
        'tab_index' => 3,
+                                                                               
        'value' => lang('download')
+                                                                               
),
+                                                                               
array( // boton exportar
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'tab_index' => 2,
+                                                                               
        'value' => lang('done')
+                                                                               
),
+                                                                               
array( // boton SAVE
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_save',
+                                                                               
        //'name' => 'save',
+                                                                               
        'tab_index' => 1,
+                                                                               
        'value' => lang('save')
+                                                                               
),
+                                                                               
array( //container of  control's Form
+                                                                               
        'type'  => 'label',
+                                                                               
        'id'    => 'controlsForm_container',
+                                                                               
        'value' => ''
+                                                                               
)
+
+                       );
+
+                               $datatable['actions']['form'] = array(array(
+                                                                       
'action'        => $GLOBALS['phpgw']->link('/index.php',
+                                                                               
        array(
+                                                                               
                        'menuaction'            => 
'property.uiinvoice.list_sub',
+                                                                               
                        'user_lid'                      => $this->user_lid,
+                                                                               
                        'paid'                          => $paid,
+                                                                               
                        'voucher_id'            => $voucher_id
+                                                                               
                )
+                                                                               
),
+                                                                       
'fields'        => array(
+                                                                               
                                'field' => $field_invoice
+                                                                               
                                )
+                                                                         ));
+
+                       } //-- of if( phpgw::get_var('phpgw_return_as') != 
'json' )
+
+                       //-- edicion de registro
                        $values  = phpgw::get_var('values');
-                       $voucher_id = phpgw::get_var('voucher_id', 'int');
+                       $receipt = array();
 
-                       $receipt = array();
-                       if(isset($values['save']) && $values['save'] && 
isset($values['counter']) && $values['counter'])
+                       if( phpgw::get_var('phpgw_return_as') == 'json' && 
is_array($values) && isset($values))
                        {
-                               $receipt=$this->bo->update_invoice_sub($values);
+                               $receipt = 
$this->bo->update_invoice_sub($values);
                        }
 
-//_debug_array($values);
-
-//echo $voucher_id;
-
                        if ($voucher_id)
                        {
                                $content = 
$this->bo->read_invoice_sub($voucher_id,$paid);
                        }
 
-                       $sum =0;
-                       $i=0;
+                       $sum=0;
+                       $i      =0;
                        if(is_array($content))
                        {
                                while(each($content))
@@ -548,177 +1227,391 @@
                                        $sum                                    
                                = $sum + $content[$i]['amount'];
                                        $content[$i]['amount']                  
                = number_format($content[$i]['amount'], 2, ',', '');
                                        $content[$i]['paid']                    
                = $paid;
-                                       
$content[$i]['lang_tax_code_statustext']= lang('select the appropriate tax 
code');
-                                       $content[$i]['lang_dimb_statustext']= 
lang('select the appropriate dim code');
                                        $content[$i]['dimb_list']               
                = $this->bo->select_dimb_list($content[$i]['dimb']);
                                        $content[$i]['tax_code_list']           
        = $this->bo->tax_code_list($content[$i]['tax_code']);
-                                       $content[$i]['lang_remark']             
        = lang('Remark');
-                                       $content[$i]['link_remark']             
        = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.remark'));
-                                       $content[$i]['lang_remark_help']        
        = lang('click this link to view the remark');
                                        $content[$i]['link_order']              
                = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.view_order'));
                                        $content[$i]['link_claim']              
                = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.check'));
                                        $i++;
                                }
                        }
 
-//_debug_array($content);
-                       $table_header[] = array
-                       (
-                               'sort_workorder'                => 
$this->nextmatchs->show_sort_order(array
-                                                                               
                (
-                                                                               
                        'sort'  => $this->sort,
-                                                                               
                        'var'   => 'pmwrkord_code',
-                                                                               
                        'order' => $this->order,
-                                                                               
                        'extra' => array('menuaction'   => 
'property.uiinvoice.list_sub',
-                                                                               
                                        'cat_id'        => $this->cat_id,
-                                                                               
                                        'sub'           => $this->sub,
-                                                                               
                                        'paid'          => $paid,
-                                                                               
                                        'voucher_id'    => $voucher_id,
-                                                                               
                                        'query'         => $this->query)
-                                                                               
                )),
-                               'lang_workorder'                        => 
lang('Workorder'),
-                               'sort_budget_account'           => 
$this->nextmatchs->show_sort_order(array
-                                                                               
                (
-                                                                               
                        'sort'  => $this->sort,
-                                                                               
                        'var'   => 'spbudact_code',
-                                                                               
                        'order' => $this->order,
-                                                                               
                        'extra' => array('menuaction'   => 
'property.uiinvoice.list_sub',
-                                                                               
                                        'cat_id'        => $this->cat_id,
-                                                                               
                                        'sub'           => $this->sub,
-                                                                               
                                        'paid'          => $paid,
-                                                                               
                                        'voucher_id'    => $voucher_id,
-                                                                               
                                        'query'         => $this->query)
-                                                                               
                )),
-                               'lang_budget_account'           => lang('Budget 
account'),
+                       $uicols = array (
+                               array(
+                                       'col_name'=>workorder           
,'label'=>lang('Workorder'),    'className'=>'centerClasss', 'sortable'=>true,  
'sort_field'=>'pmwrkord_code',  'visible'=>true),
+                               array(
+                                       
'col_name'=>'project_group','label'=>lang('project group'),     
'className'=>'centerClasss', 'sortable'=>false, 'sort_field'=>'',               
                'visible'=>true),
+                               array(
+                                       'col_name'=>close_order,        
'label'=>lang('Close order'),   'className'=>'centerClasss', 'sortable'=>false, 
'sort_field'=>'',                               'visible'=>true),
+                               array(
+                                       'col_name'=>paid_percent,       
'label'=>lang('paid percent'),  'className'=>'centerClasss', 'sortable'=>false, 
'sort_field'=>'',                               'visible'=>true),
+                               array(
+                                       'col_name'=>change_tenant,      
'label'=>lang('Charge tenant'), 'className'=>'centerClasss', 'sortable'=>false, 
'sort_field'=>'',                               'visible'=>true),
+                               array(
+                                       'col_name'=>invoice_id,         
'label'=>lang('Invoice Id'),    'className'=>'centerClasss', 'sortable'=>false, 
'sort_field'=>'',                               'visible'=>true),
+                               array(
+                                       'col_name'=>budget_Account,     
'label'=>lang('Budget account'),'className'=>'centerClasss', 'sortable'=>true,  
'sort_field'=>'spbudact_code',  'visible'=>true),
+                               array(
+                                       'col_name'=>sum,                        
'label'=>lang('Sum'),                   'className'=>'rightClasss', 
'sortable'=>true,   'sort_field'=>'belop',                  'visible'=>true),
+                               array(
+                                       'col_name'=>dim_A,                      
'label'=>lang('Dim A'),                 'className'=>'centerClasss', 
'sortable'=>true,  'sort_field'=>'dima',                   'visible'=>true),
+                               array(
+                                       'col_name'=>dim_B,                      
'label'=>lang('Dim B'),                 'className'=>'centerClasss', 
'sortable'=>false, 'sort_field'=>'',                               
'visible'=>true),
+                               array(
+                                       'col_name'=>dim_D,                      
'label'=>lang('Dim D'),                 'className'=>'centerClasss', 
'sortable'=>false, 'sort_field'=>'',                               
'visible'=>true),
+                               array(
+                                       'col_name'=>Tax_code,           
'label'=>lang('Tax code'),              'className'=>'centerClasss', 
'sortable'=>false, 'sort_field'=>'',                               
'visible'=>true),
+                               array(
+                                       'col_name'=>Remark,                     
'label'=>lang('Remark'),                'className'=>'centerClasss', 
'sortable'=>false, 'sort_field'=>'',                               
'visible'=>true),
+                               array(
+                                       'col_name'=>counter,            
'visible'=>false)
+                               );
 
-                               'sort_sum'                                      
=> $this->nextmatchs->show_sort_order(array
-                                                                               
                (
-                                                                               
                        'sort'  => $this->sort,
-                                                                               
                        'var'   => 'belop',
-                                                                               
                        'order' => $this->order,
-                                                                               
                        'extra' => array('menuaction'   => 
'property.uiinvoice.list_sub',
-                                                                               
                                        'cat_id'        => $this->cat_id,
-                                                                               
                                        'sub'           => $this->sub,
-                                                                               
                                        'paid'          => $paid,
-                                                                               
                                        'voucher_id'    => $voucher_id,
-                                                                               
                                        'query'         => $this->query)
-                                                                               
                )),
+                       $j=0;
+                       //---- llena DATATABLE-ROWS con los valores del READ
+                       if (isset($content) && is_array($content))
+                       {
+                               $workorders = array();
+                               foreach($content as $invoices)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$json_row[$uicols[$i]['col_name']] = "";
 
-                               'lang_sum'                      => lang('Sum'),
-                               'lang_type'                     => lang('Type'),
-                               'lang_close_order'              => lang('Close 
order'),
-                               'lang_charge_tenant'            => lang('Charge 
tenant'),
-                               'lang_invoice_id'               => 
lang('Invoice Id'),
-                               'sort_dima'                     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
                (
-                                                                               
                        'sort'  => $this->sort,
-                                                                               
                        'var'   =>      'dima',
-                                                                               
                        'order' =>      $this->order,
-                                                                               
                        'extra'         => array('menuaction'   => 
'property.uiinvoice.list_sub',
-                                                                               
                                                'cat_id'        => 
$this->cat_id,
-                                                                               
                                                'sub'           => $this->sub,
-                                                                               
                                                'paid'          => $paid,
-                                                                               
                                                'voucher_id'    => $voucher_id,
-                                                                               
                                                'query'         => $this->query)
-                                                                               
                )),
-                               'lang_dima'                     => lang('Dim 
A'),
-                               'lang_dimb'                     => lang('Dim 
B'),
-                               'lang_dimd'                     => lang('Dim 
D'),
-                               'lang_tax_code'                 => lang('Tax 
code'),
-                               'lang_remark'                   => 
lang('Remark'),
-                       );
+                                               if($i == 0)
+                                               {
+                                                       
$json_row[$uicols[$i]['col_name']] .= " <input name='values[counter][".$j."]' 
id='values[counter][".$j."]'  class='myValuesForPHP'  type='hidden' 
value='".$invoices['counter']."'/>";
+                                                       
$json_row[$uicols[$i]['col_name']] .= " <input name='values[id][".$j."]' 
id='values[id][".$j."]'  class='myValuesForPHP'  type='hidden' 
value='".$invoices['id']."'/>";
+                                                       
$json_row[$uicols[$i]['col_name']] .= " <input 
name='values[workorder_id][".$j."]' id='values[workorder_id][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$invoices['workorder_id']."'/>";
+                                                       
$json_row[$uicols[$i]['col_name']] .= " <a target='_blank' 
href='".$invoices['link_order'].'&order_id='.$invoices['workorder_id']."'>".$invoices['workorder_id']."</a>";
+                                               }
+                                               elseif(($i == 1))
+                                               {
+                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['project_group'];
+                                               }
+                                               elseif(($i == 2))
+                                               {
+                                                       
if($invoices['workorder_id'] == "")
+                                                       {
+                                                               //nothing
+                                                       }
+                                                       
elseif($invoices['paid']== ""  && !array_key_exists($invoices['workorder_id'], 
$workorders))
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_orig][".$j."]' id='values[close_order_orig][".$j."]'  
class='myValuesForPHP '  type='hidden' value='".$invoices['closed']."'/>";
+                                                               
if($invoices['closed']== 1)
+                                                               {
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_tmp][".$j."]' id='values[close_order_tmp][".$j."]'  
class='close_order_tmp transfer_idClass'  type='checkbox' value='true' 
checked='checked' />";
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_tmp][".$j."]' id='values[close_order_tmp][".$j."]'  
class='close_order_tmp transfer_idClass'  type='checkbox' value='true'/>";
+                                                               }
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order][".$j."]' id='values[close_order][".$j."]'  
class='myValuesForPHP close_order'  type='hidden' value=''/>";
+                                                       }
+                                                       else
+                                                       {
+                                                               
if($invoices['closed']== 1)
+                                                               {
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<b>x</b>";
+                                                               }
+                                                       }
+                                               }
+                                               elseif(($i == 3))
+                                               {
+                                                       
if($invoices['workorder_id'] == "")
+                                                       {
+                                                               //nothing
+                                                       }
+                                                       
elseif(!array_key_exists($invoices['workorder_id'], $workorders))
+                                                       {
+                                                               
if(!$invoices['paid_percent'])
+                                                               {
+                                                                       
$invoices['paid_percent'] = 100;
+                                                               }
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[paid_percent][".$j."]' id='values[paid_percent][".$j."]'  
class='myValuesForPHP'  type='text' size='3' maxlength='3' 
value='".$invoices['paid_percent']."'/>";
+                                                       }
+                                               }
+                                               elseif(($i == 4))
+                                               {
+                                                       
if($invoices['charge_tenant'] == 1)
+                                                       {
+                                                               
if($invoices['claim_issued'] == '')
+                                                               {
+                                                                       
$_workorder = execMethod('property.soworkorder.read_single', 
$invoices['workorder_id']);
+                                                                       
$json_row[$uicols[$i]['col_name']] .= " <a target='_blank' 
href='".$invoices['link_claim'].'&project_id='.$_workorder['project_id']."'>".lang('Claim')."</a>";
+                                                                       
unset($_workorder);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<b>x</b>";
+                                                               }
+                                                       }
+                                                       else
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
+                                                       }
 
-                       $table_done[] = array
-                       (
-                               'lang_done'             => lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                                               }
+                                               elseif(($i == 5))
+                                               {
+                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['invoice_id'];
+                                               }
 
-                       $link_data = array
+                                               elseif(($i == 6))
+                                               {
+                                                       if($invoices['paid'] == 
true)
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']] .= $invoices['budget_account'];
+                                                       }
+                                                       else
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[budget_account][".$j."]' id='values[budget_account][".$j."]'  
class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['budget_account']."'/>";
+                                                       }
+                                               }
+
+                                               elseif(($i == 7))
+                                               {
+                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['amount'];
+                                               }
+
+                                               elseif(($i == 8))
+                                               {
+                                                       if($invoices['paid'] == 
true)
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['dima'];
+                                                       }
+                                                       else
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dima][".$j."]' 
id='values[dima][".$j."]'  class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['dima']."'/>";
+                                                       }
+                                               }
+                                               elseif(($i == 9))
+                                               {
+                                                       if($invoices['paid'] == 
true)
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['dimb'];
+                                                       }
+                                                       else
+                                                       {
+
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <select 
name='values[dimb_tmp][".$j."]' id='values[dimb_tmp][".$j."]'  
class='dimb_tmp'><option value=''></option>";
+
+                                                               for($k = 0 ;$k 
< count($invoices['dimb_list']) ; $k++)
+                                                               {
+                                                                       
if(isset($invoices['dimb_list'][$k]['selected']) && 
$invoices['dimb_list'][$k]['selected']!="")
+                                                                       {
+                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['dimb_list'][$k]['id']."' selected 
>".$invoices['dimb_list'][$k]['name']."</option>";
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['dimb_list'][$k]['id']."'>".$invoices['dimb_list'][$k]['name']."</option>";
+                                                                       }
+                                                               }
+                                                               
$json_row[$uicols[$i]['col_name']]  .="</select>";
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dimb][".$j."]' 
id='values[dimb][".$j."]'  class='myValuesForPHP dimb'  type='hidden' 
value=''/>";
+
+                                                       }
+                                               }
+                                               elseif(($i == 10))
+                                               {
+                                                       if($invoices['paid'] == 
true)
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['dimd'];
+                                                       }
+                                                       else
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dimd][".$j."]' 
id='values[dimd][".$j."]'  class='myValuesForPHP'  type='text' size='4' 
value='".$invoices['dimd']."'/>";
+                                                       }
+                                               }
+                                               elseif(($i == 11))
+                                               {
+                                                       if($invoices['paid'] == 
true)
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['tax_code'];
+                                                       }
+                                                       else
+                                                       {
+
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <select 
name='values[tax_code_tmp][".$j."]' id='values[tax_code_tmp][".$j."]'  
class='tax_code_tmp'><option value=''></option>";
+
+                                                               for($k = 0 ;$k 
< count($invoices['tax_code_list']) ; $k++)
+                                                               {
+                                                                       
if(isset($invoices['tax_code_list'][$k]['selected']) && 
$invoices['tax_code_list'][$k]['selected']!="")
+                                                                       {
+                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['tax_code_list'][$k]['id']."'  selected 
>".$invoices['tax_code_list'][$k]['id']."</option>";
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['tax_code_list'][$k]['id']."'>".$invoices['tax_code_list'][$k]['id']."</option>";
+                                                                       }
+                                                               }
+                                                               
$json_row[$uicols[$i]['col_name']]  .="</select>";
+                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[tax_code][".$j."]' 
id='values[tax_code][".$j."]'  class='myValuesForPHP tax_code'  type='hidden' 
value=''/>";
+
+                                                       }
+                                               }
+                                               elseif(($i == 12))
+                                               {
+                                                       if($invoices['remark'] 
== true)
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']] .= " <a 
href=\"javascript:openwindow('".$GLOBALS['phpgw']->link('/index.php', array
                        (
-                               'menuaction'            => 
'property.uiinvoice.list_sub',
-                               'order'                 => $this->order,
-                               'sort'                  => $this->sort,
-                               'cat_id'                => $this->cat_id,
-                               'user_lid'              => $this->user_lid,
-                               'sub'                   => $this->sub,
-                               'query'                 => $this->query,
-                               'start'                 => $this->start,
-                               'paid'                  => $paid,
-                               'voucher_id'            => $voucher_id,
-                               'user_lid'              => $this->user_lid,
-                               'query'                 => $this->query
-                       );
+                                                                               
        'menuaction'=> 'property.uiinvoice.remark',
+                                                                               
        'id'            => $invoices['id'],
+                                                                               
        'paid'          => $invoices['paid']
+                                                                               
 )). "','550','400')\" >".lang('Remark')."</a>";
+                                                       }
+                                                       else
+                                                       {
+                                                               
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
+                                                       }
+                                               }
+                                               elseif($i == 13)
+                                               {
+                                                       
$json_row[$uicols[$i]['col_name']]  = $invoices['counter'];
+                                               }                               
        
+                                       }
 
-                       if ($paid)
+                                       if($invoices['workorder_id'])
+                                       {
+                                               
$workorders[$invoices['workorder_id']] = true;
+                                       }
+
+                                       $datatable['rows']['row'][] = $json_row;
+                                       $j++;
+                               }
+                       }
+
+                       $current_Consult = array ();
+                       for($i=0;$i<2;$i++)
                        {
-                               $function_msg   = lang('list paid invoice');
+                               if($i==0)
+                               {
+                                       $current_Consult[] = 
array(lang('Vendor'),$content[0]['vendor']);
+                               }
+                               if($i==1)
+                               {
+                                       $current_Consult[] = 
array(lang('Voucher Id'),$content[0]['voucher_id']);
+                               }
+                       }
 
+                       //no grants
+                       $datatable['rowactions']['action'] = array();
+
+                       for ($i=0;$i<count($uicols);$i++)
+                       {
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols[$i]['col_name'];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols[$i]['label'];
+                               
$datatable['headers']['header'][$i]['formatter']                = 
($uicols[$i]['formatter']=='' ?  '""' : $uicols[$i]['formatter']);
+                               
$datatable['headers']['header'][$i]['className']                = 
$uicols[$i]['className'];
+                               $datatable['headers']['header'][$i]['visible']  
                = $uicols[$i]['visible'];
+                               $datatable['headers']['header'][$i]['sortable'] 
                = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']               = 
$uicols[$i]['sort_field'];
                        }
+               
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
count($content);
+                       $datatable['pagination']['records_returned']= 
count($content);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+                       
+                       if ( (phpgw::get_var("start")== 0) && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= $uicols[11]['col_name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
                        else
                        {
-                               $function_msg   = lang('list invoice');
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
 
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $link_download = array
-                       (
-                               'menuaction'    => 
'property.uiinvoice.download_sub',
-                               'voucher_id'    => $voucher_id,
-                               'paid'          => $paid
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-                       
$GLOBALS['phpgw']->js->validate_file('core','check','property');
+                               // values for datatable
+                       $json['records']        = $datatable['rows']['row'];
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_download'                                 
=> 'download',
-                               'link_download'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                            
=> lang('Download table to your browser'),
+                               // right in datatable
+                               $json ['rights']        = 
$datatable['rowactions']['action'];
 
-                               'img_check'                                     
=> $GLOBALS['phpgw']->common->get_image_path('property').'/check.png',
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'sum'                                           
=> number_format($sum, 2, ',', ''),
-                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_save'                                     
=> lang('save'),
-                               'lang_done'                                     
=> lang('Done'),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.index', 'user_lid'=> $this->user_lid, 'query'=> 
$this->query)),
-                               'lang_done_statustext'                          
=> lang('Back to the list'),
-                               'lang_save_statustext'                          
=> lang('Save the voucher'),
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> 
count($content),//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($content),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_submit'                                   
=> lang('submit'),
-                               'table_header_list_invoice_sub'                 
=> $table_header,
-                               'values_list_invoice_sub'                       
=> $content,
-                               'paid'                                          
=> $paid,
-                               'vendor'                                        
=> $content[0]['vendor'],
-                               'lang_vendor'                                   
=> lang('Vendor'),
-                               'voucher_id'                                    
=> $voucher_id,
-                               'lang_voucher_id'                               
=> lang('Voucher Id'),
-                               'lang_claim'                                    
=> lang('Claim'),
-                               'table_done'                                    
=> $table_done
-                       );
+                               $json['sum']            = number_format($sum, 
2, ',', '');
 
-//_debug_array($data);
+                               // message when editting & deleting records
+                               if(isset($receipt) && is_array($receipt) && 
count($receipt))
+                               {
+                                       $json ['message']= 
$GLOBALS['phpgw']->common->msgbox($this->bocommon->msgbox_data($receipt));
+               }
 
-                       $appname = lang('invoice');
+                               // query parameters
+                               if(isset($current_Consult) && 
is_array($current_Consult))
+                               {
+                                       $json ['current_consult'] = 
$current_Consult;
+                               }
 
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
+                       $appname = lang('location');
+                       if ($paid)
+                       {
+                               $function_msg   = lang('list paid invoice');
+                       }
+                       else
+                       {
+                               $function_msg   = lang('list invoice');
+                       }
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_invoice_sub' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'invoice.list_sub', 'property' );
+
                }
 
-
                function edit_period()
                {
                        $GLOBALS['phpgw']->xslttpl->add_file(array('invoice'));
@@ -788,32 +1681,282 @@
 
                function consume()
                {
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::consume';
-
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
-
+                       //-- captura datos de URL
                        $start_date             = phpgw::get_var('start_date');
                        $end_date               = phpgw::get_var('end_date');
-                       $submit_search          = 
phpgw::get_var('submit_search', 'bool');
                        $vendor_id              = phpgw::get_var('vendor_id', 
'int');
-
                        $workorder_id           = 
phpgw::get_var('workorder_id', 'int');
                        $loc1                   = phpgw::get_var('loc1');
                        $district_id            = phpgw::get_var('district_id', 
'int');
-                       $b_account_class        = 
phpgw::get_var('b_account_class', 'int');
+                       $b_account_class= phpgw::get_var('b_account_class', 
'int');
 
+                       //-- ubica focus del menu derecho
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::consume';
+
+                       //-- captura datos de URL
+                       $start_date     =urldecode($start_date);
+                       $end_date       =urldecode($end_date);
+
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                       if(!$start_date)
+                       {
+                               //-- actual date
+                               $start_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$dateformat);
+                               $end_date       = $start_date;
+                       }
+
+
+                       $datatable = array();
+                       $values_combo_box = array();
+                       $sum = 0;
+                       $vendor_name ="";
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
= $this->bocommon->get_menu();
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                                                               
        (
+                                                                               
                        'menuaction'    => 'property.uiinvoice.consume',
+                                                                               
                        'order'                 => $this->order,
+                                                                               
                        'sort'                  => $this->sort,
+                                                                               
                        'cat_id'                => $this->cat_id,
+                                                                               
                        'district_id'   => $district_id,
+                                                                               
                        'sub'                   => $this->sub,
+                                                                               
                        'query'                 => $this->query,
+                                                                               
                        'start'                 => $this->start,
+                                                                               
                        'filter'                => $this->filter
+                                                                               
                ));
+
+                               $datatable['config']['allow_allrows'] = false;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiinvoice.consume',"
+                                                                               
                                ."order: '{$this->order}',"
+                                                                               
                                ."sort:'{$this->sort}',"
+                                                                               
                                ."cat_id:'{$this->cat_id}',"
+                                                                               
                                ."district_id:'{$district_id}',"
+                                                                               
                                ."sub:'{$this->sub}',"
+                                                                               
                                ."query:'{$this->query}',"
+                                                                               
                                ."start:'{$this->start}',"
+                                                                               
                                ."filter:'{$this->filter}',"
+                                                                               
                                ."b_account_class:'{$b_account_class}'"
+                                                                               
                                ;
+
+                               $values_combo_box[0]  = 
$this->bo->select_category('',$this->cat_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->select_district_list('select',$district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no district'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $values_combo_box[2]  = 
$this->bo->select_account_class($b_account_class);
+                               $default_value = array 
('id'=>'','name'=>lang('No account'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               $field_invoice = array(
+                                       array( // imag calendar1
+                                           'type'              => 'img',
+                                                                               
'id'            => 'start_date-trigger',
+                                           'src'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                                           'alt'               => lang('Select 
date'),
+                                           'tab_index' => 1,
+                                           'style'     => 'filter'
+                                       ),
+                                                                       array( 
// calendar1 start_date
+                                           'type'              => 'text',
+                                                                               
'name'          => 'start_date',
+                                           'id'        => 'start_date',
+                                           'value'     => $start_date,
+                                           'size'      => 7,
+                                           'readonly'  => 'readonly',
+                                           'tab_index' => 2,
+                                           'style'     => 'filter'
+                                       ),
+                                       array( // imag calendar2
+                                           'type'              => 'img',
+                                                                               
'id'            => 'end_date-trigger',
+                                           'src'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                                           'alt'               => lang('Select 
date'),
+                                           'tab_index' => 3,
+                                           'style'     => 'filter'
+                                       ),
+                                                                       array( 
// calendar2 start_date
+                                           'type'              => 'text',
+                                                                               
'name'          => 'end_date',
+                                           'id'        => 'end_date',
+                                           'value'     => $end_date,
+                                           'size'      => 7,
+                                           'readonly'  => 'readonly',
+                                           'tab_index' => 4,
+                                           'style'     => 'filter'
+                                       ),
+                                       array( // workorder link
+                                               'type'          => 'link',
+                                               'id'            => 
'lnk_workorder',
+                                               'url'           => "",
+                                                                               
'value'         => lang('Workorder ID'),
+                                                                               
'tab_index' => 5,
+                                                                               
'style'         => 'filter'
+                                                                       ),
+                                       array( // workorder box
+                                           'name'      => 'workorder_id',
+                                           'id'        => 'txt_workorder',
+                                           'value'     => $workorder_id,
+                                           'type'              => 'text',
+                                           'size'      => 10,
+                                           'tab_index' => 6,
+                                                                               
//'readonly' => 'readonly',
+                                           'style'     => 'filter'
+                                       ),
+                                       array( //vendor link
+                                               'type'          => 'link',
+                                               'id'            => 'lnk_vendor',
+                                               'url'           => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                   array
+                                                                               
                      (
+                                                                               
                       'menuaction' => 'property.uilookup.vendor',
+                                                                               
                       
))."','Search','width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes')",
+                                                                               
'value'         => lang('Vendor'),
+                                                                               
'tab_index' => 7,
+                                                                               
'style'         => 'filter'
+                                                                       ),
+                                       array( // this field hidden is necesary 
for avoid js error
+                                           'name'     => 'vendor_name',
+                                           'id'     => 'txt_vendor_name',
+                                           'value'    => "",
+                                           'type' => 'hidden',
+                                           'size'    => 10,
+                                           'style' => 'filter'
+                                       ),
+                                                                       array( 
// Vendor box
+                                           'name'              => 'vendor_id',
+                                           'id'        => 'txt_vendor',
+                                           'value'     => $vendor_id,
+                                           'type'              => 'text',
+                                           'size'              => 10,
+                                           'tab_index' => 8,
+                                                                               
//'readonly' => 'readonly',
+                                           'style'             => 'filter'
+                                       ),
+                                       array(
+                                               'type'          => 'link',
+                                               'id'            => 
'lnk_property',
+                                               'url'           => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                   array
+                                                                               
                      (
+                                                                               
                       'menuaction' => 'property.uilocation.index',
+                                                                               
                       'lookup'         => 1,
+                                                                               
                       'type_id'        => 1,
+                                                                               
                                   'lookup_name'        => 0,
+                                                                               
                       
))."','Search','width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes')",
+                                                                               
'value' => lang('property'),
+                                                                               
'tab_index' => 9,
+                                                                               
'style' => 'filter'
+                                                                       ),
+                                      array( // txt Facilities Management
+                                           'name'              => 'loc1',
+                                           'id'                => 'txt_loc1',
+                                           'value'             => $loc1,
+                                           'type'              => 'text',
+                                           'size'              => 8,
+                                           'tab_index' => 10,
+                                                                               
//'readonly' => 'readonly',
+                                           'style'             => 'filter'
+                                       ),
+                                                                       array( 
//boton   SEARCH
+                                           'id'                => 'btn_search',
+                                           'name'              => 'search',
+                                           'value'             => 
lang('search'),
+                                           'type'              => 'button',
+                                           'tab_index' => 11,
+                                           'style'             => 'filter'
+                                       ),
+                                       array( //boton  CATEGORY
+                                           'id'                => 'btn_cat_id',
+                                           'name'              => 'cat_id',
+                                           'value'             => 
lang('Category'),
+                                           'type'              => 'button',
+                                           'tab_index' => 12,
+                                                                               
'style'         => 'filter'
+                                       ),
+                                                                       array( 
//boton  DISTRICT
+                                           'id'                => 
'btn_district_id',
+                                           'name'              => 
'district_id',
+                                           'value'             => 
lang('District'),
+                                           'type'              => 'button',
+                                           'tab_index' => 13,
+                                           'style'             => 'filter'
+                                       ),
+                                       array( //boton  ACCOUNT
+                                           'id'                => 
'btn_b_account_class',
+                                           'name'              => 
'b_account_class',
+                                           'value'             => lang('No 
account'),
+                                           'type'              => 'button',
+                                           'tab_index' => 14,
+                                           'style'             => 'filter'
+                                       ));
+
+               $datatable['actions']['form'] = array(
+                       array(
+                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                               array(
+                                                               'menuaction'    
        => 'property.uiinvoice.consume',
+                                                               'order'         
                => $this->order,
+                                                               'sort'          
                => $this->sort,
+                                                               'cat_id'        
                => $this->cat_id,
+                                                               'district_id'   
        => district_id,
+                                                               'sub'           
                => $this->sub,
+                                                               'query'         
                => $this->query,
+                                                               'start'         
                => $this->start,
+                                                               'filter'        
                => $this->filter
+                                                       )
+                                       ),
+                               'fields'        => array(
+                                    'field' => $field_invoice,
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0])
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
              ),
+                                                                               
      array( //div values  combo_box_2
+                                                                               
                    'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
                )
+                                                                               
)
+                                                                       )
+                                 )
+                               );
+
+                       } //-- of if( phpgw::get_var('phpgw_return_as') != 
'json' )
+
                        if($vendor_id)
                        {
                                $contacts               = 
CreateObject('property.soactor');
                                $contacts->role         = 'vendor';
-                               $vendor                 = 
$contacts->read_single(array('actor_id'=>(int)$vendor_id));
+                               $lookup = array
+                               (
+                                       'attributes' => array
+                                       (
+                                               0 => array
+                                               (
+                                                       'column_name' => 
'org_name'
+                                               )
+                                       )
+                               );
+
+                               $vendor                 = 
$contacts->read_single($vendor_id, $lookup);
+
                                if(is_array($vendor))
                                {
                                        foreach($vendor['attributes'] as 
$attribute)
                                        {
-                                               
if($attribute['name']=='org_name')
+                                               
if($attribute['column_name']=='org_name')
                                                {
                                                        
$vendor_name=$attribute['value'];
                                                        break;
@@ -822,156 +1965,251 @@
                                }
                        }
 
-                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-//_debug_array($values);
-                       if(!$submit_search)
+                       $current_Consult = array ();
+                       for($i=0;$i<3;$i++)
                        {
-                               $start_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$dateformat);
-                               $end_date       = $start_date;
+                               if($i==0 && $workorder_id != "")
+                               {
+                                       $current_Consult[] = 
array(lang('Workorder ID'),$workorder_id);
                        }
-                       else
+                               if($i==1 && $vendor_name != "")
                        {
-                               $content = 
$this->bo->read_consume($start_date,$end_date,$vendor_id,$loc1,$workorder_id,$b_account_class,$district_id);
+                                       $current_Consult[] = 
array(lang('Vendor'),$vendor_name);
                        }
+                               if($i==2 && $loc1 != "")
+                       {
+                                       $current_Consult[] = 
array(lang('property'),$loc1);
+                               }
 
-                       if(is_array($content))
-                       {
-                               $p_year = date("Y",strtotime($start_date));
-                       $p_month = date("m",strtotime($start_date));
-                       $i=0;
-                               while(each($content))
+                       }
+
+                       $content = 
$this->bo->read_consume($start_date,$end_date,$vendor_id,$loc1,$workorder_id,$b_account_class,$district_id);
+
+                       $sum = 0;
+                       foreach ($content as & $entry)
                                {
-                                       $p_start_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,$content[$i]['period'],1,$p_year),$dateformat);
-                                       $p_end_date = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,($content[$i]['period']+1),0,$p_year),$dateformat);
-                                       $sum                            = 
$sum+$content[$i]['consume'];
-                                       $content[$i]['link_voucher']    = 
$GLOBALS['phpgw']->link('/index.php',array(
+                               $sum                    = $sum + 
$entry['consume'];
+                               $entry['link_voucher']  = 
$GLOBALS['phpgw']->link('/index.php',array(
                                                                                
                                'menuaction'    => 'property.uiinvoice.index',
                                                                                
                                'paid'          => true,
                                                                                
                                'user_lid'      => 'all',
                                                                                
                                'district_id'   => $district_id,
-                                                                               
                                'b_account_class'=> $b_account_class,
-                                                                               
                                'start_date'    => $p_start_date,
-                                                                               
                                'end_date'      => $p_end_date
+                                                                               
                        'b_account_class'       => $b_account_class,
+                                                                               
                        'start_date'            => $start_date,
+                                                                               
                        'end_date'                      => $end_date
                                                                                
                                )
                                                                                
                        );
-                                       $content[$i]['consume']         = 
number_format($content[$i]['consume'], 0, ',', ' ');
-                                       $i++;
-                               }
+                               $entry['consume']       = 
number_format($entry['consume'], 0, ',', ' ');
                        }
 
 
-                       $table_header[] = array
+                       $uicols = array
                        (
-                               'lang_district'                 => 
lang('District'),
-                               'lang_period'                   => 
lang('Period'),
-                               'lang_budget_account'           => lang('Budget 
account'),
-                               'lang_consume'                  => 
lang('Consume'),
+                               'input_type'    =>      
array(varchar,varchar,varchar,link),
+                               'type'                  =>      array(text      
 ,text   ,text   ,url ),
+                               'col_name'              =>      
array(district_id,period,account_class,consume),
+                               'name'                  =>      
array(district_id,period,account_class,consume),
+                               'formatter'             =>      
array('','','',''),
+                               'descr'                 =>      
array(lang('District'),lang('Period'),lang('Budget account'),lang('Consume')),
+                               'className'             =>      
array('centerClasss','centerClasss','centerClasss','rightClasss')
                        );
 
-                       $table_done[] = array
-                       (
-                               'lang_done'             => lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                       $j=0;
 
-                       $link_data = array
-                       (
-                               'menuaction'            => 
'property.uiinvoice.consume',
-                               'order'                 => $this->order,
-                               'sort'                  => $this->sort,
-                               'cat_id'                => $this->cat_id,
-                               'district_id'           => $district_id,
-                               'sub'                   => $this->sub,
-                               'query'                 => $this->query,
-                               'start'                 => $this->start,
-                               'filter'                => $this->filter
-                       );
+                       if (isset($content) && is_array($content))
+                       {
+                               foreach($content as $invoices)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$invoices[$uicols['name'][$i]];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = 
$uicols['col_name'][$i];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['type']     = $uicols['type'][$i];
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-                       $data['menu']                                           
= $this->bocommon->get_menu();
-                       $data['lang_sum']                               = 
lang('Sum');
-                       $data['sum']                                    = 
number_format($sum, 0, ',', ' ');
-                       $data['allow_allrows']                          = false;
-                       $data['start_record']                           = 
$this->start;
-                       $data['record_limit']                           = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       $data['num_records']                            = 
count($content);
-                       $data['all_records']                            = 
$this->bo->total_records;
-                       $data['link_url']                               = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
-                       $data['img_path']                               = 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default');
-                       $data['lang_no_cat']                            = 
lang('no category');
-                       $data['lang_cat_statustext']                    = 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY');
-                       $data['select_name']                            = 
'cat_id';
-                       $data['select_action']                          = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
-                       $data['lang_no_district']                       = 
lang('No district');
-                       $data['lang_district_statustext']               = 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT');
-                       $data['select_district_name']                   = 
'district_id';
-                       $data['lang_searchfield_statustext']            = 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again');
-                       $data['lang_searchbutton_statustext']           = 
lang('Submit the search string');
-                       $data['lang_search']                            = 
lang('search');
-                       $data['query']                                  = 
$this->query;
-                       $data['form_action']                            = 
$GLOBALS['phpgw']->link('/index.php',$link_data);
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                               //--- varchar--
+                                                               
if($uicols['input_type'][$i]=='varchar' && $invoices[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'varchar';
+                                                               }
+                                                               //--- link--
+                                                               
elseif($uicols['input_type'][$i]=='link' && $invoices[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                                       
if($uicols['type'][$i]=='url')
+                                                                       {
+                                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']     = 
$invoices['link_voucher'];
+                                                                       }
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '';
+                                                               }
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
 
-                       $data['district_list']                          = 
$this->bocommon->select_district_list('select',$district_id);
-                       $data['cat_list']                               = 
$this->bo->select_category('select',$this->cat_id);
-                       $data['start_date']                             = 
$start_date;
-                       $data['end_date']                               = 
$end_date;
-                       $data['vendor_id']                              = 
$vendor_id;
-                       $data['vendor_name']                            = 
$vendor_name;
+                       //not grants
+                       $datatable['rowactions']['action'] = array();
 
-                       $data['account_class_list']                     = 
$this->bo->select_account_class($b_account_class);
-                       $data['lang_no_account_class']                  = 
lang('No account');
-                       $data['lang_account_class_statustext']          = 
lang('Select the account class the selection belongs to');
-                       $data['select_account_class_name']              = 
'b_account_class';
 
-                       $jscal = CreateObject('phpgwapi.jscalendar');
-                       $jscal->add_listener('start_date');
-                       $jscal->add_listener('end_date');
+                       $uicols_count   = count($uicols['descr']);
 
-                       $data['img_cal']                                        
        = $GLOBALS['phpgw']->common->image('phpgwapi','cal');
-                       $data['lang_datetitle']                         = 
lang('Select date');
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               $datatable['headers']['header'][$i]['name']     
        = $uicols['col_name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols['descr'][$i];
+                               
$datatable['headers']['header'][$i]['formatter']        = 
($uicols['formatter'][$i]=='' ?  '""' : $uicols['formatter'][$i]);
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols['className'][$i];
 
-                       $data['lang_workorder']                         = 
lang('Workorder ID');
-                       $data['lang_workorder_statustext']              = 
lang('enter the Workorder ID to search by workorder - at any date');
-                       $data['workorder_id']                           = 
$workorder_id;
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['visible']  = true;
+                                       
$datatable['headers']['header'][$i]['format']   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+                                       
$datatable['headers']['header'][$i]['sortable'] = false;
+                               }
+                       }
 
-                       $data['addressbook_link']                       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilookup.vendor'));
-                       $data['lang_select_vendor_statustext']          = 
lang('Select the vendor by clicking this link');
-                       $data['lang_vendor']                            = 
lang('Vendor');
 
-                       $bolocation                                     = 
CreateObject('property.bolocation');
-                       $location_data                                  = 
$bolocation->initiate_ui_location(array('type_id'=> 1));
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $data['property_link']                          = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.index', 'lookup'=> 1, 'type_id'=> 1, 'lookup_name'=> 0));
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($content);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       $data['lang_select_property_statustext']        = 
lang('Select the property by clicking this link');
-                       $data['lang_property_statustext']               = 
lang('Search by property');
 
-                       $data['lang_property']                          = 
lang('property');
-                       $data['loc1']                                   = $loc1;
-                       $data['lang_search']                            = 
lang('Search');
-                       $data['lang_search_statustext']                 = 
lang('Search for paid invoices');
+                       //for maintein page number in datatable
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']  = 
'district_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']   = 'desc'; // 
ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']   = 
phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
 
-                       $data['table_header_consume']                   = 
$table_header;
-                       $data['values_consume']                         = 
$content;
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
 
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'sum'                           => 
number_format($sum, 0, ',', ' ')
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target=''>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               // query parameters
+                               if(isset($current_Consult) && 
is_array($current_Consult))
+                               {
+                                       $json ['current_consult'] = 
$current_Consult;
+                               }
+       //                      _debug_array($json);
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+                       $jscal = CreateObject('phpgwapi.jscalendar');
+                       $jscal->add_listener('start_date');
+                       $jscal->add_listener('end_date');
+
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $appname                                        = 
lang('consume');
-                       $function_msg                                   = 
lang('list consume');
 
+                       $function_msg   = lang('list consume');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('consume' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
 
-                       $this->save_sessiondata();
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'invoice.consume', 'property' );
+                       //die(_debug_array($datatable));
                }
-
                function delete()
                {
+                       $voucher_id = phpgw::get_var('voucher_id', 'int');
+
+                       //cramirez add JsonCod for Delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       $this->bo->delete($voucher_id);
+                       return "voucher_id ".$voucher_id." ".lang("has been 
deleted");
+                       }
+
+
                        if(!$this->acl_delete)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
                        }
 
-                       $voucher_id = phpgw::get_var('voucher_id', 'int');
+
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
                        $link_data = array
@@ -1058,7 +2296,16 @@
                                $values['merknad']              = 
phpgw::get_var('merknad');
                                $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int');
                                $values['b_account_name']       = 
phpgw::get_var('b_account_name');
-                               $values['amount']               = 
phpgw::get_var('amount', 'float');
+                               $values['amount']               = 
phpgw::get_var('amount'); // float - has to accept string until client side 
validation is in place.
+
+                               if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['currency']))
+                               {
+                                       $values['amount']               = 
str_ireplace($GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],'',$values['amount']);
+                               }
+
+                               $values['amount']               = str_replace(' 
','',$values['amount']);
+                               $values['amount']               = 
str_replace(',','.',$values['amount']);
+
                                $values['order_id']             = 
phpgw::get_var('order_id', 'int');
 
                                $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
@@ -1401,7 +2648,7 @@
                        //error_reporting(E_ALL);
                        set_time_limit(1800);
                        $pdf -> ezSetMargins(50,70,50,50);
-                       $pdf->selectFont(PHPGW_APP_INC . 
'/pdf/fonts/Helvetica.afm');
+                       $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica.afm');
 
                        // put a line top and bottom on all the pages
                        $all = $pdf->openObject();
@@ -1669,14 +2916,14 @@
 
                function view_order()
                {
-                       $order_id       = phpgw::get_var('order_id', 'int');
+                       $order_id       = phpgw::get_var('order_id'); // could 
be bigint
                        $soXport    = CreateObject('property.soXport');
 
-                       $order_type = $soXport->check_order(intval($order_id));
+                       $order_type = $soXport->check_order($order_id);
                        switch($order_type)
                        {
                                case 'workorder':
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiwo_hour.view', 'no_email'=> true, 'show_cost'=> true, 
'workorder_id'=> $order_id));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit', 'id'=> $order_id));
                                        break;
                                case 's_agreement':
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uis_agreement.view', 'id'=> $order_id));

Modified: people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,14 +24,13 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage location
-       * @version $Id$
+       * @version $Id$
        */
 
        /**
         * Description
         * @package property
         */
-
   phpgw::import_class('phpgwapi.yui');
 
        class property_uilocation
@@ -45,6 +44,7 @@
                var $filter;
                var $currentapp;
                var $type_id;
+               var $location_code;
 
                var $public_functions = array
                (
@@ -57,19 +57,18 @@
                        'stop'          => true,
                        'summary'       => true,
                        'columns'       => true,
-                       'index2'        => true
+                       'update_location' => true
                );
 
                function property_uilocation()
                {
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; // 
menus added where needed via bocommon::get_menu
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::location';
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                                       = 
CreateObject('property.bolocation',true);
-                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->bocommon                         = & 
$this->bo->bocommon;
                        $this->soadmin_location         = 
CreateObject('property.soadmin_location');
-
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
 
                        $this->type_id                          = 
$this->bo->type_id;
@@ -92,6 +91,7 @@
                        $this->type_id                          = 
$this->bo->type_id;
                        $this->allrows                          = 
$this->bo->allrows;
                        $this->lookup                           = 
$this->bo->lookup;
+                       $this->location_code            = 
$this->bo->location_code;
                }
 
                function save_sessiondata()
@@ -118,7 +118,7 @@
                        $summary        = phpgw::get_var('summary', 'bool', 
'GET');
                        $type_id        = phpgw::get_var('type_id', 'int', 
'GET');
                        $lookup         = phpgw::get_var('lookup', 'bool');
-                       $lookup_name    = phpgw::get_var('lookup_name');
+                       //$lookup_name  = phpgw::get_var('lookup_name');
                        $lookup_tenant  = phpgw::get_var('lookup_tenant', 
'bool');
 
                        if(!$summary)
@@ -136,6 +136,7 @@
 
                function columns()
                {
+//                     phpgwapi_yui::load_widget('tabview');
                        $receipt = array();
                        $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
 
@@ -144,16 +145,14 @@
 
                        $values                 = phpgw::get_var('values');
 
+                       
$GLOBALS['phpgw']->preferences->set_account_id($this->account, true);
+
                        if (isset($values['save']) && $values['save'] && 
$this->type_id)
                        {
-                               
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-                               
$GLOBALS['phpgw']->preferences->read_repository();
-                               
$GLOBALS['phpgw']->preferences->add('property',location_columns_ . 
$this->type_id . !!$this->lookup,$values['columns'],'user');
+                               
$GLOBALS['phpgw']->preferences->add('property','location_columns_' . 
$this->type_id . !!$this->lookup,$values['columns'],'user');
                                
$GLOBALS['phpgw']->preferences->save_repository();
-
                                $receipt['message'][] = array('msg' => 
lang('columns is updated'));
                        }
-
                        $function_msg   = lang('Select Column');
 
                        $link_data = array
@@ -163,13 +162,13 @@
                                'lookup'                => $this->lookup
                        );
 
-
+                       $selected = isset($values['columns']) && 
$values['columns'] ? $values['columns'] : array();
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
                        (
                                'msgbox_data'           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'column_list'           => 
$this->bo->column_list(isset($values['columns']) ? 
$values['columns']:'',$type_id=$this->type_id,$allrows=true),
+                               'column_list'           => 
$this->bo->column_list($selected , $this->type_id, $allrows=true),
                                'function_msg'          => $function_msg,
                                'form_action'           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_columns'          => lang('columns'),
@@ -181,12 +180,19 @@
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
                }
 
+
                function index()
                {
+
                        $type_id        = $this->type_id;
+                       // $lookup use for pop-up
                        $lookup         = $this->lookup;
+                       // $lookup_name use in pop-up option "project"
                        $lookup_name    = phpgw::get_var('lookup_name');
+                       // use in option menu TENANT
                        $lookup_tenant  = phpgw::get_var('lookup_tenant', 
'bool');
+                       $block_query    = phpgw::get_var('block_query', 'bool');
+                       $dry_run=false;
 
                        if(!$type_id)
                        {
@@ -212,369 +218,517 @@
                                return;
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-                       
$GLOBALS['phpgw']->js->set_onload('document.search.query.focus();');
+                       $datatable = array();
+                       $values_combo_box = array();
 
-                       $location_list = 
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows));
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                               if(!$lookup)
+                               {
+                                       $datatable['menu']                      
        = $this->bocommon->get_menu();
+                               }
 
-                       $uicols = $this->bo->uicols;
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uilocation.index',
+                                               'type_id'                       
=> $type_id,
+                                                       'query'                 
        => $this->query,
+                               'district_id'           => $this->district_id,
+                               'part_of_town_id'       => 
$this->part_of_town_id,
+                               'lookup'                        => $lookup,
+                               'lookup_tenant'         => $lookup_tenant,
+                               'lookup_name'           => $lookup_name,
+                               'cat_id'                        => 
$this->cat_id,
+                               'status'                        => 
$this->status,
+                               'location_code'                 => 
$this->location_code
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilocation.index',"
+                                                                               
                ."type_id:'{$type_id}',"
+                                                                               
                ."query:'{$this->query}',"
+                                                                               
."district_id: '{$this->district_id}',"
+                                                                               
."part_of_town_id:'{$this->part_of_town_id}',"
+                                                                               
."lookup:'{$lookup}',"
+                                                                               
."lookup_tenant:'{$lookup_tenant}',"
+                                                                               
."lookup_name:'{$lookup_name}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."status:'{$this->status}',"
+                                                                               
."location_code:'{$this->location_code}',"
+                                                                               
."block_query:'{$block_query}'";
+
+                                // $values_combo_box  se usar� para escribir 
en el HTML, usando el XSLT
+                               $values_combo_box[0]  = 
$this->bocommon->select_category_list(array('format'=>'filter',
+                                                                               
'selected' => $this->cat_id,
+                                                                               
'type' =>'location',
+                                                                               
'type_id' =>$type_id,
+                                                                               
'order'=>'descr'));
+                               $default_value = array 
('id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no district'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                       $values_combo_box[2] =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no part of town'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
+                       {
+                            $values_combo_box[3] = 
$this->bo->get_owner_list('filter', $this->filter);
+                       }
+                       else
+                       {
+                           $values_combo_box[3] = 
$this->bo->get_owner_type_list('filter', $this->filter);
+                       }
+                       $default_value = array ('id'=>'','name'=>lang('show 
all'));
+                               array_unshift 
($values_combo_box[3],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilocation.index',
+                                                                       
'type_id'                       => $type_id,
+                                                                       
'district_id'       => $this->district_id,
+                                                                       
'part_of_town_id'   => $this->part_of_town_id,
+                                                                       
'lookup'                => $lookup,
+                                                                       
'lookup_tenant'     => $lookup_tenant,
+                                                                       
'lookup_name'       => $lookup_name,
+                                                                       
'cat_id'                => $this->cat_id,
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
CATEGORY
+                                                                               
                                'id' => 'btn_cat_id',
+                                                                               
                                'name' => 'cat_id',
+                                                                               
                                'value' => lang('Category'),
+                                                                               
                                'type' => 'button',
+                                                                               
                                'style' => 'filter',
+                                                                               
                                'tab_index' => 1
+                                                               ),
+                                                               array( //boton  
DISTINT
+                                                                               
                                'id' => 'btn_district_id',
+                                                                               
                                'name' => 'district_id',
+                                                                               
                                'value' => lang('District'),
+                                                                               
                                'type' => 'button',
+                                                                               
                                'style' => 'filter',
+                                                                               
                                'tab_index' => 2
+                                                               ),
+                                                               array( //boton  
PART OF TOWN
+                                                                               
                                'id' => 'btn_part_of_town_id',
+                                                                               
                                'name' => 'part_of_town_id',
+                                                                               
                                'value' => lang('Part of Town'),
+                                                                               
                                'type' => 'button',
+                                                                               
                                'style' => 'filter',
+                                                                               
                                'tab_index' => 3
+                                                               ),
+                                                               array( //boton  
FILTER
+                                                                               
                                'id' => 'btn_owner_id',
+                                                                               
                                'name' => 'owner_id',
+                                                                               
                                'value' => lang('Filter'),
+                                                                               
                                'type' => 'button',
+                                                                               
                                'style' => 'filter',
+                                                                               
                                'tab_index' => 4
+                                                               ),
+                                                                           
//for link "columns", next to Export button
+                                                                               
           array(
+                                                                               
'type' => 'link',
+                                                                               
'id' => 'btn_columns',
+                                                                               
'url' => "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                                                                                
           array
+                                                                               
                                                                                
              (
+                                                                               
                                                                                
               'menuaction' => 'property.uilocation.columns',
+                                                                               
                                                                                
               'type_id'  => $type_id,
+                                                                               
                                                                                
               'lookup'  => $this->lookup
+                                                                               
                                                                                
              ))."','','width=300,height=600,scrollbars=1')",
+                                                                               
                                'value' => lang('columns'),
+                                                                               
                                'tab_index' => 9
+                                                                               
                        ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_export',
+                                                                               
'value' => lang('download'),
+                                                                               
'tab_index' => 8
+                                                                           ),
+                                                                               
                        array( //hidden type_id
+                                                                               
'type'  => 'hidden',
+                                                                               
'id'    => 'type_id',
+                                                                               
'value' => $type_id
+                                                                           )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                                                                'id' => 
'values_combo_box_0',
+                                                                               
                                                                'value' => 
$this->bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                                                                'id' => 
'values_combo_box_1',
+                                                                               
                                                                'value' => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
              ),
+                                                                               
                                         array( //div values  combo_box_2
+                                                                               
                                                                'id' => 
'values_combo_box_2',
+                                                                               
                                                                'value' => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_3
+                                                                               
                                                                'id' => 
'values_combo_box_3',
+                                                                               
                                                                'value' => 
$this->bocommon->select2String($values_combo_box[3])
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+
+                               if(!$block_query)
+                               {       
+                               
$datatable['actions']['form'][0]['fields']['field'][] =  array
+                                                                               
                        (
+                                                                               
                                'id' => 'btn_search',
+                                                                               
                                'name' => 'search',
+                                                                               
                                'value'    => lang('search'),
+                                                                               
                                'type' => 'button',
+                                                                               
                                'tab_index' => 6
+                                                               );
+                                                               
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                                                               
                        (
+                                                                               
                                'name'     => 'query',
+                                                                               
                                'id'     => 'txt_query',
+                                                                               
                                'value'    => $this->query,//'',//$query,
+                                                                               
                                'type' => 'text',
+                                                                               
                                'size'    => 28,
+                                                                               
                                'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 5
+                                                               );
+                               }
+
+                               if(!$lookup)
+                               {
+                                       
$datatable['actions']['form'][0]['fields']['field'][] =  array
+                                                                               
                        (
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 7
+                                                                           );
+                               }
+
+                               $dry_run=true;
+
+                       }
+
+                       $location_list = array();
+                       //cramirez: $dry_run avoid to load all data the first 
time
+                       $location_list = 
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run'
 =>$dry_run));
 
-//_debug_array($location_list);
-//_debug_array($uicols);
+                       $uicols = $this->bo->uicols;
 
                        $content = array();
                        $j=0;
-                       if (isSet($location_list) && is_array($location_list))
+                       if (isset($location_list) && is_array($location_list))
                        {
                                foreach($location_list as $location)
                                {
                                        for 
($i=0;$i<count($uicols['name']);$i++)
                                        {
-
                                                
if($uicols['input_type'][$i]!='hidden')
                                                {
                                                        
if(isset($location['query_location'][$uicols['name'][$i]]))
                                                        {
-                                                               
$content[$j]['row'][$i]['statustext']                   = lang('search');
-                                                               
$content[$j]['row'][$i]['text']                         = 
$location[$uicols['name'][$i]];
-                                                               
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                        
'menuaction'    => 'property.uilocation.index',
-                                                                               
                                                                        'query' 
        => $location['query_location'][$uicols['name'][$i]],
-                                                                               
                                                                        
'lookup'        => $lookup,
-                                                                               
                                                                        
'type_id'       => $type_id,
-                                                                               
                                                                        
'lookup_tenant' => $lookup_tenant,
-                                                                               
                                                                        
'lookup_name'   => $lookup_name
-                                                                               
                                                                        )
-                                                                               
                                                                );
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['statustext']               = 
lang('search');
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$location[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['java_link']                = true;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']                             
= $location['query_location'][$uicols['name'][$i]];
                                                        }
                                                        else
                                                        {
-                                                               
$content[$j]['row'][$i]['value']                        = 
$location[$uicols['name'][$i]];
-                                                               
$content[$j]['row'][$i]['name']                         = $uicols['name'][$i];
-                                                               
$content[$j]['row'][$i]['lookup']                       = $lookup;
-                                                               
$content[$j]['row'][$i]['align']                        = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$location[$uicols['name'][$i]];
+                                                               
//$datatable['rows']['row'][$j]['column'][$i]['value']                  = $i;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['lookup']                   = 
$lookup;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
 
                                                                
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $location[$uicols['name'][$i]])
                                                                {
-                                                                       
$content[$j]['row'][$i]['text']         = lang('link');
-                                                                       
$content[$j]['row'][$i]['link']         = $location[$uicols['name'][$i]];
-                                                                       
$content[$j]['row'][$i]['target']       = '_blank';
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']            = lang('link');
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']             = 
$location[$uicols['name'][$i]];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
                                                                }
                                                        }
                                                }
+                                               else
+                                               {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$location[$uicols['name'][$i]];
+                                               }
 
-                                               
$content[$j]['hidden'][$i]['value']                     = 
$location[$uicols['name'][$i]];
-                                               
$content[$j]['hidden'][$i]['name']                              = 
$uicols['name'][$i];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                    = 
$location[$uicols['name'][$i]];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                     = 
$uicols['name'][$i];
                                        }
 
+                                       $j++;
+                               }
+                       }
+                       // NO pop-up
+                       $datatable['rowactions']['action'] = array();
                                        if(!$lookup)
                                        {
-                                               if($this->acl_read)
-                                               {
-                                                       
$content[$j]['row'][$i]['statustext']                   = lang('view the 
location');
-                                                       
$content[$j]['row'][$i]['text']                         = lang('view');
-                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                'menuaction'=> 
'property.uilocation.view',
-                                                                               
                                                                
'location_code'=> $location['location_code'],
-                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
+                               $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'location_code',
+                                                       'source'        => 
'location_code'
+                                               ),
                                                                                
                                                                )
                                                                                
                                                        );
-                                                       $i++;
-                                               }
 
-                                               if($this->acl_edit)
-                                               {
-                                                       
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
location');
-                                                       
$content[$j]['row'][$i]['text']                         = lang('edit');
-                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                'menuaction'=> 
'property.uilocation.edit',
-                                                                               
                                                                
'location_code'=> $location['location_code'],
-                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
+                               $parameters2 = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'sibling',
+                                                       'source'        => 
'location_code'
+                                               ),
                                                                                
                                                                )
                                                                                
                                                        );
-                                                       $i++;
-                                               }
 
-                                               if($this->acl_delete)
+                               if($this->acl_read)
                                                {
-                                                       
$content[$j]['row'][$i]['statustext']                   = lang('delete the 
location');
-                                                       
$content[$j]['row'][$i]['text']                         = lang('delete');
-                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                'menuaction'=> 
'property.uilocation.delete',
-                                                                               
                                                                
'location_code'=> $location['location_code'],
-                                                                               
                                                                'type_id'=> 
$type_id,
-                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
-                                                                               
                                                                )
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uilocation.view',
+                                                                               
        'lookup_tenant' => $lookup_tenant
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'view',
+                                               'text'                  => 
lang('open view in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uilocation.view',
+                                                                               
        'lookup_tenant' => $lookup_tenant,
+                                                                               
        'target'                => '_blank'
+                                                                               
)),
+                                               'parameters'    => $parameters
                                                                                
                                                        );
                                                }
-                                       }
-                                       $j++;
-                               }
-                       }
-//_debug_array($content);
-                       $uicols_count   = count($uicols['descr']);
-                       for ($i=0;$i<$uicols_count;$i++)
-                       {
-                               if($uicols['input_type'][$i]!='hidden')
+                               if($this->acl_add)
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1'):
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'edit',
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uilocation.edit',
+                                                                               
        'lookup_tenant' => $lookup_tenant
+                                                                               
)),
+                                               'parameters'    => $parameters2
+                                       );
+                               }
+                               if($this->acl_edit)
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'edit',
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'fm_location1.loc1',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uilocation.index',
-                                                                               
                                                        'type_id'               
=> $type_id,
-                                                                               
                                                        'query'                 
=> $this->query,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
-                                                                               
                                                        'lookup'                
=> $lookup,
+                                                                               
        'menuaction'    => 'property.uilocation.edit',
+                                                                               
        'lookup_tenant' => $lookup_tenant
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'edit',
+                                               'text'                  => 
lang('open edit in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uilocation.edit',
                                                                                
                                                        'lookup_tenant'         
=> $lookup_tenant,
-                                                                               
                                                        'lookup_name'           
=> $lookup_name,
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'status'                
=> $this->status)
-                                                                               
));
+                                                                               
        'target'                => '_blank'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+
                                        }
-                                       
elseif($uicols['name'][$i]=='street_name'):
+                               if($this->acl_delete)
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'delete',
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'street_name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uilocation.index',
-                                                                               
                                                        'type_id'               
=> $type_id,
-                                                                               
                                                        'query'                 
=> $this->query,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
-                                                                               
                                                        'lookup'                
=> $lookup,
-                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
-                                                                               
                                                        'lookup_name'           
=> $lookup_name,
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'status'                
=> $this->status)
-                                                                               
));
+                                                                               
        'menuaction'    => 'property.uilocation.delete',
+                                                                               
        'lookup_tenant' => $lookup_tenant
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
-                                       
elseif(isset($uicols['cols_return_extra'][$i]) && 
($uicols['cols_return_extra'][$i]!='T' || 
$uicols['cols_return_extra'][$i]!='CH')):
+                               if($this->acl_add)
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'add',
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                                                        (
-                                                               'sort'  => 
$this->sort,
-                                                               'var'   => 
$uicols['name'][$i],
-                                                               'order' => 
$this->order,
-                                                               'extra' => 
array('menuaction'   => 'property.uilocation.index',
+                                                                               
                'menuaction'    => 'property.uilocation.edit',
                                                                                
                                                        'type_id'               
=> $type_id,
-                                                                               
                                                        'query'                 
=> $this->query,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
-                                                                               
                                                        'lookup'                
=> $lookup,
-                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
-                                                                               
                                                        'lookup_name'           
=> $lookup_name,
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'status'                
=> $this->status)
-
-                                                       ));
-                                       }
-                                       endif;
+                                                                               
                'parent'                =>  $this->location_code
+                                                                               
        ))
+                                       );
                                }
+
+
+                               unset($parameters);
                        }
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
+                       $uicols_count   = count($uicols['descr']);
 
-                       if(!$lookup)
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
-                               if($this->acl_read)
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
!isset($uicols['formatter'][$i])  || !$uicols['formatter'][$i] ?  '""' : 
$uicols['formatter'][$i];
+
+                               if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('view');
-                                       $i++;
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
//$datatable['headers']['header'][$i]['formatter']              = 
(isset($uicols['formatter'][$i])? $uicols['formatter'][$i]:"");
+                                       if($uicols['name'][$i]=='loc1'):
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'fm_location1.loc1';
                                }
-                               if($this->acl_edit)
+                                       
elseif($uicols['name'][$i]=='street_name'):
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('edit');
-                                       $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'street_name';
                                }
-                               if($this->acl_delete)
+                                       
elseif(isset($uicols['cols_return_extra'][$i]) && 
($uicols['cols_return_extra'][$i]!='T' || 
$uicols['cols_return_extra'][$i]!='CH')):
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('delete');
-                                       $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                                }
+                                       endif;
                        }
                        else
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('select');
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
                        }
-
-                       if($this->acl_add)
-                       {
-                               $table_add[] = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
location'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                        'menuaction'=> 'property.uilocation.edit',
-                                                                               
                        'type_id'=>$type_id
-                                                                               
                        )
-                                                                               
          )
-                               );
                        }
-
-                       $link_data = array
-                       (
-                               'menuaction'            => 
'property.uilocation.index',
-                               'sort'                  => $this->sort,
-                               'order'                 => $this->order,
-                               'cat_id'                => $this->cat_id,
-                               'district_id'           => $this->district_id,
-                               'part_of_town_id'       => 
$this->part_of_town_id,
-                               'filter'                => $this->filter,
-                               'query'                 => $this->query,
-                               'lookup'                => $lookup,
-                               'lookup_tenant'         => $lookup_tenant,
-                               'lookup_name'           => $lookup_name,
-                               'type_id'               => $type_id,
-                               'status'                => $this->status
-                       );
-
+                       // for POP-UPs
+                       if($lookup)
+                       {
                        $input_name             = 
$GLOBALS['phpgw']->session->appsession('lookup_fields','property');
 
                        $function_exchange_values = '';
+
                        if(is_array($input_name))
                        {
                                for ($k=0;$k<count($input_name);$k++)
                                {
-                                       $function_exchange_values .= 
"opener.document.form." . $input_name[$k] . ".value = '';" ."\r\n";
+                                               $function_exchange_values .= 
"opener.document.forms[0]." . $input_name[$k] . ".value = '';" ."\r\n";
                                }
                        }
 
+       /*                      for ($i=0;$i<count($uicols['name']);$i++)
+                               {
+                                       if(isset($uicols['exchange'][$i]) && 
$uicols['exchange'][$i])
+                                       {
+                                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$uicols['name'][$i].'")[0].value = "";' 
."\r\n";
+                                       }
+                               }
+*/
                        for ($i=0;$i<count($uicols['name']);$i++)
                        {
                                if(isset($uicols['exchange'][$i]) && 
$uicols['exchange'][$i])
                                {
-                                       $function_exchange_values .= 
'opener.document.form.' . $uicols['name'][$i] .'.value = thisform.elements[' . 
$i . '].value;' ."\r\n";
+                                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$uicols['name'][$i].'")[0].value = "";' 
."\r\n";
+                                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$uicols['name'][$i].'")[0].value = 
valida(data.getData("'.$uicols['name'][$i].'"));' ."\r\n";
+                                               //$function_exchange_values .= 
'opener.document.forms[0].' . $uicols['name'][$i] .'.value = 
valida(data.getData("'.$uicols['name'][$i].'"));' ."\r\n";
                                }
                        }
 
                        $function_exchange_values .='window.close()';
 
-//_debug_array($input_name);
-                       $link_download = array
-                       (
-                               'menuaction'            => 
'property.uilocation.download',
-                               'sort'                  => $this->sort,
-                               'order'                 => $this->order,
-                               'cat_id'                => $this->cat_id,
-                               'district_id'           => $this->district_id,
-                               'part_of_town_id'       => 
$this->part_of_town_id,
-                               'filter'                => $this->filter,
-                               'query'                 => $this->query,
-                               'lookup'                => $lookup,
-                               'lookup_tenant'         => $lookup_tenant,
-                               'lookup_name'           => $lookup_name,
-                               'type_id'               => $type_id,
-                               'status'                => $this->status,
-                               'start'                 => $this->start
-                       );
+                               $datatable['exchange_values'] = 
$function_exchange_values;
 
-                       $link_columns = array
-                       (
-                               'menuaction'    => 
'property.uilocation.columns',
-                               'type_id'               => $type_id,
-                               'lookup'                => $this->lookup
-                       );
+                               $function_valida  = "var pos = 
data.indexOf('</a>');"."\r\n";
+                               $function_valida .= "if(pos==-1){"."\r\n";
+                               $function_valida .= "return data;"."\r\n";
+                               $function_valida .= "}else{"."\r\n";
+                               $function_valida .= "pos = 
data.indexOf('>');"."\r\n";
+                               $function_valida .= "var valor = 
data.slice(pos+1);"."\r\n";
+                               $function_valida .= "pos = 
valor.indexOf('<');"."\r\n";
+                               $function_valida .= "valor = 
valor.slice(0,pos);"."\r\n";
+                               $function_valida .= "return valor;"."\r\n";
+                               $function_valida .= "}"."\r\n";
 
-                       if(!$this->allrows)
-                       {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['valida'] = $function_valida;
                        }
-                       else
-                       {
-                               $record_limit   = $this->bo->total_records;
-                       }
 
-                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($location_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $owner_list = 
$this->bo->get_owner_list('filter', $this->filter);
+                               $datatable['sorting']['order']                  
= 'loc1'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
                        }
                        else
                        {
-                               $owner_list = 
$this->bo->get_owner_type_list('filter', $this->filter);
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-//_debug_array($owner_list);
 
-                       $data = array
-                       (
-                               'menu'                                  => 
$this->bocommon->get_menu(),
-                               'colspan'                               => 
$uicols_count+1,
-                               'lang_download'                         => 
'download',
-                               'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                    => 
lang('Download table to your browser'),
 
-                               'lang_columns'                          => 
lang('columns'),
-                               'link_columns'                          => 
$GLOBALS['phpgw']->link('/index.php',$link_columns),
-                               'lang_columns_help'                     => 
lang('Choose columns'),
 
-                               'exchange_values'                       => 
'Exchange_values(this.form);',
-                               'function_exchange_values'              => 
$function_exchange_values,
-                               'lang_select'                           => 
lang('select'),
-                               'lookup'                                => 
$lookup,
-                               'lang_property_name'                    => 
lang('Property name'),
-                               'allow_allrows'                         => true,
-                               'allrows'                               => 
$this->allrows,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($location_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
 
-                               'lang_status_statustext'                => 
lang('Select the status. To do not use a status select NO STATUS'),
-                               'status_name'                           => 
'status',
-                               'lang_no_status'                        => 
lang('No status'),
-                               'status_list'                           => 
$this->bo->select_status_list('filter',$this->status),
-
-                               'part_of_town_list'                             
=> 
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id),
-                               'lang_no_part_of_town'                          
=> lang('no part of town'),
-                               'lang_town_statustext'                          
=> lang('Select the part of town the selection belongs to. To do not use a part 
of town select NO PART OF TOWN'),
-                               'select_name_part_of_town'                      
=> 'part_of_town_id',
-
-                               'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'                              
=> lang('no district'),
-                               'lang_district_statustext'                      
=> lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                          
=> 'district_id',
-
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'location','type_id' =>$type_id,'order'=>'descr')),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'owner_name'                                    
=> 'filter',
-                               'owner_list'                                    
=> $owner_list,
-                               'lang_show_all'                                 
=> lang('Show all'),
-                               'lang_owner_statustext'                         
=> lang('Select the owner type. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
=> $content,
-                               'table_add'                                     
=> $table_add
-                       );
-
                        $appname                                                
= lang('location');
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
+
+
                        if($lookup)
                        {
                                $lookup_list    = 
$GLOBALS['phpgw']->session->appsession('lookup_name','property');
@@ -592,1048 +746,297 @@
                                }
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('location',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-               }
-
-
-               function index2()
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                {
-                       $type_id        = $this->type_id;
-                       $lookup         = $this->lookup;
-                       $lookup_name    = phpgw::get_var('lookup_name');
-                       $lookup_tenant  = phpgw::get_var('lookup_tenant', 
'bool');
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
 
-                       if(!$type_id)
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
                        {
-                               $type_id = 1;
-                       }
-                       if($lookup)
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
                        {
-                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
+                                               if(isset($column['format']) && 
$column['format']== "link" && isset($column['java_link']) && 
$column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
                        }
-
-                       if ( $type_id && !$lookup_tenant )
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
                        {
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
                        }
                        else
                        {
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
                        }
-
-                       if (!$this->acl_read)
-                       {
-                               $this->bocommon->no_access();
-                               return;
                        }
 
-               $GLOBALS['phpgw']->css->validate_file('datatable');
-               
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                               // values for control select
+                               //address@hidden 10/09/08 values passed for 
update select in YUI
+                               $opt_cb_depend =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                               $default_value = array ('id'=>'','name'=>'!no 
part of town');
+                               array_unshift ($opt_cb_depend,$default_value);
 
-               phpgwapi_yui::load_widget('dragdrop');
-               phpgwapi_yui::load_widget('datatable');
-               phpgwapi_yui::load_widget('menu');
-               phpgwapi_yui::load_widget('connection');
+                               $json['hidden']['dependent'][] = array ( 'id' 
=> $this->part_of_town_id,
+                                                             'value' => 
$this->bocommon->select2String($opt_cb_depend)
+                                                                               
                                );
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-                       $GLOBALS['phpgw']->js->validate_file( 'newdesign', 
'gabnr', 'property' );
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                       
$GLOBALS['phpgw']->js->set_onload('document.search.query.focus();');
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                       $location_list = 
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows));
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
 
-                       //echo $location_list;
-                       $uicols = $this->bo->uicols;
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'location.index', 'property' );
 
-//_debug_array($location_list);
-//_debug_array($uicols);
+                       //$this->save_sessiondata();
+               }
 
-                       $content = array();
-                       $j=0;
-                       if (isSet($location_list) && is_array($location_list))
-                       {
-                               foreach($location_list as $location)
-                               {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
+               function edit($view = '')
                                        {
+                       $get_history            = phpgw::get_var('get_history', 
'bool', 'POST');
+                       $change_type            = phpgw::get_var('change_type', 
'int', 'POST');
+                       $lookup_tenant          = 
phpgw::get_var('lookup_tenant', 'bool');
+                       $location_code          = 
phpgw::get_var('location_code');
+                       $sibling                        = 
phpgw::get_var('sibling');
+                       $parent                         = 
phpgw::get_var('parent');
+                       $values_attribute       = 
phpgw::get_var('values_attribute');
+                       $location                       = 
explode('-',$location_code);
 
-                                               
if($uicols['input_type'][$i]!='hidden')
-                                               {
-                                                       
if(isset($location['query_location'][$uicols['name'][$i]]))
+                       if($sibling)
                                                        {
-                                                               
$content[$j]['row'][$i]['statustext']                   = lang('search');
-                                                               
$content[$j]['row'][$i]['text']                         = 
$location[$uicols['name'][$i]];
-                                                               
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                        
'menuaction'    => 'property.uilocation.index',
-                                                                               
                                                                        'query' 
        => $location['query_location'][$uicols['name'][$i]],
-                                                                               
                                                                        
'lookup'        => $lookup,
-                                                                               
                                                                        
'type_id'       => $type_id,
-                                                                               
                                                                        
'lookup_tenant' => $lookup_tenant,
-                                                                               
                                                                        
'lookup_name'   => $lookup_name
-                                                                               
                                                                        )
-                                                                               
                                                                );
-                                                       }
-                                                       else
-                                                       {
-                                                               
$content[$j]['row'][$i]['value']                        = 
$location[$uicols['name'][$i]];
-                                                               
$content[$j]['row'][$i]['name']                         = $uicols['name'][$i];
-                                                               
$content[$j]['row'][$i]['lookup']                       = $lookup;
-                                                               
$content[$j]['row'][$i]['align']                        = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
-
-                                                               
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $location[$uicols['name'][$i]])
+                               $parent = array();
+                               $sibling = explode('-',$sibling);
+                               $this->type_id = count($sibling);
+                               for ($i=0;$i<(count($sibling)-1);$i++)
                                                                {
-                                                                       
$content[$j]['row'][$i]['text']         = lang('link');
-                                                                       
$content[$j]['row'][$i]['link']         = $location[$uicols['name'][$i]];
-                                                                       
$content[$j]['row'][$i]['target']       = '_blank';
-                                                               }
+                                       $parent[] = $sibling[$i];
                                                        }
+                               $parent = implode('-', $parent);
                                                }
 
-                                               
$content[$j]['hidden'][$i]['value']                     = 
$location[$uicols['name'][$i]];
-                                               
$content[$j]['hidden'][$i]['name']                              = 
$uicols['name'][$i];
+                       $type_id                = $this->type_id;
 
+                       if($location_code)
+                       {
+                               $type_id = count($location);
                                        }
 
-                                       if(!$lookup)
-                                       {
-                                               if($this->acl_read)
+                       if ( $type_id && !$lookup_tenant )
                                                {
-                                                       
$content[$j]['row'][$i]['statustext']                   = lang('view the 
location');
-                                                       
$content[$j]['row'][$i]['text']                         = lang('view');
-                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                'menuaction'=> 
'property.uilocation.view',
-                                                                               
                                                                
'location_code'=> $location['location_code'],
-                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
-                                                                               
                                                                )
-                                                                               
                                                        );
-                                                       $i++;
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
                                                }
-
-                                               if($this->acl_edit)
+                       else
                                                {
-                                                       
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
location');
-                                                       
$content[$j]['row'][$i]['text']                         = lang('edit');
-                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                'menuaction'=> 
'property.uilocation.edit',
-                                                                               
                                                                
'location_code'=> $location['location_code'],
-                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
-                                                                               
                                                                )
-                                                                               
                                                        );
-                                                       $i++;
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
                                                }
 
-                                               if($this->acl_delete)
+                       if($view)
                                                {
-                                                       
$content[$j]['row'][$i]['statustext']                   = lang('delete the 
location');
-                                                       
$content[$j]['row'][$i]['text']                         = lang('delete');
-                                                       
$content[$j]['row'][$i]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                'menuaction'=> 
'property.uilocation.delete',
-                                                                               
                                                                
'location_code'=> $location['location_code'],
-                                                                               
                                                                'type_id'=> 
$type_id,
-                                                                               
                                                                
'lookup_tenant'=>$lookup_tenant
-                                                                               
                                                                )
-                                                                               
                                                        );
-                                               }
-                                       }
-                                       $j++;
+                               if( !$this->acl_read)
+                               {
+                                       $this->bocommon->no_access();
+                                       return;
                                }
                        }
-//_debug_array($content);
-                       $uicols_count   = count($uicols['descr']);
-                       for ($i=0;$i<$uicols_count;$i++)
-                       {
-                               if($uicols['input_type'][$i]!='hidden')
+                       else
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1'):
+                               if(!$this->acl_add && !$this->acl_edit)
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'fm_location1.loc1',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uilocation.index',
-                                                                               
                                                        'type_id'               
=> $type_id,
-                                                                               
                                                        'query'                 
=> $this->query,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
-                                                                               
                                                        'lookup'                
=> $lookup,
-                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
-                                                                               
                                                        'lookup_name'           
=> $lookup_name,
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'status'                
=> $this->status)
-                                                                               
));
+                                       $this->bocommon->no_access();
+                                       return;
                                        }
-                                       
elseif($uicols['name'][$i]=='street_name'):
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'street_name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uilocation.index',
-                                                                               
                                                        'type_id'               
=> $type_id,
-                                                                               
                                                        'query'                 
=> $this->query,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
-                                                                               
                                                        'lookup'                
=> $lookup,
-                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
-                                                                               
                                                        'lookup_name'           
=> $lookup_name,
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'status'                
=> $this->status)
-                                                                               
));
                                        }
-                                       
elseif(isset($uicols['cols_return_extra'][$i]) && 
($uicols['cols_return_extra'][$i]!='T' || 
$uicols['cols_return_extra'][$i]!='CH')):
+
+                       $values = array();
+                       if(isset($_POST['save']) && !$view)
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                       (
-                                                               'sort'  => 
$this->sort,
-                                                               'var'   => 
$uicols['name'][$i],
-                                                               'order' => 
$this->order,
-                                                               'extra' => 
array('menuaction'   => 'property.uilocation.index',
-                                                                               
                                                        'type_id'               
=> $type_id,
-                                                                               
                                                        'query'                 
=> $this->query,
-                                                                               
                                                        'district_id'           
=> $this->district_id,
-                                                                               
                                                        'part_of_town_id'       
=> $this->part_of_town_id,
-                                                                               
                                                        'lookup'                
=> $lookup,
-                                                                               
                                                        'lookup_tenant'         
=> $lookup_tenant,
-                                                                               
                                                        'lookup_name'           
=> $lookup_name,
-                                                                               
                                                        'cat_id'                
=> $this->cat_id,
-                                                                               
                                                        'status'                
=> $this->status)
+                               $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+                               
$GLOBALS['phpgw']->session->appsession('insert_record','property','');
 
-                                                       ));
-                                       }
-                                       endif;
+                               if(isset($insert_record['location']) && 
is_array($insert_record['location']))
+                               {
+                                       for ($i=0; 
$i<count($insert_record['location']); $i++)
+                                       {
+                                               
$values[$insert_record['location'][$i]]= 
phpgw::get_var($insert_record['location'][$i], 'string', 'POST');
                                }
                        }
 
-                       if(!$lookup)
-                       {
-                               if($this->acl_read)
+                               $insert_record_attributes       = 
$GLOBALS['phpgw']->session->appsession('insert_record_values' . '.location.' . 
$this->type_id,'property');
+
+                               if(is_array($insert_record_attributes))
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('view');
-                                       $i++;
-                               }
-                               if($this->acl_edit)
+                                       foreach ($insert_record_attributes as 
$attribute)
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('edit');
-                                       $i++;
-                               }
-                               if($this->acl_delete)
+                                               foreach ($values_attribute as 
&$attr)
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('delete');
-                                       $i++;
-                               }
-                       }
-                       else
+                                                       if($attr['name'] ==  
$attribute)
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('select');
+                                                               $attr['value'] 
= phpgw::get_var($attribute, 'string', 'POST');
                        }
-
-                       if($this->acl_add)
-                       {
-                               $table_add[] = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
location'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                        'menuaction'=> 'property.uilocation.edit',
-                                                                               
                        'type_id'=>$type_id
-                                                                               
                        )
-                                                                               
          )
-                               );
                        }
-
-                       $link_data = array
-                       (
-                               'menuaction'            => 
'property.uilocation.index',
-                               'sort'                  => $this->sort,
-                               'order'                 => $this->order,
-                               'cat_id'                => $this->cat_id,
-                               'district_id'           => $this->district_id,
-                               'part_of_town_id'       => 
$this->part_of_town_id,
-                               'filter'                => $this->filter,
-                               'query'                 => $this->query,
-                               'lookup'                => $lookup,
-                               'lookup_tenant'         => $lookup_tenant,
-                               'lookup_name'           => $lookup_name,
-                               'type_id'               => $type_id,
-                               'status'                => $this->status
-                       );
-
-                       $input_name             = 
$GLOBALS['phpgw']->session->appsession('lookup_fields','property');
-
-                       $function_exchange_values = '';
-                       if(is_array($input_name))
-                       {
-                               for ($k=0;$k<count($input_name);$k++)
-                               {
-                                       $function_exchange_values .= 
"opener.document.form." . $input_name[$k] . ".value = '';" ."\r\n";
                                }
                        }
 
-                       for ($i=0;$i<count($uicols['name']);$i++)
-                       {
-                               if(isset($uicols['exchange'][$i]) && 
$uicols['exchange'][$i])
-                               {
-                                       $function_exchange_values .= 
'opener.document.form.' . $uicols['name'][$i] .'.value = thisform.elements[' . 
$i . '].value;' ."\r\n";
-                               }
-                       }
-
-                       $function_exchange_values .='window.close()';
-
-//_debug_array($input_name);
-                       $link_download = array
-                       (
-                               'menuaction'            => 
'property.uilocation.download',
-                               'sort'                  => $this->sort,
-                               'order'                 => $this->order,
-                               'cat_id'                => $this->cat_id,
-                               'district_id'           => $this->district_id,
-                               'part_of_town_id'       => 
$this->part_of_town_id,
-                               'filter'                => $this->filter,
-                               'query'                 => $this->query,
-                               'lookup'                => $lookup,
-                               'lookup_tenant'         => $lookup_tenant,
-                               'lookup_name'           => $lookup_name,
-                               'type_id'               => $type_id,
-                               'status'                => $this->status,
-                               'start'                 => $this->start
-                       );
-
-                       $link_columns = array
-                       (
-                               'menuaction'    => 
'property.uilocation.columns',
-                               'type_id'               => $type_id,
-                               'lookup'                => $this->lookup
-                       );
-
-                       if(!$this->allrows)
-                       {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       }
-                       else
-                       {
-                               $record_limit   = $this->bo->total_records;
-                       }
-
-                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
-                       {
-                               $owner_list = 
$this->bo->get_owner_list('filter', $this->filter);
-                       }
-                       else
-                       {
-                               $owner_list = 
$this->bo->get_owner_type_list('filter', $this->filter);
-                       }
-
-                       //_debug_array($owner_list);
-
-                       $data = array
-                       (
-                               'menu'                                  => 
$this->bocommon->get_menu(),
-                               'colspan'                               => 
$uicols_count+1,
-                               'lang_download'                         => 
'download',
-                               'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                    => 
lang('Download table to your browser'),
-
-                               'lang_columns'                          => 
lang('columns'),
-                               'link_columns'                          => 
$GLOBALS['phpgw']->link('/index.php',$link_columns),
-                               'lang_columns_help'                     => 
lang('Choose columns'),
-
-                               'exchange_values'                       => 
'Exchange_values(this.form);',
-                               'function_exchange_values'              => 
$function_exchange_values,
-                               'lang_select'                           => 
lang('select'),
-                               'lookup'                                => 
$lookup,
-                               'lang_property_name'                    => 
lang('Property name'),
-                               'allow_allrows'                         => true,
-                               'allrows'                               => 
$this->allrows,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($location_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
-                               'lang_status_statustext'                => 
lang('Select the status. To do not use a status select NO STATUS'),
-                               'status_name'                           => 
'status',
-                               'lang_no_status'                        => 
lang('No status'),
-                               'status_list'                           => 
$this->bo->select_status_list('filter',$this->status),
-
-                               'part_of_town_list'                             
=> 
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id),
-                               'lang_no_part_of_town'                          
=> lang('no part of town'),
-                               'lang_town_statustext'                          
=> lang('Select the part of town the selection belongs to. To do not use a part 
of town select NO PART OF TOWN'),
-                               'select_name_part_of_town'                      
=> 'part_of_town_id',
-
-                               'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'                              
=> lang('no district'),
-                               'lang_district_statustext'                      
=> lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                          
=> 'district_id',
-
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'location','type_id' =>$type_id,'order'=>'descr')),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'owner_name'                                    
=> 'filter',
-                               'owner_list'                                    
=> $owner_list,
-                               'lang_show_all'                                 
=> lang('Show all'),
-                               'lang_owner_statustext'                         
=> lang('Select the owner type. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
=> $content,
-                               'table_add'                                     
=> $table_add
-                       );
-
-                       $appname                                                
= lang('location');
-
-                       if($lookup)
-                       {
-                               $lookup_list    = 
$GLOBALS['phpgw']->session->appsession('lookup_name','property');
-                               $function_msg   = $lookup_list[$lookup_name];
-                       }
-                       else
-                       {
-                               if($lookup_tenant)
-                               {
-                                       $function_msg   = lang('Tenant');
-                               }
-                               else
-                               {
-                                       $function_msg                           
        = $uicols['descr'][($type_id)];
-                               }
-                       }
-
-/***********************************/
-               if( phpgw::get_var('phpgw_return_as') == 'json' ) {
-
-               $json = array(
-                       'recordsReturned'       => 3,
-                       'totalRecords'          => count($data["values"]),
-                       'recordStartIndex'      => 0,
-                       'sortKey'                       => null,
-                       'sortDir'                       => "asc",
-                       'records'                       => array()
-               );
-
-
-               for( $i=0;$i < count($data["values"]) ; $i++)
-               {
-                               $fields = $data["values"][$i]["hidden"];
-                               //$row = $data["values"][$i]["row"];
-                               $json_row = array();
-
-                               foreach($fields as $row){
-                               $json_row[$row["name"]] = $row["value"];
-                               }
-
-                       $json['records'][] = $json_row;
-               }
-
-
-               return $json;
-               }
-
-/*********************************************/
-
-
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('location',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
-
-               }
-
-               function edit()
-               {
-                       $get_history            = phpgw::get_var('get_history', 
'bool', 'POST');
-                       $change_type            = phpgw::get_var('change_type', 
'int', 'POST');
-                       $lookup_tenant          = 
phpgw::get_var('lookup_tenant', 'bool');
-                       $location_code          = 
phpgw::get_var('location_code');
-                       $values_attribute       = 
phpgw::get_var('values_attribute');
-                       $location                       = 
explode('-',$location_code);
-
-                       $type_id                = $this->type_id;
-
-                       if($location_code)
-                       {
-                               $type_id = count($location);
-                       }
-
-                       if ( $type_id && !$lookup_tenant )
-                       {
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
-                       }
-                       else
-                       {
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
-                       }
-
-                       if(!$this->acl_add && !$this->acl_edit)
-                       {
-                               $this->bocommon->no_access();
-                               return;
-                       }
-
-                       $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
-                       
$GLOBALS['phpgw']->session->appsession('insert_record','property','');
-
-                       $values = array();
-                       if(isset($_POST['save']))
-                       {
-                               if(isset($insert_record['location']) && 
is_array($insert_record['location']))
-                               {
-                                       for ($i=0; 
$i<count($insert_record['location']); $i++)
-                                       {
-                                               
$values[$insert_record['location'][$i]]= 
phpgw::get_var($insert_record['location'][$i], 'string', 'POST');
-                                       }
-                               }
-
-                               $insert_record_attributes       = 
$GLOBALS['phpgw']->session->appsession('insert_record_values' . '.location.' . 
$this->type_id,'property');
-
-                               if(is_array($insert_record_attributes))
-                               {
-                                       foreach ($insert_record_attributes as 
$attribute)
-                                       {
-                                               foreach ($values_attribute as 
&$attr)
-                                               {
-                                                       if($attr['name'] ==  
$attribute)
-                                                       {
-                                                               $attr['value'] 
= phpgw::get_var($attribute, 'string', 'POST');
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               if(isset($insert_record['extra']) && 
is_array($insert_record['extra']))
-                               {
-                                       for ($i=0; 
$i<count($insert_record['extra']); $i++)
-                                       {
-                                               
$values[$insert_record['extra'][$i]]= 
phpgw::get_var($insert_record['extra'][$i], 'string', 'POST');
-                                       }
-                               }
-                       }
-
-
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('location','attributes_form'));
-
-                       if ($values)
-                       {
-                               for ($i=1; $i<($type_id+1); $i++)
-                               {
-                                       if((!$values['loc' . $i]  && 
(!isset($location[($i-1)])  || !$location[($i-1)])  ) || !$values['loc' . $i])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please select a location %1 ID !',$i));
-                                               $error_id=true;
-                                       }
-
-                                       $values['location_code'][]= 
$values['loc' . $i];
-
-                                       if($i<$type_id)
-                                       {
-                                               $location_parent[]= 
$values['loc' . ($i)];
-                                       }
-                               }
-
-                               if(!$values['cat_id'])
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select a category'));
-                               }
-
-                               if (isset($insert_record['extra']) && 
array_search('street_id',$insert_record['extra']) && 
(!isset($values['street_id']) || !$values['street_id']))
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select a street'));
-                               }
-                               if (isset($insert_record['extra']) && 
array_search('part_of_town_id',$insert_record['extra']) && 
(!isset($values['part_of_town_id']) || !$values['part_of_town_id']))
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select a part of town'));
-                               }
-                               if (isset($insert_record['extra']) && 
array_search('owner_id',$insert_record['extra']) && 
(!isset($values['owner_id']) || !$values['owner_id']))
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select an owner'));
-                               }
-
-                               $values['location_code']=implode("-", 
$values['location_code']);
-
-                               if($values['location_code'] && !$location_code)
-                               {
-                                       
if($this->bo->check_location($values['location_code'],$type_id))
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('This location is already registered!') . 
'[ '.$values['location_code'].' ]');
-                                               $error_location_id=true;
-                                               $error_id=true;
-                                       }
-                               }
-
-                               if($location_code)
-                               {
-                                       $action='edit';
-                                       $values['change_type'] = $change_type;
-
-
-                                       if(!$values['change_type'])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please select change type'));
-                                       }
-                               }
-                               elseif(!$location_code && !$error_id )
-                               {
-                                       $location_code=$values['location_code'];
-                               }
-
-                               if(!isset($receipt['error']))
-                               {
-                                       $receipt = 
$this->bo->save($values,$values_attribute,$action,$type_id,isset($location_parent)?$location_parent:'');
-                               }
-                               else
-                               {
-                                       if(isset($location_parent) && 
$location_parent)
-                                       {
-                                               
$location_code_parent=implode("-", $location_parent);
-                                               $values = 
$this->bo->read_single($location_code_parent);
-                                               /* restore date from posting */
                                                
if(isset($insert_record['extra']) && is_array($insert_record['extra']))
-                                               {
-                                                       for ($i=0; 
$i<count($insert_record['extra']); $i++)
-                                                       {
-                                                               
$values[$insert_record['extra'][$i]]= 
phpgw::get_var($insert_record['extra'][$i], 'string', 'POST');
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       if(!isset($error_id) && $location_code)
-                       {
-                               $values = 
$this->bo->read_single($location_code,array('tenant_id'=>'lookup'));
-
-                               $check_history = 
$this->bo->check_history($location_code);
-                               if($get_history)
-                               {
-                                       $history = 
$this->bo->get_history($location_code);
-                                       $uicols = $this->bo->uicols;
-
-                                       $j=0;
-                                       if (isSet($history) && 
is_array($history))
-                                       {
-                                               foreach($history as $entry)
-                                               {
-                                                       $k=0;
-                                                       for 
($i=0;$i<count($uicols['name']);$i++)
-                                                       {
-                                                               
if($uicols['input_type'][$i]!='hidden')
-                                                               {
-                                                                       
$content[$j]['row'][$k]['value']        = $entry[$uicols['name'][$i]];
-                                                                       
$content[$j]['row'][$k]['name']         = $uicols['name'][$i];
-                                                               }
-
-                                                               
$content[$j]['hidden'][$k]['value']             = $entry[$uicols['name'][$i]];
-                                                               
$content[$j]['hidden'][$k]['name']              = $uicols['name'][$i];
-                                                               $k++;
-                                                       }
-                                                       $j++;
-                                               }
-                                       }
-
-                                       $uicols_count   = 
count($uicols['descr']);
-                                       for ($i=0;$i<$uicols_count;$i++)
-                                       {
-                                               
if($uicols['input_type'][$i]!='hidden')
-                                               {
-                                                       
$table_header[$i]['header']     = $uicols['descr'][$i];
-                                                       
$table_header[$i]['width']      = '5%';
-                                                       
$table_header[$i]['align']      = 'center';
-                                               }
-                                       }
-                               }
-                       }
-                       /* Preserve attribute values from post */
-                       if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
-                       {
-                               $values = 
$this->bocommon->preserve_attribute_values($values,$values_attribute);
-                               unset($values['location_code']);
-                       }
-
-                       if(!$values)
-                       {
-                               $values['attributes']   = 
$this->bo->find_attribute(".location.{$this->type_id}");
-                               $values                                 = 
$this->bo->prepare_attribute($values, ".location.{$this->type_id}");
-                       }
-
-                       if ($values['cat_id'] > 0)
-                       {
-                               $this->cat_id = $values['cat_id'];
-                       }
-
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uilocation.edit',
-                               'location_code' => $location_code,
-                               'type_id'       => $type_id,
-                               'lookup_tenant' => $lookup_tenant
-                       );
-
-                       $lookup_type='form';
-
-                       $location_data=$this->bo->initiate_ui_location(array(
-                                               'values'                => 
$values,
-                                               'type_id'               => 
($type_id-1),
-                                               'no_link'               => 
($type_id), // disable lookup links for location type less than type_id
-                                               'tenant'                => 
false,
-                                               'lookup_type'   => $lookup_type
-                                               ));
-
-                       $location_types = $this->bo->location_types;
-                       $config                 = $this->bo->config;
-
-                       if ($location_code)
-                       {
-                               $function_msg = lang('edit');
-                       }
-                       else
-                       {
-                               $function_msg = lang('add');
-                       }
-
-                       $function_msg .= ' ' 
.$location_types[($type_id-1)]['name'];
-
-                       $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
-
-                       if(!is_array($insert_record))
-                       {
-                               $insert_record = array();
-                       }
-
-                       $j=0;
-                       $additional_fields[$j]['input_text']    = 
$location_types[($type_id-1)]['name'];
-                       $additional_fields[$j]['statustext']    = 
$location_types[($type_id-1)]['descr'];
-                       $additional_fields[$j]['datatype']              = 
'varchar';
-                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id;
-                       $additional_fields[$j]['name']                  = 'loc' 
. $type_id;
-                       $additional_fields[$j]['value']                 = 
isset($values[$additional_fields[$j]['input_name']])?$values[$additional_fields[$j]['input_name']]:'';
-                       $additional_fields[$j]['class']                 = 
'th_text';
-                       $insert_record['extra'][]                               
= $additional_fields[$j]['input_name'];
-
-                       $j++;
-                       $additional_fields[$j]['input_text']    = lang('name');
-                       $additional_fields[$j]['statustext']    = lang('enter 
the name for this location');
-                       $additional_fields[$j]['datatype']              = 
'varchar';
-                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
-                       $additional_fields[$j]['name']                  = 'loc' 
. $type_id . '_name';
-                       $additional_fields[$j]['value']                 = 
isset($values[$additional_fields[$j]['input_name']])?$values[$additional_fields[$j]['input_name']]:'';
-                       $insert_record['extra'][]                               
= $additional_fields[$j]['input_name'];
-                       $j++;
-
-
-
-//_debug_array($attributes_values);
-
-                       $insert_record['extra'][]                               
                = 'cat_id';
-
-                       $config_count=count($config);
-                       for ($j=0;$j<$config_count;$j++)
-                       {
-                               if($config[$j]['location_type'] == $type_id)
-                               {
-
-                                       
if($config[$j]['column_name']=='street_id')
-                                       {
-                                               $edit_street=true;
-                                               $insert_record['extra'][]       
= 'street_id';
-                                               $insert_record['extra'][]       
= 'street_number';
-                                       }
-
-                                       
if($config[$j]['column_name']=='tenant_id')
-                                       {
-                                               $edit_tenant=true;
-                                               $insert_record['extra'][]       
= 'tenant_id';
-                                       }
-
-                                       
if($config[$j]['column_name']=='part_of_town_id')
-                                       {
-                                               $edit_part_of_town              
= true;
-                                               $select_name_part_of_town       
= 'part_of_town_id';
-                                               $part_of_town_list              
= $this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
-                                               $lang_town_statustext           
= lang('Select the part of town the property belongs to. To do not use a part 
of town -  select NO PART OF TOWN');
-                                               $insert_record['extra'][]       
= 'part_of_town_id';
-                                       }
-                                       
if($config[$j]['column_name']=='owner_id')
-                                       {
-                                               $edit_owner                     
= true;
-                                               $lang_owner                     
= lang('Owner');
-                                               $owner_list                     
= $this->bo->get_owner_list('',$values['owner_id']);
-                                               $lang_select_owner              
= lang('Select owner');
-                                               $lang_owner_statustext          
= lang('Select the owner');
-                                               $insert_record['extra'][]       
= 'owner_id';
-                                       }
-                               }
-                       }
-
-                       
$GLOBALS['phpgw']->session->appsession('insert_record','property',$insert_record);
-
-                       if(isset($receipt))
-                       {
-                               $msgbox_data = 
$this->bocommon->msgbox_data($receipt);
-                       }
-
-
-                       if($location_code)
-                       {
-                               $change_type_list = 
$this->bo->select_change_type($values['change_type']);
-
-                               $location_types = 
$this->soadmin_location->read(array('order'=>'id','sort'=>'ASC'));
-                               foreach ($location_types as $location_type)
-                               {
-                                       if($type_id != $location_type['id'])
-                                       {
-                                               if($type_id > 
$location_type['id'])
-                                               {
-                                                       $entities_link[] = array
-                                                       (
-                                                               'entity_link'   
                => $GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                        'menuaction'=> 
'property.uilocation.edit',
-                                                                               
                                        
'location_code'=>implode('-',array_slice($location, 0, $location_type['id']))
-                                                                               
                                        )
-                                                                               
                                ),
-                                                               
'lang_entity_statustext'        => $location_type['descr'],
-                                                               'text_entity'   
                => $location_type['name'],
-                                                       );
-                                               }
-                                               else
-                                               {
-                                                       $entities_link[] = array
-                                                       (
-                                                               'entity_link'   
                => $GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                        'menuaction'=> 
'property.uilocation.index',
-                                                                               
                                        'type_id'=> $location_type['id'],
-                                                                               
                                        
'query'=>implode('-',array_slice($location, 0, $location_type['id']))
-                                                                               
                                        )
-                                                                               
                                ),
-                                                               
'lang_entity_statustext'        => $location_type['descr'],
-                                                               'text_entity'   
                => $location_type['name'],
-                                                       );
-                                               }
-                                       }
-                               }
-
-                               $entities= 
$this->bo->read_entity_to_link($location_code);
-
-                               if (isset($entities) && is_array($entities))
-                               {
-                                       foreach($entities as $entity_entry)
-                                       {
-                                               
if(isset($entity_entry['entity_link']) && $entity_entry['entity_link'])
-                                               {
-                                                       $entities_link[] = array
-                                                       (
-                                                               'entity_link'   
                => $entity_entry['entity_link'],
-                                                               
'lang_entity_statustext'        => $entity_entry['descr'],
-                                                               'text_entity'   
                => $entity_entry['name'],
-                                                       );
-                                               }
-                                               else
-                                               {
-                                                       $entities_link[] = array
-                                                       (
-                                                               'entity_link'   
                => $GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                'menuaction'=> 
'property.uientity.index',
-                                                                               
                                                'entity_id'=> 
$entity_entry['entity_id'],
-                                                                               
                                                'cat_id'=> 
$entity_entry['cat_id'],
-                                                                               
                                                'query'=> $location_code
-                                                                               
                                                )
-                                                                               
                                        ),
-                                                               
'lang_entity_statustext'        => $entity_entry['descr'],
-                                                               'text_entity'   
                => $entity_entry['name'],
-                                                       );
-                                               }
-                                       }
-                               }
-                       }
-
-                       $data = array
-                       (
-                               'lang_change_type'                              
=> lang('Change type'),
-                               'lang_no_change_type'                   => 
lang('No Change type'),
-                               'lang_change_type_statustext'   => lang('Type 
of changes'),
-                               'change_type_list'                              
=> (isset($change_type_list)?$change_type_list:''),
-                               'check_history'                                 
=> (isset($check_history)?$check_history:''),
-                               'lang_history'                                  
=> lang('History'),
-                               'lang_history_statustext'               => 
lang('Fetch the history for this item'),
-                               'table_header'                                  
=> (isset($table_header)?$table_header:''),
-                               'values'                                        
        => (isset($content)?$content:''),
-
-                               'lang_related_info'                             
=> lang('related info'),
-                               'entities_link'                                 
=> (isset($entities_link)?$entities_link:''),
-                               'edit_street'                                   
=> (isset($edit_street)?$edit_street:''),
-                               'edit_tenant'                                   
=> (isset($edit_tenant)?$edit_tenant:''),
-                               'edit_part_of_town'                             
=> (isset($edit_part_of_town)?$edit_part_of_town:''),
-                               'edit_owner'                                    
=> (isset($edit_owner)?$edit_owner:''),
-                               'select_name_part_of_town'              => 
(isset($select_name_part_of_town)?$select_name_part_of_town:''),
-                               'part_of_town_list'                             
=> (isset($part_of_town_list)?$part_of_town_list:''),
-                               'lang_town_statustext'                  => 
(isset($lang_town_statustext)?$lang_town_statustext:''),
-                               'lang_part_of_town'                             
=> lang('Part of town'),
-                               'lang_no_part_of_town'                  => 
lang('No part of town'),
-                               'lang_owner'                                    
=> (isset($lang_owner)?$lang_owner:''),
-                               'owner_list'                                    
=> (isset($owner_list)?$owner_list:''),
-                               'lang_select_owner'                             
=> (isset($lang_select_owner)?$lang_select_owner:''),
-                               'lang_owner_statustext'                 => 
(isset($lang_owner_statustext)?$lang_owner_statustext:''),
-                               'additional_fields'                             
=> $additional_fields,
-                               'attributes_values'                             
=> $values['attributes'],
-                               'lookup_functions'                              
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
-                               'lang_none'                                     
        => lang('None'),
-
-                               'msgbox_data'                                   
=> (isset($msgbox_data)?$GLOBALS['phpgw']->common->msgbox($msgbox_data):''),
-
-                               'street_link'                                   
=> "menuaction:'" . 'property'.".uilookup.street'",
-                               'lang_street'                                   
=> lang('Street'),
-                               'lang_select_street_help'               => 
lang('Select the street name'),
-                               'lang_street_num_statustext'    => lang('Enter 
the street number'),
-                               'value_street_id'                               
=> (isset($values['street_id'])?$values['street_id']:''),
-                               'value_street_name'                             
=> (isset($values['street_name'])?$values['street_name']:''),
-                               'value_street_number'                   => 
(isset($values['street_number'])?$values['street_number']:''),
-
-                               'tenant_link'                                   
=> "menuaction:'" . 'property'.".uilookup.tenant'",
-                               'lang_tenant'                                   
=> lang('tenant'),
-                               'value_tenant_id'                               
=> (isset($values['tenant_id'])?$values['tenant_id']:''),
-                               'value_last_name'                               
=> (isset($values['last_name'])?$values['last_name']:''),
-                               'value_first_name'                              
=> (isset($values['first_name'])?$values['first_name']:''),
-                               'lang_tenant_statustext'                => 
lang('Select a tenant'),
-                               'size_last_name'                                
=> (isset($values['last_name'])?strlen($values['last_name']):''),
-                               'size_first_name'                               
=> (isset($values['first_name'])?strlen($values['first_name']):''),
-                               'lookup_type'                                   
=> $lookup_type,
-                               'location_data'                                 
=> $location_data,
-                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.index','type_id'=> $type_id, 'lookup_tenant'=> 
$lookup_tenant)),
-                               'lang_save'                                     
        => lang('save'),
-                               'lang_done'                                     
        => lang('done'),
-                               'lang_done_statustext'                  => 
lang('Back to the list'),
-                               'lang_save_statustext'                  => 
lang('Save the location'),
-                               'lang_category'                                 
=> lang('category'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
        => 
$this->bocommon->select_category_list(array('format'=>'select','selected' => 
$values['cat_id'],'type' =>'location','type_id' =>$type_id,'order'=>'descr')),
-                               'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
-                       );
-
-                       $appname        = lang('location');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+                               {
+                                       for ($i=0; 
$i<count($insert_record['extra']); $i++)
+                                       {
+                                               
$values[$insert_record['extra'][$i]]= 
phpgw::get_var($insert_record['extra'][$i], 'string', 'POST');
+                                       }
+                               }
                }
 
 
-               function delete()
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('location','attributes_form'));
+
+                       if ($values)
                {
-                       $location_code          = 
phpgw::get_var('location_code', 'string', 'GET');
-                       $type_id                = $this->type_id;
+                               for ($i=1; $i<($type_id+1); $i++)
+                               {
+                                       if((!$values['loc' . $i]  && 
(!isset($location[($i-1)])  || !$location[($i-1)])  ) || !$values['loc' . $i])
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please select a location %1 ID !',$i));
+                                               $error_id=true;
+                                       }
 
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::loc_$type_id";
+                                       $values['location_code'][]= 
$values['loc' . $i];
 
-                       if(!$this->acl_delete)
+                                       if($i<$type_id)
                        {
-                               $this->bocommon->no_access();
-                               return;
+                                               $location_parent[]= 
$values['loc' . ($i)];
+                                       }
                        }
 
-                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+                               if(!$values['cat_id'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a category'));
+                               }
 
-                       $link_data = array
-                       (
-                               'menuaction' => 'property.uilocation.index',
-                               'type_id'       =>$type_id
-                       );
-
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                               if(isset($values_attribute) && 
is_array($values_attribute))
                        {
-                               $this->bo->delete($location_code);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                                       foreach ($values_attribute as 
$attribute )
+                                       {
+                                               if($attribute['nullable'] != 1 
&& !$attribute['value'])
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
                        }
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+                                               if($attribute['datatype'] == 
'I' && isset($attribute['value']) && $attribute['value'] && 
!ctype_digit($attribute['value']))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter integer for attribute %1', 
$attribute['input_text']));
+                                               }
+                                       }
+                               }
 
-                       $data = array
-                       (
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'delete_action'         => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.delete', 'location_code'=> $location_code, 'type_id'=> 
$type_id)),
-                               'lang_confirm_msg'      => lang('do you really 
want to delete this entry'),
-                               'lang_yes'              => lang('yes'),
-                               'lang_yes_statustext'   => lang('Delete the 
entry'),
-                               'lang_no_statustext'    => lang('Back to the 
list'),
-                               'lang_no'               => lang('no')
-                       );
+                               if (isset($insert_record['extra']) && 
array_search('street_id',$insert_record['extra']) && 
(!isset($values['street_id']) || !$values['street_id']))
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a street'));
+                               }
+                               if (isset($insert_record['extra']) && 
array_search('part_of_town_id',$insert_record['extra']) && 
(!isset($values['part_of_town_id']) || !$values['part_of_town_id']))
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a part of town'));
+                               }
+                               if (isset($insert_record['extra']) && 
array_search('owner_id',$insert_record['extra']) && 
(!isset($values['owner_id']) || !$values['owner_id']))
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select an owner'));
+                               }
 
-                       $appname                        = lang('location');
-                       $function_msg                   = lang('delete 
location');
+                               $values['location_code']=implode("-", 
$values['location_code']);
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                               if($values['location_code'] && !$location_code)
+                               {
+                                       
if($this->bo->check_location($values['location_code'],$type_id))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('This location is already registered!') . 
'[ '.$values['location_code'].' ]');
+                                               $error_location_id=true;
+                                               $error_id=true;
+                                       }
                }
 
-               function view()
+                               if($location_code)
                {
-                       $get_history            = phpgw::get_var('get_history', 
'bool', 'POST');
-                       $lookup_tenant          = 
phpgw::get_var('lookup_tenant', 'bool');
-                       $location_code          = 
phpgw::get_var('location_code');
-                       $location                       = 
explode('-',$location_code);
+                                       $action='edit';
+                                       $values['change_type'] = $change_type;
 
-                       $type_id                        = $this->type_id;
 
-                       if($location_code)
+                                       if(!$values['change_type'])
                        {
-                               $type_id = count($location);
+                                               
$receipt['error'][]=array('msg'=>lang('Please select change type'));
+                                       }
+                               }
+                               elseif(!$location_code && !$error_id )
+                               {
+                                       $location_code=$values['location_code'];
                        }
 
-                       if ( $type_id && !$lookup_tenant )
+                               if(!isset($receipt['error']))
                        {
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= "::loc_$type_id";
+                                       $receipt = 
$this->bo->save($values,$values_attribute,$action,$type_id,isset($location_parent)?$location_parent:'');
                        }
                        else
                        {
-                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::tenant';
-                       }
-
-                       if(!$this->acl_read)
+                                       if(isset($location_parent) && 
$location_parent)
                        {
-                               $this->bocommon->no_access();
-                               return;
+                                               
$location_code_parent=implode("-", $location_parent);
+                                               $values = 
$this->bo->read_single($location_code_parent);
+                                               /* restore date from posting */
+                                               
if(isset($insert_record['extra']) && is_array($insert_record['extra']))
+                                               {
+                                                       for ($i=0; 
$i<count($insert_record['extra']); $i++)
+                                                       {
+                                                               
$values[$insert_record['extra'][$i]]= 
phpgw::get_var($insert_record['extra'][$i], 'string', 'POST');
+                                                       }
+                                               }
+                                       }
+                               }
                        }
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('location','attributes_view'));
+                       if(!isset($error_id) && $location_code)
+                       {
+                               $values = 
$this->bo->read_single($location_code,array('tenant_id'=>'lookup'));
 
-                       $values = 
$this->bo->read_single($location_code,array('tenant_id'=>'lookup', 'view' => 
true));
-
                        $check_history = 
$this->bo->check_history($location_code);
                        if($get_history)
                        {
@@ -1652,7 +1055,6 @@
                                                        {
                                                                
$content[$j]['row'][$k]['value']                = $entry[$uicols['name'][$i]];
                                                                
$content[$j]['row'][$k]['name']                 = $uicols['name'][$i];
-                                                               
$content[$j]['row'][$k]['lookup']               = $lookup;
                                                        }
 
                                                        
$content[$j]['hidden'][$k]['value']                     = 
$entry[$uicols['name'][$i]];
@@ -1674,48 +1076,103 @@
                                        }
                                }
                        }
+                       }
+                       /* Preserve attribute values from post */
+                       if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
+                       {
+                               $values = 
$this->bocommon->preserve_attribute_values($values,$values_attribute);
+                               unset($values['location_code']);
+                       }
+
+                       if(!$values)
+                       {
+                               $values['attributes']   = 
$this->bo->find_attribute(".location.{$this->type_id}");
+                               $values                                 = 
$this->bo->prepare_attribute($values, ".location.{$this->type_id}");
+                       }
+
+                       if ($values['cat_id'] > 0)
+                       {
+                               $this->cat_id = $values['cat_id'];
+                       }
+
+                       $link_data = array
+                       (
+                               'menuaction'    => $view ? 
'property.uilocation.view' : 'property.uilocation.edit',
+                               'location_code' => $location_code,
+                               'type_id'       => $type_id,
+                               'lookup_tenant' => $lookup_tenant
+                       );
 
-                       $lookup_type='view';
+                       $lookup_type = $view ? 'view' : 'form';
+
+                       if(!$location_code && $parent)
+                       {
+                               $_values = 
$this->bo->read_single($parent,array('noattrib' => true));
+                               $_values['attributes'] = $values['attributes'];
+                       }
+                       else
+                       {
+                               $_values = $values;
+                       }
 
                        $location_data=$this->bo->initiate_ui_location(array(
-                                               'values'                => 
$values,
+                                               'values'                => 
$_values,
                                                'type_id'               => 
($type_id-1),
+                                               'no_link'               => 
($type_id), // disable lookup links for location type less than type_id
+                                               'tenant'                => 
false,
                                                'lookup_type'           => 
$lookup_type
                                                ));
 
                        $location_types = $this->bo->location_types;
                        $config                 = $this->bo->config;
 
-                       $function_msg = lang('view');
+                       if ($location_code)
+                       {
+                               $function_msg = lang('edit');
+                       }
+                       else
+                       {
+                               $function_msg = lang('add');
+                       }
 
                        $function_msg .= ' ' 
.$location_types[($type_id-1)]['name'];
 
+                       $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+
+                       if(!is_array($insert_record))
+                       {
+                               $insert_record = array();
+                       }
+
                        $j=0;
                        $additional_fields[$j]['input_text']    = 
$location_types[($type_id-1)]['name'];
-                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id;
+                       $additional_fields[$j]['statustext']    = 
$location_types[($type_id-1)]['descr'];
                        $additional_fields[$j]['datatype']      = 'varchar';
-                       $additional_fields[$j]['value']         = 
$values[$additional_fields[$j]['input_name']];
+                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id;
+                       $additional_fields[$j]['name']                  = 'loc' 
. $type_id;
+                       $additional_fields[$j]['value']                 = 
isset($values[$additional_fields[$j]['input_name']])?$values[$additional_fields[$j]['input_name']]:'';
                        $additional_fields[$j]['class']         = 'th_text';
+                       $insert_record['extra'][]                               
= $additional_fields[$j]['input_name'];
 
                        $j++;
                        $additional_fields[$j]['input_text']    = lang('name');
-                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
+                       $additional_fields[$j]['statustext']    = lang('enter 
the name for this location');
                        $additional_fields[$j]['datatype']      = 'varchar';
-                       $additional_fields[$j]['value']         = 
$values[$additional_fields[$j]['input_name']];
+                       $additional_fields[$j]['input_name']    = 'loc' . 
$type_id . '_name';
+                       $additional_fields[$j]['name']                  = 'loc' 
. $type_id . '_name';
+                       $additional_fields[$j]['value']                 = 
isset($values[$additional_fields[$j]['input_name']])?$values[$additional_fields[$j]['input_name']]:'';
+                       $additional_fields[$j]['size']                  = 
$additional_fields[$j]['value'] ? strlen($additional_fields[$j]['value']) + 5 : 
30;
+                       $insert_record['extra'][]                               
= $additional_fields[$j]['input_name'];
                        $j++;
 
 
-                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'Y')] = 'Y';
-                       $dlarr[strpos($dateformat,'m')] = 'm';
-                       $dlarr[strpos($dateformat,'d')] = 'd';
-                       ksort($dlarr);
 
-                       $dateformat= (implode($sep,$dlarr));
+//_debug_array($attributes_values);
 
+                       $insert_record['extra'][]                               
                = 'cat_id';
 
-                       for ($j=0;$j<count($config);$j++)
+                       $config_count=count($config);
+                       for ($j=0;$j<$config_count;$j++)
                        {
                                if($config[$j]['location_type'] == $type_id)
                                {
@@ -1723,43 +1180,47 @@
                                        
if($config[$j]['column_name']=='street_id')
                                        {
                                                $edit_street=true;
-                                               $insert_record[]        = 
'street_id';
+                                               $insert_record['extra'][]       
= 'street_id';
+                                               $insert_record['extra'][]       
= 'street_number';
                                        }
 
                                        
if($config[$j]['column_name']=='tenant_id')
                                        {
                                                $edit_tenant=true;
-                                               $insert_record[]        = 
'tenant_id';
+                                               $insert_record['extra'][]       
= 'tenant_id';
                                        }
 
                                        
if($config[$j]['column_name']=='part_of_town_id')
                                        {
-                                               $edit_part_of_town=true;
+                                               $edit_part_of_town              
= true;
                                                $select_name_part_of_town       
= 'part_of_town_id';
                                                $part_of_town_list              
= $this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
                                                $lang_town_statustext           
= lang('Select the part of town the property belongs to. To do not use a part 
of town -  select NO PART OF TOWN');
-                                               $insert_record[]                
= 'part_of_town_id';
+                                               $insert_record['extra'][]       
= 'part_of_town_id';
                                        }
                                        
if($config[$j]['column_name']=='owner_id')
                                        {
-                                               $edit_owner=true;
+                                               $edit_owner                     
= true;
                                                $lang_owner                     
= lang('Owner');
                                                $owner_list                     
= $this->bo->get_owner_list('',$values['owner_id']);
                                                $lang_select_owner              
= lang('Select owner');
                                                $lang_owner_statustext          
= lang('Select the owner');
-                                               $insert_record[]                
= 'owner_id';
+                                               $insert_record['extra'][]       
= 'owner_id';
                                        }
                                }
                        }
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
+                       
$GLOBALS['phpgw']->session->appsession('insert_record','property',$insert_record);
+
+                       if(isset($receipt))
+                       {
+                               $msgbox_data = 
$this->bocommon->msgbox_data($receipt);
+                       }
 
-                       $dateformat= (implode($sep,$dlarr));
+
+                       if($location_code)
+                       {
+                               $change_type_list = 
$this->bo->select_change_type($values['change_type']);
 
                        $location_types = 
$this->soadmin_location->read(array('order'=>'id','sort'=>'ASC'));
                        foreach ($location_types as $location_type)
@@ -1771,137 +1232,276 @@
                                                $entities_link[] = array
                                                (
                                                        'entity_link'           
        => $GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                'menuaction'=> 'property.uilocation.view',
+                                                                               
                                        'menuaction'=> 
'property.uilocation.edit',
                                                                                
                                
'location_code'=>implode('-',array_slice($location, 0, $location_type['id']))
                                                                                
                                )
                                                                                
                        ),
                                                        
'lang_entity_statustext'        => $location_type['descr'],
-                                                       'text_entity'           
        => $location_type['name'],
+                                                               'text_entity'   
                => '<- '. $location_type['name'],
                                                );
                                        }
                                        else
                                        {
+                                                       $_location_code = 
implode('-',array_slice($location, 0, $location_type['id']));
+                                                       $marker = 
str_repeat('-', ($location_type['id'] - $type_id));
                                                $entities_link[] = array
                                                (
                                                        'entity_link'           
        => $GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                'menuaction'=> 'property.uilocation.index',
-                                                                               
                                'type_id'=> $location_type['id'],
-                                                                               
                                'query'=>implode('-',array_slice($location, 0, 
$location_type['id']))
+                                                                               
                                        'menuaction'    => 
'property.uilocation.index',
+                                                                               
                                        'type_id'               => 
$location_type['id'],
+                                                                               
                                        'query'                 => 
$_location_code,
+                                                                               
                                        'location_code' => $_location_code
                                                                                
                                )
                                                                                
                        ),
                                                        
'lang_entity_statustext'        => $location_type['descr'],
-                                                       'text_entity'           
        => $location_type['name'],
+                                                               'text_entity'   
                => "{$marker}> " . $location_type['name'],
                                                );
+                                                       unset($_location_code);
+                                               }
                                        }
                                }
                        }
 
-                       $entities= 
$this->bo->read_entity_to_link($location_code);
+                       phpgwapi_yui::tabview_setup('location_edit_tabview');
+                       $tabs = array();
+                       $tabs['general']        = array('label' => 
$location_types[($type_id-1)]['name'], 'link' => '#general');
 
-                       if (isset($entities) && is_array($entities))
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
-                               foreach($entities as $entity_entry)
+                               foreach ($values['attributes'] as & $attribute)
                                {
-                                       if($entity_entry['entity_link'])
+                                       if($attribute['history'] == true)
                                        {
-                                               $entities_link[] = array
+                                               $link_history_data = array // 
FIXME
                                                (
-                                                       'entity_link'           
        => $entity_entry['entity_link'],
-                                                       
'lang_entity_statustext'        => $entity_entry['descr'],
-                                                       'text_entity'           
        => $entity_entry['name'],
+                                                       'menuaction'    => 
'property.uilocation.attrib_history',
+                                                       'entity_id'     => 
$this->entity_id,
+                                                       'cat_id'        => 
$this->cat_id,
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'id'            => $id,
+                                                       'edit'          => true
                                                );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
                                        }
-                                       else
+                               }
+
+                               $location = ".location.{$type_id}";
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $values['attributes']);
+//_debug_array($attributes_groups);die();
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $tabs[str_replace(' ', '_', 
$group['name'])] = array('label' => $group['name'], 'link' => '#' . 
str_replace(' ', '_', $group['name']));
+                                               $group['link'] = str_replace(' 
', '_', $group['name']);
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($values['attributes']);
+                       }
+
+                       $documents = array();
+                       if($location_code)
+                       {
+                               $related = 
$this->bo->read_entity_to_link($location_code);
+                               $related_link = array();
+
+                               $document = CreateObject('property.sodocument');
+                               $documents = 
$document->get_files_at_location($location_code);
+
+                               if($documents)
+                               {
+                                       $tabs['document']       = array('label' 
=> lang('document'), 'link' => '#document');
+                                       $documents = json_encode($documents);   
                        
+                               }
+                               if(isset($related['related']))
+                               {
+                                               $tabs['related']        = 
array('label' => lang('related'), 'link' => '#related');
+                               }
+
+                               foreach($related as $related_key => 
$related_data)
+                               {
+                                       if( $related_key == 'gab')
+                                       {
+                                               foreach($related_data as $entry)
                                        {
                                                $entities_link[] = array
                                                (
-                                                       'entity_link'           
        => $GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                'menuaction'=> 
'property.uientity.index',
-                                                                               
                                                'entity_id'=> 
$entity_entry['entity_id'],
-                                                                               
                                                'cat_id'=> 
$entity_entry['cat_id'],
-                                                                               
                                                'query'=>$location_code
-                                                                               
                                                )
-                                                                               
                                        ),
-                                                       
'lang_entity_statustext'        => $entity_entry['descr'],
-                                                       'text_entity'           
        => $entity_entry['name'],
+                                                               'entity_link'   
                        => $entry['entity_link'],
+                                                               
'lang_entity_statustext'        => $entry['descr'],
+                                                               'text_entity'   
                        => $entry['name'],
                                                );
                                        }
                                }
-                       }
 
-                       $change_type_list = 
$this->bo->select_change_type($values['change_type']);
+                                       if( $related_key == 'related')
+                                       {
+                                               foreach($related_data as $entry)
+                                               {
+                                                       $related_link[] = array
+                                                       (
+                                                               'entity_link'   
                        => $entry['entity_link'],
+                                                               
'lang_entity_statustext'        => $entry['descr'],
+                                                               'text_entity'   
                        => $entry['name'],
+                                                       );
+                                               }
+                                       }
+                               }
+                       }
 
                        $data = array
                        (
+                               'edit'                                          
        => $view ? '' : true,
                                'lang_change_type'                      => 
lang('Change type'),
-                               'check_history'                         => 
$check_history,
+                               'lang_no_change_type'                   => 
lang('No Change type'),
+                               'lang_change_type_statustext'   => lang('Type 
of changes'),
+                               'change_type_list'                              
=> (isset($change_type_list)?$change_type_list:''),
+                               'check_history'                                 
=> (isset($check_history)?$check_history:''),
                                'lang_history'                          => 
lang('History'),
                                'lang_history_statustext'               => 
lang('Fetch the history for this item'),
                                'table_header'                          => 
(isset($table_header)?$table_header:''),
-                               'change_type_list'                      => 
$change_type_list,
                                'values'                                => 
(isset($content)?$content:''),
 
                                'lang_related_info'                     => 
lang('related info'),
                                'entities_link'                         => 
(isset($entities_link)?$entities_link:''),
-                               'edit_street'                           => 
$edit_street,
-                               'edit_tenant'                           => 
$edit_tenant,
-                               'edit_part_of_town'                     => 
$edit_part_of_town,
-                               'edit_owner'                            => 
$edit_owner,
-                               'select_name_part_of_town'              => 
$select_name_part_of_town,
-                               'part_of_town_list'                     => 
$part_of_town_list,
-                               'lang_town_statustext'                  => 
$lang_town_statustext,
+                               'related_link'                                  
=> $related_link,
+                               'edit_street'                                   
=> (isset($edit_street)?$edit_street:''),
+                               'edit_tenant'                                   
=> (isset($edit_tenant)?$edit_tenant:''),
+                               'edit_part_of_town'                             
=> (isset($edit_part_of_town)?$edit_part_of_town:''),
+                               'edit_owner'                                    
=> (isset($edit_owner)?$edit_owner:''),
+                               'select_name_part_of_town'              => 
(isset($select_name_part_of_town)?$select_name_part_of_town:''),
+                               'part_of_town_list'                             
=> (isset($part_of_town_list)?$part_of_town_list:''),
+                               'lang_town_statustext'                  => 
(isset($lang_town_statustext)?$lang_town_statustext:''),
                                'lang_part_of_town'                     => 
lang('Part of town'),
                                'lang_no_part_of_town'                  => 
lang('No part of town'),
-                               'lang_owner'                            => 
$lang_owner,
-                               'owner_list'                            => 
$owner_list,
-                               'lang_select_owner'                     => 
$lang_select_owner,
-                               'lang_owner_statustext'                 => 
$lang_owner_statustext,
+                               'lang_owner'                                    
=> (isset($lang_owner)?$lang_owner:''),
+                               'owner_list'                                    
=> (isset($owner_list)?$owner_list:''),
+                               'lang_select_owner'                             
=> (isset($lang_select_owner)?$lang_select_owner:''),
+                               'lang_owner_statustext'                 => 
(isset($lang_owner_statustext)?$lang_owner_statustext:''),
                                'additional_fields'                     => 
$additional_fields,
-                               'lang_street'                           => 
lang('Street'),
-                               'lang_select_street_help'               => 
lang('Select the street name'),
-                               'lang_street_num_statustext'    => lang('Enter 
the street number'),
-                               'value_street_id'                       => 
$values['street_id'],
-                               'value_street_name'                     => 
$values['street_name'],
-                               'value_street_number'                   => 
$values['street_number'],
+                               'attributes_group'                              
=> $attributes,
+//                             'attributes_values'                             
=> $values['attributes'],
+                               'lookup_functions'                              
=> isset($values['lookup_functions'])?$values['lookup_functions']:'',
+                               'lang_none'                                     
        => lang('None'),
 
-                               'attributes_view'                               
=> $values['attributes'],
+                               'msgbox_data'                                   
=> (isset($msgbox_data)?$GLOBALS['phpgw']->common->msgbox($msgbox_data):''),
 
-                               'dateformat'                            => 
$dateformat,
-                               'lang_dateformat'                       => 
strtolower($dateformat),
-                               'lang_none'                             => 
lang('None'),
+                               'street_link'                                   
=> "menuaction:'" . 'property'.".uilookup.street'",
+                               'lang_street'                                   
=> lang('Address'),
+                               'lang_select_street_help'               => 
lang('Select the street name'),
+                               'lang_street_num_statustext'    => lang('Enter 
the street number'),
+                               'value_street_id'                               
=> (isset($values['street_id'])?$values['street_id']:''),
+                               'value_street_name'                             
=> (isset($values['street_name'])?$values['street_name']:''),
+                               'value_street_number'                   => 
(isset($values['street_number'])?$values['street_number']:''),
 
+                               'tenant_link'                                   
=> "menuaction:'" . 'property'.".uilookup.tenant'",
                                'lang_tenant'                           => 
lang('tenant'),
-                               'value_tenant_id'                       => 
$values['tenant_id'],
-                               'value_last_name'                       => 
$values['last_name'],
-                               'value_first_name'                      => 
$values['first_name'],
+                               'value_tenant_id'                               
=> (isset($values['tenant_id'])?$values['tenant_id']:''),
+                               'value_last_name'                               
=> (isset($values['last_name'])?$values['last_name']:''),
+                               'value_first_name'                              
=> (isset($values['first_name'])?$values['first_name']:''),
                                'lang_tenant_statustext'                => 
lang('Select a tenant'),
-                               'size_last_name'                        => 
strlen($values['last_name']),
-                               'size_first_name'                       => 
strlen($values['first_name']),
+                               'size_last_name'                                
=> (isset($values['last_name'])?strlen($values['last_name']):''),
+                               'size_first_name'                               
=> (isset($values['first_name'])?strlen($values['first_name']):''),
                                'lookup_type'                           => 
$lookup_type,
                                'location_data'                         => 
$location_data,
-                               'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uilocation.index',
 'type_id'=> $type_id,'lookup_tenant'=> $lookup_tenant)),
+                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'done_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.index','type_id'=> $type_id, 'lookup_tenant'=> 
$lookup_tenant)),
                                'lang_save'                             => 
lang('save'),
                                'lang_done'                             => 
lang('done'),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the location'),
-                               'lang_edit'                             => 
lang('Edit'),
-                               'edit_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uilocation.edit',
 'location_code'=> $location_code, 'lookup_tenant'=> $lookup_tenant)),
-                               'lang_edit_statustext'                  => 
lang('Edit this entry'),
                                'lang_category'                         => 
lang('category'),
                                'lang_no_cat'                           => 
lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the location belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                           => 
'cat_id',
                                'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'select','selected' => 
$values['cat_id'],'type' =>'location','type_id' =>$type_id,'order'=>'descr')),
                                'textareacols'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, 'general'),
+                               'documents'                                     
        => $documents,
+                               'lang_expand_all'                               
=> lang('expand all'),
+                               'lang_collapse_all'                             
=> lang('collapse all')
+                       );
+
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/examples/treeview/assets/css/folders/tree.css');
+                       phpgwapi_yui::load_widget('treeview');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'location.edit', 'property' );
+                       $appname        = lang('location');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+               }
+
+
+               function delete()
+               {
+
+                       $location_code          = 
phpgw::get_var('location_code', 'string', 'GET');
+                       $type_id                = $this->type_id;
+
+                       //cramirez add JsonCod for Delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                       $this->bo->delete($location_code);
+                       return "location_code ".$location_code." ".lang("has 
been deleted");
+                       }
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
"::loc_$type_id";
+
+                       if(!$this->acl_delete)
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+
+                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+
+                       $link_data = array
+                       (
+                               'menuaction' => 'property.uilocation.index',
+                               'type_id'       =>$type_id
+                       );
+
+                       if (phpgw::get_var('confirm', 'bool', 'GET'))
+                       {
+                               $this->bo->delete($location_code);
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+                       $data = array
+                       (
+                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'delete_action'         => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.delete', 'location_code'=> $location_code, 'type_id'=> 
$type_id)),
+                               'lang_confirm_msg'      => lang('do you really 
want to delete this entry'),
+                               'lang_yes'              => lang('yes'),
+                               'lang_yes_statustext'   => lang('Delete the 
entry'),
+                               'lang_no_statustext'    => lang('Back to the 
list'),
+                               'lang_no'               => lang('no')
                        );
 
                        $appname                                        = 
lang('location');
+                       $function_msg                   = lang('delete 
location');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+               }
 
 
+               function view()
+               {
+                       if(!$this->acl_read)
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+                       $this->edit($view = true);
                }
 
                /**
@@ -1963,6 +1563,59 @@
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
+               /**
+               * Perform an update on all location_codes on all levels to make 
sure they are consistent and unique
+               *
+               * @return void
+               */
+
+               function update_location()
+               {
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'admin::property::location::update_location';
+
+                       if(!$this->acl->check('.admin.location', 
PHPGW_ACL_EDIT, 'property'))
+                       {
+                               $this->bocommon->no_access();
+                               return;
+                       }
+
+                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+
+                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       {
+                               $receipt= $this->bo->update_location();
+                               $lang_confirm_msg = lang('Do you really want to 
update the locations again');
+                               $lang_yes                       = lang('again');
+                       }
+                       else
+                       {
+                               $lang_confirm_msg       = lang('Do you really 
want to update the locations');
+                               $lang_yes                       = lang('yes');
+                       }
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                           => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'update_action'                         => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uilocation.update_location')),
+                               'message'                                       
=> $receipt['message'],
+                               'lang_confirm_msg'                      => 
$lang_confirm_msg,
+                               'lang_yes'                                      
=> $lang_yes,
+                               'lang_yes_statustext'           => 
lang('perform an update on all location_codes on all levels to make sure they 
are consistent and unique'),
+                               'lang_no_statustext'            => lang('Back 
to Admin'),
+                               'lang_no'                                       
=> lang('no')
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = lang('Update the locations');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('update_cat' => $data));
+               }
+
                function stop()
                {
                        $perm                   = phpgw::get_var('perm', 'int');
@@ -2004,121 +1657,268 @@
                                return;
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'            => 
'property.uilocation.summary',
+                                       'district_id'           
=>$this->district_id,
+                                       'part_of_town_id'       
=>$this->part_of_town_id,
+                                       'filter'                        
=>$this->filter,
+                                       'summary'                       =>true
+                               ));
 
-                       
//$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilocation.summary',"
+                                                                               
                ."district_id:'{$this->district_id}',"
+                                                                               
                ."part_of_town_id:'{$this->part_of_town_id}',"
+                                                                               
."filter: '{$this->filter}',"
+                                                                               
."summary: true";
 
-       /***********************************/
-               /// Enable for use Yahoo YUI
-               
//$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                               $datatable['config']['allow_allrows'] = true;
 
-               
//$GLOBALS['phpgw']->css->add_external_file('equipo/templates/idots/css/table.css');
+                               $link_data = array
+                               (
+                                       'menuaction'            => 
'property.uilocation.summary',
+                                       'district_id'           
=>$this->district_id,
+                                       'part_of_town_id'       
=>$this->part_of_town_id,
+                                       'filter'                        
=>$this->filter,
+                                       'summary'                       =>true
+                               );
 
-       /*      phpgwapi_yui::load_widget('dragdrop');
-               phpgwapi_yui::load_widget('datatable');
-               phpgwapi_yui::load_widget('menu');
-               phpgwapi_yui::load_widget('connection');*/
+                               $link_download = array
+                               (
+                                       'menuaction'            => 
'property.uilocation.download',
+                                       'district_id'           
=>$this->district_id,
+                                       'part_of_town_id'       
=>$this->part_of_town_id,
+                                       'filter'                        
=>$this->filter,
+                                       'summary'                       =>true
+                               );
 
-       //phpgwapi_yui::load_widget('tabview');
+                               $values_combo_box[0] = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               $default_value = array ('id'=>'','name'=> 
lang('no district'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no part of town'));
+                               array_unshift 
($values_combo_box[1],$default_value);
 
-               // Uncomment the following line to enable experimental YUI 
Datagrid version
-         //    $GLOBALS['phpgw']->js->validate_file( 'newdesign', 'gabnr', 
'property' );
+                               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
+                               {
+                                       $owner_list = 
$this->bo->get_owner_list('filter', $this->filter);
+                               }
+                               else
+                               {
+                                       $owner_list = 
$this->bo->get_owner_type_list('filter', $this->filter);
+                               }
 
-       /***********************************/
+                               $values_combo_box[2]  = $owner_list;
+                               $default_value = array 
('id'=>'','name'=>lang('show all'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uilocation.summary',
+                                                               'district_id'   
        =>$this->district_id,
+                                                               
'part_of_town_id'       =>$this->part_of_town_id,
+                                                               'filter'        
                =>$this->filter,
+                                                               'summary'       
                =>true
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
//boton  CATEGORY
+                                                                               
                                        'id' => 'btn_district_id',
+                                                                               
                                        'name' => 'district_id',
+                                                                               
                                        'value' => lang('district'),
+                                                                               
                                        'type' => 'button',
+                                                                               
                                        'style' => 'filter',
+                                                                               
                                        'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//boton  STATUS
+                                                                               
                                        'id' => 'btn_part_of_town_id',
+                                                                               
                                        'name' => 'part_of_town_id',
+                                                                               
                                        'value' => lang('part of town'),
+                                                                               
                                        'type' => 'button',
+                                                                               
                                        'style' => 'filter',
+                                                                               
                                        'tab_index' => 2
+                                                                       ),
+                                                                       array( 
//boton  HOUR CATEGORY
+                                                                               
                                        'id' => 'btn_owner_id',
+                                                                               
                                        'name' => 'owner_id',
+                                                                               
                                        'value' => lang('owner'),
+                                                                               
                                        'type' => 'button',
+                                                                               
                                        'style' => 'filter',
+                                                                               
                                        'tab_index' => 3
+                                                                       ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_export',
+                                                                               
        'value' => lang('download'),
+                                                                               
        'tab_index' => 4
+                                                                               
    )
+                                                                               
),
+                                                       'hidden_value' => array(
+                                                                               
        array( //div values  combo_box_0
+                                                                               
                                                                        'id' => 
'values_combo_box_0',
+                                                                               
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[0])
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_1
+                                                                               
                                                                        'id' => 
'values_combo_box_1',
+                                                                               
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[1])
+                                                                               
                      ),
+                                                                               
                                                 array( //div values  
combo_box_2
+                                                                               
                                                                        'id' => 
'values_combo_box_2',
+                                                                               
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[2])
+                                                                               
                      )
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
 
+                               $dry_run = true;
+                       }
 
                        $summary_list= $this->bo->read_summary();
+
                        $uicols = $this->bo->uicols;
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
-                       $j=0;
-                       if (isSet($summary_list) && is_array($summary_list))
+                       if (isset($summary_list) AND is_array($summary_list))
                        {
-                               foreach($summary_list as $summary)
+                               foreach($summary_list as $summary_entry)
                                {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       for ($k=0;$k<$count_uicols_name;$k++)
                                        {
-                                               
$content[$j]['row'][$i]['value']                        = 
isset($summary[$uicols['name'][$i]])?$summary[$uicols['name'][$i]]:'';
-                                               $content[$j]['row'][$i]['name'] 
                        = isset($summary['name'][$i])?$summary['name'][$i]:'';
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$summary_entry[$uicols['name'][$k]];
+                                               }
                                        }
-
                                        $j++;
                                }
                        }
 
-                       $uicols_count   = count($uicols['descr']);
-                       for ($i=0;$i<$uicols_count;$i++)
+                       $datatable['rowactions']['action'] = array();
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               if(!isset($uicols['input_type'][$i]) || 
$uicols['input_type'][$i]!='hidden')
+                               if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '15%';
-                                       $table_header[$i]['align']              
= 'left';
-
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
                                }
                        }
 
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($summary_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
+                       $appname                = lang('Summary');
+                       $function_msg           = lang('List') . ' ' . 
lang($this->role);
 
-                       $link_download = array
-                       (
-                               'menuaction'    => 
'property.uilocation.download',
-                                               'district_id'           
=>$this->district_id,
-                                               'part_of_town_id'       
=>$this->part_of_town_id,
-                                               'filter'                
=>$this->filter,
-                                       //      'type_id'               
=>$type_id,
-                                               'summary'               =>true
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+                       
+                       // 'part of town' depended on the selected 'district'
+                               $opt_cb_depend =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                               $default_value = array ('id'=>'','name'=>'!no 
part of town');
+                               array_unshift ($opt_cb_depend,$default_value);
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uilocation.summary',
-                                               'district_id'           
=>$this->district_id,
-                                               'part_of_town_id'       
=>$this->part_of_town_id,
-                                               'filter'                
=>$this->filter,
-                                       //      'type_id'               
=>$type_id
+                               $json['hidden']['dependent'][] = array ( 'id' 
=> $this->part_of_town_id,
+                                                             'value' => 
$this->bocommon->select2String($opt_cb_depend)
                        );
 
 
 
-                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['property_filter'] == 
'owner')
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
                        {
-                               $owner_list = 
$this->bo->get_owner_list('filter', $this->filter);
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
                        }
-                       else
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
                        {
-                               $owner_list = 
$this->bo->get_owner_type_list('filter', $this->filter);
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
                        }
 
-                       $data = array
-                       (
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'owner_name'                            => 
'filter',
-                               'owner_list'                            => 
$owner_list,
-                               'lang_show_all'                         => 
lang('Show all'),
-                               'lang_owner_statustext'                 => 
lang('Select the owner type. To show all entries select SHOW ALL'),
-                               'select_name_part_of_town'              => 
'part_of_town_id',
-                               'part_of_town_list'                     => 
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id),
-                               'lang_town_statustext'                  => 
lang('Select the part of town the property belongs to. To do not use a part of 
town -  select NO PART OF TOWN'),
-                               'lang_no_part_of_town'                  => 
lang('No Part of town'),
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'location.summary', 'property' );
 
-                               'district_list'                         => 
$this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'                      => 
lang('no district'),
-                               'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                  => 
'district_id',
-                               'lang_download'                         => 
'download',
-                               'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                    => 
lang('Download table to your browser'),
-                               'table_header_summary'                  => 
$table_header,
-                               'values'                                => 
$content
-                       );
 
-//_debug_array($data);
-
-                       $appname                = lang('Summary');
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' : ' . $appname;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('summary' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
        }
-

Modified: people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -31,6 +31,7 @@
         * Description
         * @package property
         */
+       phpgw::import_class('phpgwapi.yui');
 
        class property_uilookup
        {
@@ -56,16 +57,17 @@
                        'ns3420'                => true,
                        'street'                => true,
                        'tenant'                => true,
-                       'phpgw_user'    => true
+                       'phpgw_user'    => true,
+                       'project_group' => true,
+                       'ecodimb'               => true
                );
 
-               function property_uilookup()
+               function __construct()
                {
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
                        $GLOBALS['phpgw_info']['flags']['headonly']=true;
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
+
                        $this->bo                                       = 
CreateObject('property.bolookup',true);
 
                        $this->start                            = 
$this->bo->start;
@@ -76,7 +78,28 @@
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->part_of_town_id          = 
$this->bo->part_of_town_id;
                        $this->district_id                      = 
$this->bo->district_id;
-                       
$GLOBALS['phpgw']->js->set_onload('document.search.query.focus();');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
                }
 
                function save_sessiondata()
@@ -97,20 +120,14 @@
 
                function addressbook()
                {
-
+                       $bocommon       = CreateObject('property.bocommon');
                        $this->cats             = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name = 'addressbook';
                        $this->cats->supress_info       = true;
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field',
-                                                                               
'cat_filter'));
-
                        $second_display = phpgw::get_var('second_display', 
'bool');
                        $column = phpgw::get_var('column');
 
-
                        $default_category = 
$GLOBALS['phpgw_info']['user']['preferences']['addressbook']['default_category'];
 
                        if ($default_category && !$second_display)
@@ -119,62 +136,127 @@
                                $this->cat_id           = $default_category;
                        }
 
-                       $addressbook_list = $this->bo->read_addressbook();
-
-                       while (is_array($addressbook_list) && 
list(,$addressbook_entry) = each($addressbook_list))
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
-                               $content[] = array
-                               (
-                                       'id'                            => 
$addressbook_entry['contact_id'],
-                                       'contact_name'          => 
$addressbook_entry['per_last_name'] . ', ' . 
$addressbook_entry['per_first_name'],
-                                       'lang_select'           => 
lang('Select'),
-                                       'lang_select_statustext' => 
lang('Select this contact')
-                               );
-                       }
 
-                       $table_header[] = array
-                       (
-                               'sort_name'     => 
$this->nextmatchs->show_sort_order(array
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'last_name',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.addressbook',
+                                               'menuaction'                    
=> 'property.uilookup.addressbook',
+                                                       'second_display'        
=> true,
                                                                                
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'lang_name'             => lang('Name'),
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'person_id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.addressbook',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'lang_id'               => lang('ID'),
-                               'lang_select'           => lang('Select')
-                       );
+                                                       'query'                 
        => $this->query,
+                                                       'filter'                
        => $this->filter,
+                                                       'column'                
        => $column
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                                       ));
 
-                       $link_select = array
-                       (
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.addressbook',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."column:'{$column}'";
+                                                                               
+                               $values_combo_box[0]    = 
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' => 
true));;
+                               $default_value = array 
('cat_id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
                                'menuaction'            => 
'property.uilookup.addressbook',
                                'second_display'        => true,
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
                                'cat_id'                        => 
$this->cat_id,
                                'query'                         => $this->query,
                                'filter'                        => 
$this->filter,
                                'column'                        => $column
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
CATEGORY
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 2
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id') //i.e.  
id,value/id,vale/
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+
+                       $uicols = array (
+                               'input_type'    =>      array(text,text),
+                               'name'                  =>      
array(contact_id,contact_name),
+                               'sort_field'    =>      
array(person_id,last_name),
+                               'formatter'             =>      array('',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Name'))
                        );
 
+                       $addressbook_list = array();
+                       $addressbook_list = $this->bo->read_addressbook();
+
+                       $content = array();
+                       $j=0;
+                       if (isset($addressbook_list) && 
is_array($addressbook_list))
+                       {
+                               foreach($addressbook_list as $addressbook_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       if ($uicols['name'][$i] 
== 'contact_name'){
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$addressbook_entry['per_last_name'] . ', ' . 
$addressbook_entry['per_first_name'];
+                                                       }
+                                                       else {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$addressbook_entry[$uicols['name'][$i]];
+                                                       }
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = true;
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols['sort_field'][$i];
+                       }
+
                        if($column)
                        {
                                $contact_id     =$column;
@@ -186,58 +268,117 @@
                                $contact_name   ='contact_name';
                        }
 
-                       $cat_data       = 
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' => 
true, 'link_data' =>$link_select));
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($addressbook_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
        => $cat_data['cat_list'],
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_contact'                  => 
$table_header,
-                               'values_contact'                                
=> $content,
-                               'table_done'                                    
=> $table_done,
-                               'contact_id'                                    
=> $contact_id,
-                               'contact_name'                                  
=> $contact_name
-                       );
+                       $function_exchange_values = '';
 
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$contact_id.'")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$contact_name.'")[0].value = "";' ."\r\n";
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$contact_id.'")[0].value = 
data.getData("contact_id");' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$contact_name.'")[0].value = 
data.getData("contact_name");' ."\r\n";
+                       
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($addressbook_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'contact_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
                        $appname                                                
= lang('addressbook');
                        $function_msg                                   = 
lang('list vendors');
 
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_contact' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.vendor.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
                function vendor()
                {
+                       $bocommon       = CreateObject('property.bocommon');
 
                        $this->cats             = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name = 'fm_vendor';
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field',
-                                                                               
'cat_filter'));
-
                        $second_display = phpgw::get_var('second_display', 
'bool');
                        $column = phpgw::get_var('column');
 
-
                        $default_category = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_vendor_category'];
 
                        if ($default_category && !$second_display)
@@ -246,62 +387,121 @@
                                $this->cat_id           = $default_category;
                        }
 
-                       $vendor_list = $this->bo->read_vendor();
-
-                       while (is_array($vendor_list) && list(,$vendor_entry) = 
each($vendor_list))
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
-                               $content[] = array
-                               (
-                                       'id'                            => 
$vendor_entry['id'],
-                                       'vendor_name'           => 
$vendor_entry['org_name'],
-                                       'lang_select'           => 
lang('Select'),
-                                       'lang_select_statustext' => 
lang('Select this vendor')
-                               );
-                       }
 
-                       $table_header[] = array
-                       (
-                               'sort_name'     => 
$this->nextmatchs->show_sort_order(array
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'org_name',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.vendor',
+                                               'menuaction'                    
=> 'property.uilookup.vendor',
+                                                       'second_display'        
=> true,
                                                                                
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'lang_name'             => lang('Name'),
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.vendor',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'lang_id'               => lang('ID'),
-                               'lang_select'           => lang('Select')
-                       );
+                                                       'query'                 
        => $this->query,
+                                                       'filter'                
        => $this->filter,
+                                                       'column'                
        => $column
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                                       ));
 
-                       $link_select = array
-                       (
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.vendor',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."column:'{$column}'";
+
+                               $values_combo_box[0]    = 
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' => 
true));
+                               $default_value = array 
('cat_id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
                                'menuaction'            => 
'property.uilookup.vendor',
                                'second_display'        => true,
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
                                'cat_id'                        => 
$this->cat_id,
                                'query'                         => $this->query,
                                'filter'                        => 
$this->filter,
                                'column'                        => $column
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
CATEGORY
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 2
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id') //i.e.  
id,value/id,vale/
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+
+                       $uicols = array (
+                               'input_type'    =>      array(text,text),
+                               'name'                  =>      
array(id,org_name),
+                               'formatter'             =>      array('',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Name'))
                        );
 
+                       $vendor_list = array();
+                       $vendor_list = $this->bo->read_vendor();
+
+                       $content = array();
+                       $j=0;
+                       if (isset($vendor_list) && is_array($vendor_list))
+                       {
+                               foreach($vendor_list as $vendor)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$vendor[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = true;
+                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                       }
+
                        if($column)
                        {
                                $contact_id     =$column;
@@ -313,417 +513,916 @@
                                $org_name       ='vendor_name';
                        }
 
-                       $cat_data       = 
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' => 
true, 'link_data' =>$link_select));
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($vendor_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
        => $cat_data['cat_list'],
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_vendor'                   => 
$table_header,
-                               'values_vendor'                                 
=> $content,
-                               'table_done'                                    
=> $table_done,
-                               'contact_id'                                    
=> $contact_id,
-                               'org_name'                                      
        => $org_name
-                       );
+                       $function_exchange_values = '';
 
-                       $appname                                                
= lang('vendor');
-                       $function_msg                                   = 
lang('list vendors');
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$contact_id.'")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$org_name.'")[0].value = "";' ."\r\n";
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_vendor' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
-               }
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$contact_id.'")[0].value = 
data.getData("id");' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$org_name.'")[0].value = 
data.getData("org_name");' ."\r\n";
 
-               function b_account()
-               {
+                       $function_exchange_values .= 'window.close()';
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
 
-                       $b_account_list = $this->bo->read_b_account();
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       while (is_array($b_account_list) && 
list(,$b_account_entry) = each($b_account_list))
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($vendor_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $content[] = array
-                               (
-                                       'id'                            => 
$b_account_entry['id'],
-                                       'b_account_name'                => 
$b_account_entry['descr'],
-                                       'lang_select'           => 
lang('Select'),
-                                       'lang_select_statustext' => 
lang('Select this budget account')
-                               );
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
                        }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
 
-                       $table_header[] = array
+                       $appname                                                
= lang('vendor');
+                       $function_msg                                   = 
lang('list vendors');
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'sort_name'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'descr',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.b_account',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'lang_name'             => lang('Name'),
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.b_account',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'lang_id'               => lang('ID'),
-                               'lang_select'           => lang('Select')
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $table_done[] = array
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.vendor.index', 'property' );
+
+                       $this->save_sessiondata();
+                       }
+
+               function b_account()
+               {
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
                        (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                                               'menuaction'                    
=> 'property.uilookup.b_account',
+                                                               
'second_display'        => true,
+                                                               'cat_id'        
                => $this->cat_id,
+                                                               'query'         
                => $this->query,
+                                                               'filter'        
                => $this->filter
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
 
-                       $link_select = array
-                       (
-                               'menuaction'            => 
'property.uilookup.b_account',
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.b_account',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.b_account',
                                'second_display'        => true,
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
                                'cat_id'                        => 
$this->cat_id,
                                'query'                         => $this->query,
                                'filter'                        => $this->filter
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
                        );
+                       }
 
-
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($b_account_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_b_account'                => 
$table_header,
-                               'values_b_account'                      => 
$content,
-                               'table_done'                                    
=> $table_done
+                       $uicols = array (
+                               'input_type'    =>      array(text,text),
+                               'name'                  =>      array(id,descr),
+                               'formatter'             =>      array('',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Name'))
                        );
 
+                       $b_account_list = array();
+                       $b_account_list = $this->bo->read_b_account();
+
+                       $content = array();
+                       $j=0;
+                       if (isset($b_account_list) && is_array($b_account_list))
+                       {
+                               foreach($b_account_list as $b_account_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$b_account_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+               }
+
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+               {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = true;
+                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                       }
+
+                       $function_exchange_values = '';
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("b_account_id")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("b_account_name")[0].value = "";' ."\r\n";
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("b_account_id")[0].value = 
data.getData("id");' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("b_account_name")[0].value = 
data.getData("descr");' ."\r\n";
+
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($b_account_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
                        $appname                                                
= lang('budget account');
                        $function_msg                                   = 
lang('list budget account');
 
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_b_account' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.tenant.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
 
                function street()
                {
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                                                               
(
+                                               'menuaction'                    
=> 'property.uilookup.street',
+                                                               
'second_display'        => true,
+                                                               'cat_id'        
                => $this->cat_id,
+                                                               'query'         
                => $this->query,
+                                                               'filter'        
                => $this->filter
+                                       ));
 
-                       $street_list = $this->bo->read_street();
+                       $datatable['config']['allow_allrows'] = true;
 
-                       while (is_array($street_list) && list(,$street_entry) = 
each($street_list))
-                       {
-                               $content[] = array
-                               (
-                                       'id'                            => 
$street_entry['id'],
-                                       'street_name'           => 
$street_entry['street_name'],
-                                       'lang_select'           => 
lang('Select'),
-                                       'lang_select_statustext' => 
lang('Select this street')
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.street',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.street',
+                                                                       
'second_display'        => true,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'filter'                        => $this->filter
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
                                );
                        }
 
-                       $table_header[] = array
-                       (
-                               'sort_name'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'descr',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.street',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'lang_name'             => lang('Street name'),
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.street',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'lang_id'               => lang('ID'),
-                               'lang_select'           => lang('Select')
+                       $uicols = array (
+                               'input_type'    =>      array(text,text),
+                               'name'                  =>      
array(id,street_name),
+                               'sort_field'    =>      array(id,descr),
+                               'formatter'             =>      array('',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Street name'))
                        );
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                       $street_list = array();
+                       $street_list = $this->bo->read_street();
 
-                       $link_select = array
-                       (
-                               'menuaction'            => 
'property.uilookup.street',
-                               'second_display'        => true,
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
-                               'cat_id'                        => 
$this->cat_id,
-                               'query'                         => $this->query,
-                               'filter'                        => $this->filter
-                       );
+                       $content = array();
+                       $j=0;
+                       if (isset($street_list) && is_array($street_list))
+                       {
+                               foreach($street_list as $street_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$street_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+                       }
 
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
 
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($street_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_street'           => 
$table_header,
-                               'values_street'                 => $content,
-                               'table_done'                                    
=> $table_done
-                       );
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']         = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols['sort_field'][$i];
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
 
+                       $function_exchange_values = '';
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("street_id")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("street_name")[0].value = "";' ."\r\n";
+                       
+                       $function_exchange_values .= 
'opener.document.getElementsByName("street_id")[0].value = data.getData("id");' 
."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("street_name")[0].value = 
data.getData("street_name");' ."\r\n";
+
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($street_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
                        $appname                                                
= lang('street');
                        $function_msg                                   = 
lang('list street');
 
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                                                                               
(
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_street' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.tenant.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
                function tenant()
                {
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                                                               
(
+                                               'menuaction'                    
=> 'property.uilookup.tenant',
+                                                               
'second_display'        => true,
+                                                               'cat_id'        
                => $this->cat_id,
+                                                               'query'         
                => $this->query,
+                                                               'filter'        
                => $this->filter
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
 
-                       $tenant_list = $this->bo->read_tenant();
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.tenant',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}'";
 
-                       while (is_array($tenant_list) && list(,$tenant_entry) = 
each($tenant_list))
-                       {
-                               $content[] = array
-                               (
-                                       'id'                            => 
$tenant_entry['id'],
-                                       'last_name'                     => 
$tenant_entry['last_name'],
-                                       'first_name'            => 
$tenant_entry['first_name'],
-                                       'lang_select'           => 
lang('Select'),
-                                       'lang_select_statustext' => 
lang('Select this tenant')
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.tenant',
+                                                                       
'second_display'        => true,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'filter'                        => $this->filter
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
                                );
                        }
 
-                       $table_header[] = array
-                       (
-                               'sort_last_name'        => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'last_name',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.tenant',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'sort_first_name'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'first_name',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.tenant',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'lang_last_name'                => lang('last 
name'),
-                               'lang_first_name'               => lang('first 
name'),
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.tenant',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
)),
-                               'lang_id'               => lang('ID'),
-                               'lang_select'           => lang('Select')
+                       $uicols = array (
+                               'input_type'    =>      array(text,text,text),
+                               'name'                  =>      
array(id,last_name,first_name),
+                               'formatter'             =>      array('','',''),
+                               'descr'                 =>      
array(lang('ID'),lang('last name'),lang('first name'))
                        );
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                       $tenant_list = array();
+                       $tenant_list = $this->bo->read_tenant();
 
-                       $link_select = array
-                       (
-                               'menuaction'            => 
'property.uilookup.tenant',
-                               'second_display'        => true,
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
-                               'cat_id'                        => 
$this->cat_id,
-                               'query'                         => $this->query,
-                               'filter'                        => $this->filter
-                       );
+                       $content = array();
+                       $j=0;
+                       if (isset($tenant_list) && is_array($tenant_list))
+                       {
+                               foreach($tenant_list as $tenant_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$tenant_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+                       }
 
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
 
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($tenant_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_tenant_new'               => 
$table_header,
-                               'values_tenant_new'                             
=> $content,
-                               'table_done'                                    
=> $table_done
-                       );
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = true;
+                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                       }
 
+                       $function_exchange_values = '';
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("tenant_id")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("last_name")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("first_name")[0].value = "";' ."\r\n";
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("tenant_id")[0].value = data.getData("id");' 
."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("last_name")[0].value = 
data.getData("last_name");' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("first_name")[0].value = 
data.getData("first_name");' ."\r\n";
+
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($tenant_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
                        $appname                                                
= lang('tenant');
                        $function_msg                                   = 
lang('list tenant');
 
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_tenant' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.tenant.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
                function ns3420()
                {
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uilookup.ns3420',
+                                                               
'second_display'        => true,
+                                                               'cat_id'        
                => $this->cat_id,
+                                                               'query'         
                => $this->query,
+                                                               'filter'        
                => $this->filter
+                                       ));
 
-                       $ns3420_list = $this->bo->read_ns3420();
+                       $datatable['config']['allow_allrows'] = true;
 
-                       while (is_array($ns3420_list) && list(,$ns3420_entry) = 
each($ns3420_list))
-                       {
-                               $content[] = array
-                               (
-                                       'id'                            => 
$ns3420_entry['id'],
-                                       'ns3420_descr'          => 
$ns3420_entry['ns3420_descr'],
-                                       'lang_select'           => 
lang('Select'),
-                                       'lang_select_statustext' => 
lang('Select this ns3420 - code')
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.ns3420',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.ns3420',
+                                                                       
'second_display'        => true,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'filter'                        => $this->filter
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
                                );
                        }
 
-                       $table_header[] = array
-                       (
-                               'sort_descr'    => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'tekst1',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.ns3420',
-                                                                               
                                                        'query' =>$this->query)
-                                                                               
)),
-                               'lang_descr'            => lang('ns3420 
description'),
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.ns3420',
-                                                                               
                                                        'query' =>$this->query)
-                                                                               
)),
-                               'lang_id'               => lang('ID'),
-                               'lang_select'           => lang('Select')
+                       $uicols = array (
+                               'input_type'    =>      array(text,text),
+                               'name'                  =>      
array(id,ns3420_descr),
+                               'sort_field'    =>      array(id,tekst1),
+                               'formatter'             =>      array('',''),
+                               'descr'                 =>      
array(lang('ID'),lang('ns3420 description'))
                        );
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                       $ns3420_list = array();
+                       $ns3420_list = $this->bo->read_ns3420();
 
-                       $link_select = array
-                       (
-                               'menuaction'            => 
'property.uilookup.ns3420',
-                               'second_display'        => true,
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
-                               'cat_id'                        => 
$this->cat_id,
-                               'query'                         => $this->query,
-                               'filter'                        => $this->filter
-                       );
+                       $content = array();
+                       $j=0;
+                       if (isset($ns3420_list) && is_array($ns3420_list))
+                       {
+                               foreach($ns3420_list as $ns3420_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$ns3420_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+                       }
 
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
 
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($ns3420_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'lang_search'                                   
=> lang('search'),
-                               'query'                                         
        => $this->query,
-                               'table_header_ns3420'           => 
$table_header,
-                               'values_ns3420'                 => $content,
-                               'table_done'                                    
=> $table_done
-                       );
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = true;
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols['sort_field'][$i];
+                       }
 
+                       $function_exchange_values = '';
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ns3420_id")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ns3420_descr")[0].value = "";' ."\r\n";
+
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ns3420_id")[0].value = data.getData("id");' 
."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ns3420_descr")[0].value = 
data.getData("ns3420_descr");' ."\r\n";
+
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($ns3420_entry);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
                        $appname                                                
= lang('standard description');
                        $function_msg                                   = 
lang('list standard description');
 
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_ns3420' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.tenant.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
@@ -742,162 +1441,281 @@
                        $this->part_of_town_id          = 
$boentity->part_of_town_id;
                        $this->district_id                      = 
$boentity->district_id;
                        $this->entity_id                        = 
$boentity->entity_id;
+                       $this->location_code            = 
$boentity->location_code;
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
 
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'            => 
'property.uilookup.entity',
+                                                       'entity_id'             
        => $this->entity_id,
+                                                       'cat_id'                
        => $this->cat_id,
+                                                       'district_id'           
=> $this->district_id,
+                                                       'query'                 
        => $this->query,
+                                                       'filter'                
        => $this->filter,
+                                                       'location_code'         
=> $this->location_code,                                                        
+
+                                       ));
+
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.entity',"
+                                                                               
                ."entity_id:'{$this->entity_id}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."district_id:'{$this->district_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."location_code:'{$this->location_code}'";
+
+                               $values_combo_box[0] = 
$boentity->select_category_list('filter',$this->cat_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$bocommon->select_district_list('filter',$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no district'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.entity',
+                                                                       
'entity_id'                     => $this->entity_id,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       
'district_id'           => $this->district_id,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'filter'                        => $this->filter
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
CATEGORY
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array( //boton  
CATEGORY
+                                                                   'id' => 
'btn_district_id',
+                                                                   'name' => 
'district_id',
+                                                                   'value'     
=> lang('District'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 3
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$bocommon->select2String($values_combo_box[1]) //i.e.  id,value/id,vale/
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+
                        $entity_list = $boentity->read(array('lookup'=>true));
-
                        $input_name = 
$GLOBALS['phpgw']->session->appsession('lookup_fields','property');
-//_debug_array($input_name);
-
                        $uicols = $boentity->uicols;
 
-//_debug_array($uicols);
+                       if (count($uicols['name']) > 0)
+                       {
+                               for ($m = 0; $m<count($input_name); $m++)
+                               {
+                                       if 
(!array_search($input_name[$m],$uicols['name']))
+                                       {
+                                               $uicols['name'][]       = 
$input_name[$m];
+                                               $uicols['descr'][]      = '';
+                                               $uicols['input_type'][]         
= 'hidden';
+                                       }
+                               }
+                       }
+                       else
+                       {
 
+                                       $uicols['name'][]       = 'num';
+                                       $uicols['descr'][]      = 'ID';
+                                       $uicols['input_type'][]         = 
'text';
+                       }
+
+                       $content = array();
                        $j=0;
-
-                       if (isset($entity_list) AND is_array($entity_list))
+                       if (isset($entity_list) && is_array($entity_list))
                        {
                                foreach($entity_list as $entity_entry)
                                {
-
                                        for 
($i=0;$i<count($uicols['name']);$i++)
                                        {
-                                               
if($uicols['input_type'][$i]!='hidden')
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
($entity_entry[$uicols['name'][$i]] == null ? '' : 
$entity_entry[$uicols['name'][$i]]);
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+
+                                               if(isset($uicols['datatype']) 
&& isset($uicols['datatype'][$i]) && $uicols['datatype'][$i]=='link' && 
$entity_entry[$uicols['name'][$i]])
                                                {
-                                                       
$content[$j]['row'][$i]['value']        = $entity_entry[$uicols['name'][$i]];
-                                                       
$content[$j]['row'][$i]['name']         = $uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = lang('link');
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']             = 
$entity_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
                                                }
                                        }
 
-                                       for ($i=0;$i<count($input_name);$i++)
+                                       /*for ($i=0;$i<count($input_name);$i++)
                                        {
-                                               
$content[$j]['hidden'][$i]['value']     = $entity_entry[$input_name[$i]];
-                                               
$content[$j]['hidden'][$i]['name']              = $input_name[$i];
-                                       }
-
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']    = 
$entity_entry[$input_name[$i]];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']     = $input_name[$i];
+                                       }*/
                                        $j++;
                                }
                        }
 
-//_debug_array($content);
-                       for ($i=0;$i<count($uicols['descr']);$i++)
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
                                if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1')
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       if($uicols['name'][$i]=='loc1' || 
$uicols['name'][$i]=='num')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'loc1',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.entity',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                                        'entity_id'             
=>$this->entity_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                                        }
-                                       if($uicols['name'][$i]=='num')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'num',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uilookup.entity',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'entity_id'             
=>$this->entity_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
-                                       }
                                }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
                        }
 
-                       $table_header[$i]['width']                      = '5%';
-                       $table_header[$i]['align']                      = 
'center';
-                       $table_header[$i]['header']             = 
lang('select');
+                       $function_exchange_values = '';
 
+                       for ($i=0;$i<count($input_name);$i++)
+                       {
+                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value = "";' 
."\r\n";
+                       }
 
-//_debug_array($table_header);
-//_debug_array($uicols);
+                       for ($i=0;$i<count($input_name);$i++)
+                       {
+                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value = 
data.getData("'.$input_name[$i].'");' ."\r\n";
+                       }
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
-                       );
+                       $function_exchange_values .= 'window.close()';
 
-                       $link_select = array
-                       (
-                               'menuaction'            => 
'property.uilookup.entity',
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
-                               'cat_id'                        => 
$this->cat_id,
-                               'entity_id'                     => 
$this->entity_id,
-                               'district_id'           => $this->district_id,
-                               'query'                         => $this->query,
-                               'filter'                        => $this->filter
-                       );
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
 
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       for ($i=0;$i<count($input_name);$i++)
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($entity_list);
+                       $datatable['pagination']['records_total']       = 
$boentity->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $function_exchange_values .= 
'opener.document.form.' . $input_name[$i] .'.value = thisform.elements[' . $i . 
'].value;' ."\r\n";
+                               $datatable['sorting']['order']                  
= 'num'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
 
-                       $function_exchange_values .='window.close()';
 
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $data = array
-                       (
-                               'exchange_values'                               
=> 'Exchange_values(this.form);',
-                               'function_exchange_values'              => 
$function_exchange_values,
-                               'lang_select'                                   
=> lang('select'),
-                               'lookup'                                        
        => 1,//$lookup,
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($entity_list),
-                               'all_records'                                   
=> $boentity->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
        => $boentity->select_category_list('filter',$this->cat_id),
-                               'district_list'                                 
=> $bocommon->select_district_list('filter',$this->district_id),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'lang_no_district'                              
=> lang('no district'),
-                               'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                  => 
'district_id',
-                               'lang_select'                                   
=> lang('Select'),
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'headers'                       => 
$uicols
 
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_entity'                   => 
$table_header,
-                               'values_entity'                                 
=> $content,
-                               'table_done'                                    
=> $table_done
-                       );
+                       );
 
-//_debug_array($content);
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
                        if($this->entity_id)
                        {
                                $entity         = 
$boadmin_entity->read_single($this->entity_id,false);
@@ -907,143 +1725,638 @@
                        {
                                $category = 
$boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
                                $function_msg                                   
= lang('lookup') . ' ' . $category['name'];
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        }
+                       
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_entity' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.entity.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
                function phpgw_user()
                {
+                       $column = phpgw::get_var('column');
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
 
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uilookup.phpgw_user',
+                                                               
'second_display'        => true,
+                                                               'cat_id'        
                => $this->cat_id,
+                                                               'query'         
                => $this->query,
+                                                               'filter'        
                => $this->filter,
+                                                               'column'        
                => $column
+                                       ));
+
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.phpgw_user',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."column:'{$column}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.phpgw_user',
+                                                                       
'second_display'        => true,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'filter'                        => $this->filter,
+                                                                       
'column'                        => $column
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+
+                       $uicols = array (
+                               'input_type'    =>      
array(text,hidden,text,text),
+                               'name'                  =>      
array(id,account_lid,first_name,last_name),
+                               'sort_field'    =>      
array(account_id,account_lid,account_firstname,account_lastname),
+                               'formatter'             =>      
array('','','',''),
+                               'descr'                 =>      
array(lang('ID'),'',lang('first name'),lang('last name'))
+                       );
+
+                       $phpgw_user_list = array();
                        $phpgw_user_list = $this->bo->read_phpgw_user();
 
-                       $column = phpgw::get_var('column');
+                       $content = array();
+                       $j=0;
+                       if (isset($phpgw_user_list) && 
is_array($phpgw_user_list))
+                       {
+                               foreach($phpgw_user_list as $phpgw_user_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$phpgw_user_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+                       }
 
-                       while (is_array($phpgw_user_list) && 
list(,$phpgw_user_entry) = each($phpgw_user_list))
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
-                               $content[] = array
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols['sort_field'][$i];
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
+
+                       if($column)
+                       {
+                               $user_id        =$column;
+                               $user_name      =$column . '_user_name';
+                       }
+                       else
+                       {
+                               $user_id        ='user_id';
+                               $user_name      ='user_name';
+                       }
+
+                       $function_exchange_values = '';
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$user_id.'")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$user_name.'")[0].value = "";' ."\r\n";
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$user_id.'")[0].value = 
data.getData("id");' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("'.$user_name.'")[0].value = 
data.getData("first_name") + " " + data.getData("last_name");' ."\r\n";
+
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($phpgw_user_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+               {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       $appname                                                
= lang('standard description');
+                       $function_msg                                   = 
lang('list standard description');
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                                (
-                                       'id'                            => 
$phpgw_user_entry['id'],
-                                       'account_lid'           => 
$phpgw_user_entry['account_lid'],
-                                       'first_name'                    => 
$phpgw_user_entry['first_name'],
-                                       'last_name'                     => 
$phpgw_user_entry['last_name'],
-                                       'lang_select'           => 
lang('Select'),
-                                       'lang_select_statustext' => 
lang('Select this user')
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                                );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
                        }
 
-                       $table_header[] = array
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.tenant.index', 'property' );
+
+                       $this->save_sessiondata();
+               }
+
+               function project_group()
+               {
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
                        (
-                               'sort_account_lid'      => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'account_lid',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.phpgw_user',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'sort_last_name'        => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'account_lastname',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.phpgw_user',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'sort_first_name'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'account_firstname',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.phpgw_user',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'lang_last_name'                => lang('last 
name'),
-                               'lang_first_name'               => lang('first 
name'),
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'account_id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uilookup.phpgw_user',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'column'        => 
$column)
-                                                                               
)),
-                               'lang_id'               => lang('ID'),
-                               'lang_select'           => lang('Select')
-                       );
+                                               'menuaction'                    
=> 'property.uilookup.project_group',
+                               'second_display'        => true,
+                               'cat_id'                        => 
$this->cat_id,
+                               'query'                         => $this->query,
+                               'filter'                        => $this->filter
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
 
-                       $table_done[] = array
-                       (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Close this 
window')
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.project_group',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.project_group',
+                                                                       
'second_display'        => true,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'filter'                        => $this->filter
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+
+                       $uicols = array (
+                               'input_type'    =>      array(text,text),
+                               'name'                  =>      array(id,descr),
+                               'formatter'             =>      array('',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Name'))
                        );
 
-                       $link_select = array
+                       $project_group_list = array();
+                       $project_group_list = $this->bo->read_project_group();
+
+                       $content = array();
+                       $j=0;
+                       if (isset($project_group_list) && 
is_array($project_group_list))
+                       {
+                               foreach($project_group_list as 
$project_group_entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$project_group_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
+                               }
+               }
+
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+               {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = true;
+                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                       }
+
+                       $function_exchange_values = '';
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("project_group")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("project_group_descr")[0].value = "";' 
."\r\n";
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("project_group")[0].value = 
data.getData("id");' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("project_group_descr")[0].value = 
data.getData("descr");' ."\r\n";
+
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($project_group_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                                               {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                                       }
+                       else
+                                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                                       }
+
+                       $appname                                                
= lang('project group');
+                       $function_msg                                   = 
lang('list project group');
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                       }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                       {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                       }
+                               }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                       }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.tenant.index', 'property' );
+
+                       $this->save_sessiondata();
+               }
+
+               function ecodimb()
+               {
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
                        (
-                               'menuaction'            => 
'property.uilookup.phpgw_user',
-                               'order'                         => $this->order,
-                               'sort'                          => $this->sort,
+                                               'menuaction'                    
=> 'property.uilookup.ecodimb',
+                                                               
'second_display'        => true,
                                'cat_id'                        => 
$this->cat_id,
                                'query'                         => $this->query,
-                               'filter'                        => 
$this->filter,
-                               'column'                        => $column
+                               'filter'                        => $this->filter
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uilookup.ecodimb',"
+                                                                               
                ."second_display:'{true}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."filter:'{$this->filter}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uilookup.ecodimb',
+                                                                       
'second_display'        => true,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'filter'                        => $this->filter
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//'',//$query,
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+
+                       $uicols = array (
+                               'input_type'    =>      array(text,text),
+                               'name'                  =>      array(id,descr),
+                               'formatter'             =>      array('',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Name'))
                        );
 
-                       if($column)
+                       $ecodimb_list = array();
+                       $ecodimb_list = $this->bo->read_ecodimb();
+
+                       $content = array();
+                       $j=0;
+                       if (isset($ecodimb_list) && is_array($ecodimb_list))
                        {
-                               $user_id        =$column;
-                               $user_name      =$column . '_user_name';
+                               foreach($ecodimb_list as $ecodimb_entry)
+                       {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$ecodimb_entry[$uicols['name'][$i]];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+                                       $j++;
                        }
+               }
+
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+               {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = true;
+                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                       }
+
+                       $function_exchange_values = '';
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ecodimb")[0].value = "";' ."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ecodimb_descr")[0].value = "";' ."\r\n";
+
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ecodimb")[0].value = data.getData("id");' 
."\r\n";
+                       $function_exchange_values .= 
'opener.document.getElementsByName("ecodimb_descr")[0].value = 
data.getData("descr");' ."\r\n";
+
+                       $function_exchange_values .= 'window.close()';
+
+                       $datatable['exchange_values'] = 
$function_exchange_values;
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($ecodimb_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
                        else
                        {
-                               $user_id        ='user_id';
-                               $user_name      ='user_name';
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
+                       $appname                                                
= lang('project group');
+                       $function_msg                                   = 
lang('list project group');
 
-                       $data = array
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($phpgw_user_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_phpgw_user'               => 
$table_header,
-                               'values_phpgw_user'                             
=> $content,
-                               'table_done'                                    
=> $table_done,
-                               'user_id'                                       
        => $user_id,
-                               'user_name'                                     
        => $user_name
-
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $appname                                                
= lang('phpgw_user');
-                       $function_msg                                   = 
lang('list phpgw_user');
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                       {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                       }
+                       else
+                       {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_phpgw_user' => $data));
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'lookup.tenant.index', 'property' );
+
                        $this->save_sessiondata();
                }
        }
-

Modified: people/sigurdne/modules/property/trunk/inc/class.uimigrate.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uimigrate.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uimigrate.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -8,13 +8,13 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.uimigrate.inc.php 732 2008-02-10 16:21:14Z sigurd 
$
+       * @version $Id: class.uimigrate.inc.php 2588 2009-04-14 11:00:02Z 
sigurd $
        */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,

Modified: people/sigurdne/modules/property/trunk/inc/class.uipricebook.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uipricebook.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uipricebook.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -32,6 +32,8 @@
         * @package property
         */
 
+       phpgw::import_class('phpgwapi.yui');
+
        class property_uipricebook
        {
                var $grants;
@@ -330,111 +332,303 @@
 
                        
$GLOBALS['phpgw']->session->appsession('referer','property','');
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       $datatable = array();
 
-                       $agreement_list = $this->bo->read_agreement_group();
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
 
-                       while (is_array($agreement_list) && list(,$agreement) = 
each($agreement_list))
+                               if(!$lookup)
                        {
-                               $content[] = array
+                                       $datatable['menu']      = 
$this->bocommon->get_menu();
+                               }
+                       
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
                                (
-                                       'agreement_group_id'            => 
$agreement['agreement_group_id'],
-                                       'num'                           => 
$agreement['num'],
-                                       'status'                        => 
lang($agreement['status']),
-                                       'descr'                         => 
$agreement['descr'],
-                                       'link_edit'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.edit_agreement_group', 'agreement_group_id'=> 
$agreement['agreement_group_id'])),
-                                       'link_delete'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.delete', 'method'=>'agreement_group', 
'agreement_group_id'=> $agreement['agreement_group_id'], 
'start'=>$this->start)),
-                                       'lang_edit_statustext'          => 
lang('edit the agreement_group'),
-                                       'lang_delete_statustext'        => 
lang('Delete this agreement group'),
-                                       'text_edit'                     => 
lang('edit'),
-                                       'text_delete'                   => 
lang('delete')
+                                                               'menuaction'=> 
'property.uipricebook.agreement_group',
+                                                                       
'cat_id'        => $this->cat_id,
+                                                                       
'filter'        => $this->filter,
+                                                                       'query' 
        => $this->query
+
+                                       ));
+                                       
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uipricebook.agreement_group',"                            
                                                                
+                                                                               
                        ."cat_id:'{$this->cat_id}',"
+                                                                               
                        ."filter:'{$this->filter}',"
+                                                                               
                        ."query:'{$this->query}'";
+            
+                               
+                               $values_combo_box[0]  = 
$this->bo->select_status_list('filter',$this->cat_id);
+                               $default_value = array 
('id'=>'','name'=>lang('No status'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'    => 'property.uipricebook.agreement_group',
+                                                                       
'cat_id'        => $this->cat_id,
+                                                                       
'filter'        => $this->filter,
+                                                                       'query' 
        => $this->query
+                                                               )
+                                                       ),
+                                               'fields'        => array(
+                                       'field' => array(
+                                                               array(
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 5
+                                                                           ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'size'    
=> 28,
+                                                                   'tab_index' 
=> 3
+                                                               )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
                                );
                        }
 
-                       $table_header[] = array
+                       $agreement_list = array();
+                       $agreement_list = $this->bo->read_agreement_group();
+
+                       $uicols = array (
+                               'input_type'    =>      
array(text,text,text,text),
+                               'name'                  =>      
array(agreement_group_id,num,descr,status),
+                               'formatter'             =>      
array('','','',''),
+                               'descr'                 =>      
array(lang('ID'),lang('Activity Num'),lang('Description'),lang('Status'))
+                       );
+                       
+                       $j=0;
+                       if (isset($agreement_list) && is_array($agreement_list))
+                       {
+                               foreach ($agreement_list as $agreement)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$agreement[$uicols['name'][$i]];                                                
                                              
+                                       }
+
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
                        (
-                               'lang_id'               => lang('ID'),
-                               'sort_num'              => 
$this->nextmatchs->show_sort_order(array
+                               'parameter' => array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'num',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 
'property.uipricebook.agreement_group',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                       array
+                                       (
+                                               'name'          => 
'agreement_group_id',
+                                               'source'        => 
'agreement_group_id'
+                                       )
+                               )
+                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'                       => 'edit',
+                               'text'                  => lang('edit'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uipricebook.edit_agreement_group'
                                                                                
)),
-                               'lang_num'              => lang('Activity Num'),
-                               'lang_delete'           => lang('Delete'),
-                               'lang_descr'            => lang('Description'),
-                               'lang_edit'             => lang('edit')
+                               'parameters'    => $parameters
                        );
 
-                       $link_data = array
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'               => 'edit',
+                               'text'                  => lang('open edit in 
new window'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 
'property.uipricebook.agreement_group',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'query'         => $this->query
+                                                                       
'menuaction'    => 'property.uipricebook.edit_agreement_group',
+                                                                       
'target'                => '_blank'
+                                                               )),
+                               'parameters'    => $parameters
                        );
 
-                       $table_add[] = array
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'                       => 'delete',
+                               'text'                  => lang('delete'),
+                               'confirm_msg'   => lang('do you really want to 
delete this entry'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_add'              => lang('add'),
-                               'lang_add_statustext'   => lang('add an 
activity'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.edit_agreement_group'))
+                                                                       
'menuaction'    => 'property.uipricebook.delete',
+                                                                       
'method'        =>      'agreement_group'
+                                                               )),
+                               'parameters'    => $parameters
                        );
 
-                       if(!$this->allrows)
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'                       => 
'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uipricebook.edit_agreement_group'
+                                                                       ))
+                       );
+                       
+                       unset($parameters);
+                       
+                       
+                       $uicols_count   = count($uicols['descr']);
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
+                               $datatable['headers']['header'][$i]['text']     
                = $uicols['descr'][$i];
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = false;
+                               
+                               if ($uicols['name'][$i] == 'num')
+                               {
+                                       
$datatable['headers']['header'][$i]['sortable']                 = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                               }
                        }
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($agreement_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'num'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('core','check','property');
+                       $appname        = lang('pricebook');
+                       $function_msg   = lang('list agreement group');
 
-                       $data = array
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'allrows'                                       
=> $this->allrows,
-                               'allow_allrows'                                 
=> true,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($agreement_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'lang_select_all'                               
=> lang('Select All'),
-                               'img_check'                                     
=> $GLOBALS['phpgw']->common->get_image_path('property').'/check.png',
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_status_statustext'                        
=> lang('Select the status the agreement group belongs to. To do not use a 
category select NO STATUS'),
-                               'status_name'                                   
=> 'cat_id',
-                               'lang_no_status'                                
=> lang('No status'),
-                               'status_list'                                   
=> $this->bo->select_status_list('filter',$this->cat_id),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
-                               'lang_filter_statustext'                        
=> lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_agreement_group'                  
=> $table_header,
-                               'values_agreement_group'                        
=> $content,
-                               'table_add'                                     
=> $table_add,
-                               'update_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.agreement_group'))
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                                );
 
-                       $appname        = lang('pricebook');
-                       $function_msg   = lang('list agreement group');
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('agreement_group' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'pricebook.agreement_group', 'property' );                               
+       
                        $this->save_sessiondata();
                }
 
@@ -823,134 +1017,345 @@
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::agreement::pricebook::activities';
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       $datatable = array();
 
-                       $pricebook_list = 
$this->bo->read_activities_pr_agreement_group();
-//_debug_array($pricebook_list);
-                       while (is_array($pricebook_list) && list(,$pricebook) = 
each($pricebook_list))
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
-                               $content[] = array
+
+                               if(!$lookup)
+                               {
+                                       $datatable['menu']      = 
$this->bocommon->get_menu();
+                               }
+                       
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
                                (
-                                       'activity_id'                           
=> $pricebook['activity_id'],
-                                       'num'                                   
=> $pricebook['num'],
-                                       'branch'                                
=> $pricebook['branch'],
-                                       'base_descr'                            
=> $pricebook['base_descr'],
-                                       'dim_d'                                 
=> $pricebook['dim_d'],
-                                       'ns3420'                                
=> $pricebook['ns3420'],
-                                       'unit'                                  
=> $pricebook['unit'],
-                                       'descr'                                 
=> $pricebook['descr'],
-                                       'link_vendor'                           
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.activity_vendor', 'activity_id'=> 
$pricebook['activity_id'], 'agreement_group'=> $this->cat_id)),
-                                       'link_edit'                             
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.edit_activity', 'activity_id'=> 
$pricebook['activity_id'], 'agreement_group'=> $this->cat_id)),
-                                       'link_delete'                           
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.delete', 'method'=> 'activity', 'activity_id'=> 
$pricebook['activity_id'])),
-                                       'lang_vendor_statustext'                
=> lang('view the vendor(s) for this activity'),
-                                       'lang_edit_statustext'                  
=> lang('edit this activity'),
-                                       'lang_delete_statustext'                
=> lang('delete this activity'),
-                                       'text_vendor'                           
=> lang('vendor'),
-                                       'text_edit'                             
=> lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
+                                                               'menuaction'=> 
'property.uipricebook.activity',
+                                                                       
'cat_id'        =>$this->cat_id,
+                                                                       
'filter'        => $this->filter,
+                                                                       'query' 
        =>$this->query
+
+                                       ));
+                                       
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uipricebook.activity',"                                   
                                                        
+                                                                               
                        ."cat_id:'{$this->cat_id}',"
+                                                                               
                        ."filter:'{$this->filter}',"
+                                                                               
                        ."query:'{$this->query}'";
+            
+                               
+                               $values_combo_box[0]  = 
$this->bo->get_agreement_group_list('filter',$this->cat_id);
+                               $default_value = array 
('id'=>'','name'=>lang('select agreement_group'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'    => 'property.uipricebook.activity',
+                                                                       
'cat_id'        =>$this->cat_id,
+                                                                       
'filter'        => $this->filter,
+                                                                       'query' 
        =>$this->query
+                                                               )
+                                                       ),
+                                               'fields'        => array(
+                                       'field' => array(
+                                                               array(
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_export',
+                                                                               
'value' => lang('download'),
+                                                                               
'tab_index' => 5
+                                                                           ),  
                                                                
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 4
+                                                                           ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'size'    
=> 28,
+                                                                   'tab_index' 
=> 2
+                                                               )               
                                        
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]) //i.e.  id,value/id,vale/
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
                                );
                        }
 
-                       $table_header[] = array
+                       $pricebook_list = array();
+                       $pricebook_list = 
$this->bo->read_activities_pr_agreement_group();
+                                                                       
+                       $uicols = array (
+                               'input_type'    =>      
array(hidden,text,text,text,text,text,text,text),
+                               'name'                  =>      
array(activity_id,num,descr,unit,ns3420,base_descr,branch,dim_d),
+                               'formatter'             =>      
array('','','','','','','',''),
+                               'descr'                 =>      
array('',lang('Activity 
Num'),lang('Description'),lang('Unit'),lang('NS3420'),lang('Base'),lang('Branch'),lang('Dim
 d'))
+                       );
+                       
+                       $j=0;
+                       if (isset($pricebook_list) && is_array($pricebook_list))
+                       {
+                               foreach ($pricebook_list as $pricebook)
+                               {
+                                       for ($i=0; $i<count($uicols['name']); 
$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$pricebook[$uicols['name'][$i]];                                                
                                              
+                                       }
+
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
                        (
-                               'sort_num'      => 
$this->nextmatchs->show_sort_order(array
+                               'parameter' => array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'num',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uipricebook.activity',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                       array
+                                       (
+                                               'name'          => 
'activity_id',
+                                               'source'        => 'activity_id'
+                                       )
+                               )
+                       );
+
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'                       => 'vendor',
+                               'text'                  => lang('vendor'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uipricebook.activity_vendor',
+                                                                       
'agreement_group'       => $this->cat_id
                                                                                
)),
-                               'lang_num'              => lang('Activity Num'),
-                               'lang_branch'           => lang('Branch'),
-                               'lang_vendor'           => lang('Vendor'),
-                               'lang_descr'            => lang('Description'),
-                               'lang_base_descr'       => lang('Base'),
-                               'lang_dim_d'            => lang('Dim d'),
-                               'lang_ns3420'           => lang('NS3420'),
-                               'lang_unit'             => lang('Unit'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete')
+                               'parameters'    => $parameters
                        );
 
-                       $table_add[] = array
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'               => 'vendor',
+                               'text'                  => lang('open vendor in 
new window'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_add'              => lang('add'),
-                               'lang_add_statustext'   => lang('add an 
activity'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.edit_activity', 'agreement_group'=> $this->cat_id))
+                                                                       
'menuaction'    => 'property.uipricebook.activity_vendor',
+                                                                       
'agreement_group'       => $this->cat_id,
+                                                                       
'target'                => '_blank'
+                                                               )),
+                               'parameters'    => $parameters
                        );
 
-                       $link_data = array
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'                       => 'edit',
+                               'text'                  => lang('edit'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 
'property.uipricebook.activity',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'query'         => $this->query
+                                                                       
'menuaction'    => 'property.uipricebook.edit_activity',
+                                                                       
'agreement_group'       => $this->cat_id
+                                                               )),
+                               'parameters'    => $parameters
                        );
 
-                       if(!$this->allrows)
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'               => 'edit',
+                               'text'                  => lang('open edit in 
new window'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uipricebook.edit_activity',
+                                                                       
'agreement_group'       => $this->cat_id,
+                                                                       
'target'                => '_blank'
+                                                               )),
+                               'parameters'    => $parameters
+                       );      
+                       
+                       $datatable['rowactions']['action'][] = array(
+                               'my_name'                       => 'delete',
+                               'text'                  => lang('delete'),
+                               'confirm_msg'   => lang('do you really want to 
delete this entry'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uipricebook.delete',
+                                                                       
'method'        => 'activity'
+                                                               )),
+                               'parameters'    => $parameters
+                       );
+               
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'                       => 
'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uipricebook.edit_activity',
+                                                                               
'agreement_group'       => $this->cat_id
+                                                                       ))
+                       );
+                       
+                       unset($parameters);
+                       
+                       
+                       $uicols_count   = count($uicols['descr']);
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
+                                       if ($uicols['name'][$i] == 'num')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']                 = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                                       }
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];                                 
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;        
                                
+                               }
                        }
 
-                       $link_download = array
-                       (
-                               'menuaction'    => 
'property.uipricebook.download_2',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'query'         => $this->query,
-                               'allrows'       => $this->allrows,
-                               'start'         => $this->start
-                       );
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_download'                                 
=> 'download',
-                               'link_download'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                            
=> lang('Download table to your browser'),
-                               'allrows'                                       
=> $this->allrows,
-                               'allow_allrows'                                 
=> true,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($pricebook_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'lang_select_all'                               
=> lang('Select All'),
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('select agreement_group'),
-                               'lang_cat_statustext'                           
=> lang('Select the agreement_group the pricebook belongs to. To do not use a 
category select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
=> $this->bo->get_agreement_group_list('filter',$this->cat_id),
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
-                               'lang_filter_statustext'                        
=> lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_activities'                       
=> $table_header,
-                               'values_activities'                             
=> $content,
-                               'table_add'                                     
=> $table_add
-                       );
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($pricebook_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'num'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
                        $appname        = lang('pricebook');
                        $function_msg   = lang('list activities per 
agreement_group');
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
+
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_activities' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'pricebook.activity', 'property' );      
+                       
                        $this->save_sessiondata();
                }
 
@@ -1282,12 +1687,20 @@
                        }
                        elseif($method=='activity')
                        {
+                               //delete with JSON
+                               if( phpgw::get_var('phpgw_return_as') == 'json' 
)
+                               {
+                                       $function_msg   =lang('delete 
activity');
+                                       
$this->bo->delete_activity($activity_id);
+                                       return $function_msg;
+                               }                               
+                               
                                $link_data = array
                                (
                                        'menuaction' => 
'property.uipricebook.activity'
                                );
 
-                               $function_msg   =lang('delete activity');
+                               //$function_msg =lang('delete activity');
                                $delete_action  = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.delete', 'method'=> $method, 'activity_id'=> 
$activity_id));
 
                                if (phpgw::get_var('confirm', 'bool', 'POST'))
@@ -1316,13 +1729,22 @@
                        }
                        elseif($method=='agreement_group')
                        {
+                               
+                               //JsonCod for Delete
+                               if( phpgw::get_var('phpgw_return_as') == 'json' 
)
+                               {
+                                       $function_msg   =lang('Delete agreement 
group and all the activities associated with it!');
+                                       
$this->bo->delete_agreement_group($agreement_group_id);
+                                       return $function_msg ;
+                               }
+                       
                                $link_data = array
                                (
                                        'menuaction'    => 
'property.uipricebook.agreement_group',
                                        'start'         => $this->start
                                );
 
-                               $function_msg   =lang('Delete agreement group 
and all the activities associated with it!');
+                               
                                $delete_action  = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uipricebook.delete', 'method'=> $method, 'agreement_group_id'=> 
$agreement_group_id, 'start'=> $this->start));
 
                                if (phpgw::get_var('confirm', 'bool', 'POST'))

Modified: people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiproject.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage project
-       * @version $Id$
+       * @version $Id$
        */
 
        phpgw::import_class('phpgwapi.yui');
@@ -47,6 +47,7 @@
                var $sub;
                var $currentapp;
                var $district_id;
+               var $criteria_id;
 
                var $public_functions = array
                (
@@ -60,16 +61,15 @@
 
                function property_uiproject()
                {
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; // 
menus added where needed via bocommon::get_menu
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::project';
 
-               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs               = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-
                        $this->bo                               = 
CreateObject('property.boproject',true);
-                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->bocommon                 = & $this->bo->bocommon;
                        $this->cats                             = & 
$this->bo->cats;
+                       $this->custom                   = & $this->bo->custom;
 
                        $this->acl                              = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location             = '.project';
@@ -86,6 +86,9 @@
                        $this->cat_id                   = $this->bo->cat_id;
                        $this->status_id                = $this->bo->status_id;
                        $this->wo_hour_cat_id           = 
$this->bo->wo_hour_cat_id;
+                       $this->district_id              = 
$this->bo->district_id;
+                       $this->user_id                  = $this->bo->user_id;
+                       $this->criteria_id              = 
$this->bo->criteria_id;
                }
 
                function save_sessiondata()
@@ -99,7 +102,10 @@
                                'filter'        => $this->filter,
                                'cat_id'        => $this->cat_id,
                                'status_id'     => $this->status_id,
-                               'wo_hour_cat_id'=> $this->wo_hour_cat_id
+                               'wo_hour_cat_id'=> $this->wo_hour_cat_id,
+                               'district_id'   => $this->district_id,
+                               'user_id'               => $this->user_id,
+                               'criteria_id'   => $this->criteria_id
                        );
                        $this->bo->save_sessiondata($data);
                }
@@ -108,7 +114,7 @@
                {
                        $start_date = urldecode(phpgw::get_var('start_date'));
                        $end_date       = urldecode(phpgw::get_var('end_date'));
-                       $list           = 
$this->bo->read($start_date,$end_date,$allrows=true);
+                       $list           = $this->bo->read(array('start_date' => 
$start_date, 'end_date' => $end_date, 'allrows' => true, 'skip_origin' => 
true));
                        $uicols = $this->bo->uicols;
                        
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
                }
@@ -118,56 +124,323 @@
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::project';
                        if(!$this->acl_read)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1,'acl_location'=> $this->acl_location));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiproject.stop', 'perm'=>1,'acl_location'=> $this->acl_location));
                        }
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('project','values','table_header',
-                                                                               
'nextmatchs',
-                                                                               
'search_field',
-                                                                               
'wo_hour_cat_filter'));
+                       /*
+                       * FIXME:
+                       * Temporary fix to avoid doubled get of first page in 
table all the way from the database - saves about a second
+                       * Should be fixed in the js if possible.
+                       */
 
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $json_get = 
phpgwapi_cache::session_get('property', 'project_index_json_get');
+                               if($json_get == 1)
+                               {
+                                       $json = 
phpgwapi_cache::session_get('property', 'project_index_json');
+                                       if($json && is_array($json))
+                                       {
+                                               
phpgwapi_cache::session_clear('property', 'project_index_json');
+                                               
phpgwapi_cache::session_set('property', 'project_index_json_get', 2);
+                                               return $json;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               phpgwapi_cache::session_clear('property', 
'project_index_json_get');
+                       }
+
                        $lookup                 = phpgw::get_var('lookup', 
'bool');
                        $from                   = phpgw::get_var('from');
                        $start_date             = 
urldecode(phpgw::get_var('start_date'));
                        $end_date               = 
urldecode(phpgw::get_var('end_date'));
+                       $dry_run                = false;
 
-                       $project_list = $this->bo->read($start_date,$end_date);
+                       $second_display = phpgw::get_var('second_display', 
'bool');
+                       $default_district       = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+
+                       if ($default_district && !$second_display && 
!$this->district_id)
+                       {
+                               $this->bo->district_id  = $default_district;
+                               $this->district_id              = 
$default_district;
+                       }
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'                    => 
'property.uiproject.index',
+                               'query'                         => $this->query,
+                       'district_id'           => $this->district_id,
+                       'part_of_town_id'       => $this->part_of_town_id,
+                       'lookup'                        => $lookup,
+                       'cat_id'                        => $this->cat_id,
+                       'status_id'                     => $this->status_id,
+                                       'wo_hour_cat_id'                => 
$this->wo_hour_cat_id,
+                                       'user_id'                               
=> $this->user_id,
+                                       'criteria_id'                   => 
$this->criteria_id
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiproject.index',"
+                                                                               
                ."query:'{$this->query}',"
+                                                                               
."district_id: '{$this->district_id}',"
+                                                                               
."part_of_town_id:'{$this->part_of_town_id}',"
+                                                                               
."lookup:'{$lookup}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
."user_id:'{$this->user_id}',"
+                                                                               
."criteria_id:'{$this->criteria_id}',"
+                                                                               
."wo_hour_cat_id:'{$this->wo_hour_cat_id}',"
+                                                                               
."second_display:1,"
+                                                                               
        ."status_id:'{$this->status_id}'";
+
+                           $datatable['config']['allow_allrows'] = false;
+
+/*
+                               $link_data = array
+                               (
+                                                       'menuaction'    => 
'property.uiproject.index',
+                                                       'sort'                  
=>$this->sort,
+                                                       'order'                 
=>$this->order,
+                                                       'cat_id'                
=>$this->cat_id,
+                                                       'district_id'   
=>$this->district_id,
+                                                       'filter'                
=>$this->filter,
+                                                       'status_id'             
=>$this->status_id,
+                                                       'lookup'                
=>$lookup,
+                                                       'from'                  
=>$from,
+                                                       'query'                 
=>$this->query,
+                                                       'start_date'    
=>$start_date,
+                                                       'end_date'              
=>$end_date,
+                                                       
'wo_hour_cat_id'=>$this->wo_hour_cat_id,
+                                                       'second_display'=>true
+                               );
+*/
+                               $values_combo_box[0]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no district'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => True));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[1]['cat_list'],$default_value);
+
+                               $values_combo_box[2]  = 
$this->bo->select_status_list('filter',$this->status_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no status'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               $values_combo_box[3]  = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
+                               $default_value = array 
('id'=>'','name'=>lang('no hour category'));
+                               array_unshift 
($values_combo_box[3],$default_value);
+
+                               $values_combo_box[4]  = 
$this->bocommon->get_user_list_right2('filter',2,$this->user_id,$this->acl_location);
+                               $default_value = array 
('id'=>'','name'=>lang('no user'));
+                               array_unshift 
($values_combo_box[4],$default_value);
+
+                               $values_combo_box[5]  = 
$this->bo->get_criteria_list($this->criteria_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no criteria'));
+                               array_unshift 
($values_combo_box[5],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uiproject.index',
+                                                               'district_id'   
    => $this->district_id,
+                                                               
'part_of_town_id'   => $this->part_of_town_id,
+                                                               'lookup'        
        => $lookup,
+                                                               'cat_id'        
        => $this->cat_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
//boton  DISTRICT
+                                                                           
'id' => 'btn_district_id',
+                                                                           
'name' => 'district_id',
+                                                                           
'value'     => lang('district'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//boton  CATEGORY
+                                                                           
'id' => 'btn_cat_id',
+                                                                           
'name' => 'cat_id',
+                                                                           
'value'     => lang('Category'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                       array( 
//boton  STATUS
+                                                                           
'id' => 'btn_status_id',
+                                                                           
'name' => 'status_id',
+                                                                           
'value'     => lang('Status'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                       array( 
//boton  HOUR CATEGORY
+                                                                           
'id' => 'btn_hour_category_id',
+                                                                           
'name' => 'wo_hour_cat_id',
+                                                                           
'value'     => lang('Hour category'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 4
+                                                                       ),
+                                                                       array( 
//boton  USER
+                                                                           
'id' => 'btn_user_id',
+                                                                           
'name' => 'user_id',
+                                                                           
'value'     => lang('User'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 5
+                                                                       ),
+                                                                       array( 
//boton  search criteria
+                                                                           
'id' => 'btn_criteria_id',
+                                                                           
'name' => 'criteria_id',
+                                                                           
'value'     => lang('search criteria'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 6
+                                                                       ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_export',
+                                                                               
        'value' => lang('download'),
+                                                                               
        'tab_index' => 11
+                                                                               
    ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 10
+                                                                               
    ),
+                                                                       array( 
//hidden start_date
+                                                                   'type' => 
'hidden',
+                                                                   'id' => 
'start_date',
+                                                                   'value' => 
$start_date
+                                                           ),
+                                                           array( //hidden 
end_date
+                                                                   'type' => 
'hidden',
+                                                                   'id' => 
'end_date',
+                                                                   'value' => 
$end_date
+                                                           ),
+                                                           array(//for link 
"None",
+                                                                       
'type'=> 'label_date'
+                                                           ),
+                                                                       
array(//for link "Date search",
+                                                                   'type'=> 
'link',
+                                                                   'id'  => 
'btn_data_search',
+                                                                   'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                          
array(
+                                                                              
'menuaction' => 
'property.uiproject.date_search'))."','','width=350,height=250')",
+                                                                    'value' => 
lang('Date search'),
+                                                                    
'tab_index' => 9
+                                                           ),
+                                                               // FIXME test 
on lightbox for date search
+                                                               /*
+                                                                       array( 
//boton     Date SEARCH
+                                                                           
'id' => 'btn_date_search',
+                                                                           
'name' => 'date_search',
+                                                                           
'value'    => lang('date search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 5
+                                                                       ),
+                                                                               
                */
+
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 8
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                       'value' 
   => $this->query,//'',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
),
+                                                       'hidden_value' => array(
+                                                                               
                array( //div values  combo_box_0
+                                                                               
                                                                'id' => 
'values_combo_box_0',
+                                                                               
                                                                'value' => 
$this->bocommon->select2String($values_combo_box[0])
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                            'id' => 'values_combo_box_1',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[1]['cat_list'], 'cat_id') 
//i.e.  id,value/id,vale/
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_2
+                                                                               
                            'id' => 'values_combo_box_2',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
                      ),
+                                                                               
                                                 array( //div values  
combo_box_3
+                                                                               
                            'id' => 'values_combo_box_3',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[3])
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_4
+                                                                               
                            'id' => 'values_combo_box_4',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[4])
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_5
+                                                                               
                            'id' => 'values_combo_box_5',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[5])
+                                                                               
                      )
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+                       $project_list = $this->bo->read(array('start_date' => 
$start_date, 'end_date' => $end_date, 'dry_run' => $dry_run));
                        $uicols = $this->bo->uicols;
                        $count_uicols_name=count($uicols['name']);
 
-                       $j=0;
-                       if (isSet($project_list) AND is_array($project_list))
+                       $content = array();
+                       $j = 0;
+                       if (isset($project_list) AND is_array($project_list))
                        {
+                               $lang_search = lang('search');
                                foreach($project_list as $project_entry)
-
                                {
                                        for ($k=0;$k<$count_uicols_name;$k++)
                                        {
                                                
if($uicols['input_type'][$k]=='text')
                                                {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
isset($project_entry[$uicols['name'][$k]])  ? 
$project_entry[$uicols['name'][$k]] : '';
+
                                                        
if(isset($project_entry['query_location'][$uicols['name'][$k]]) && 
$project_entry['query_location'][$uicols['name'][$k]])
                                                        {
-                                                               
$content[$j]['row'][]= array(
-                                                                       
'statustext' => lang('search'),
-                                                                       'text'  
        => $project_entry[$uicols['name'][$k]],
-                                                                       'link'  
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.index', 'query'=> 
$project_entry['query_location'][$uicols['name'][$k]], 'lookup'=> $lookup, 
'from'=> $from, 'filter'=> $this->filter))
-                                                               );
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['statustext']               = 
$lang_search;
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$project_entry[$uicols['name'][$k]];
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['format']                   = 
'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['java_link']                = true;
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['link']                             
= $project_entry['query_location'][$uicols['name'][$k]];
+                                                               
$uicols['formatter'][$k] = 'myCustom';
+                                                       }
+                                                       else if 
(isset($uicols['datatype']) && isset($uicols['datatype'][$k]) && 
$uicols['datatype'][$k]=='link' && isset($project_entry[$uicols['name'][$k]]) 
&& $project_entry[$uicols['name'][$k]])
+                                                       {
+                                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']            = 
$project_entry[$uicols['name'][$k]]['text'];
+                                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']                     = 
$project_entry[$uicols['name'][$k]]['url'];
+                                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']           = '_blank';
+                                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']           = 'link';
+                                                                       
$datatable['rows']['row'][$j]['column'][$k]['statustext']       = 
$project_entry[$uicols['name'][$k]]['statustext'];
+                                                                       
                                                        }
-                                                       else
-                                                       {
-                                                               
$content[$j]['row'][]= array(
-                                                               'value'         
        => $project_entry[$uicols['name'][$k]],
-                                                               'name'          
        => $uicols['name'][$k]
-                                                               );
-                                                       }
                                                }
-                                               
elseif($uicols['input_type'][$k]=='link')
+                                               else
                                                {
-                                                               
$content[$j]['row'][]= array(
-                                                               'statustext'    
=> lang('search'),
-                                                               'text'          
=> $project_entry[$uicols['name'][$k]],
-                                                               'link'          
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.view', 'id'=> $project_entry[$uicols['name'][$k]]))
-                                                               );
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$project_entry[$uicols['name'][$k]];
                                                }
 
                                                if($lookup && 
$k==($count_uicols_name-1))
@@ -178,184 +451,199 @@
                                                }
                                        }
 
+                                       $j++;
+                               }
+
+                               $datatable['rowactions']['action'] = array();
                                        if(!$lookup)
                                        {
-                                               if ($this->acl_read && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_READ))
+
+                                               $parameters = array
+                                               (
+                                                       'parameter' => array
+                                                       (
+                                                               array
+                                                               (
+                                                                       'name'  
        => 'id',
+                                                                       
'source'        => 'project_id'
+                                                               ),
+                                                       )
+                                               );
+
+                                               $parameters2 = array
+                                               (
+                                                       'parameter' => array
+                                                       (
+                                                               array
+                                                               (
+                                                                       'name'  
        => 'project_id',
+                                                                       
'source'        => 'project_id'
+                                                               ),
+                                                       )
+                                               );
+
+
+                                               if (isset($project_entry) && 
$this->acl_read && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_READ))
                                                {
-                                                       $content[$j]['row'][]= 
array(
+                                                       
$datatable['rowactions']['action'][] = array(
+                                                               'my_name'       
                => 'view',
                                                        'statustext'    => 
lang('view the project'),
                                                        'text'          => 
lang('view'),
-                                                       'link'          => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.view', 'id'=> $project_entry['project_id']))
+                                                               'action'        
        => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiproject.view'
+
+                                                                               
)),
+                                                               'parameters'    
=> $parameters
+                                                       );
+                                                       
$datatable['rowactions']['action'][] = array(
+                                                               'my_name'       
                => 'view',
+                                                               'statustext'    
        => lang('view the project'),
+                                                               'text'          
                => lang('open view in new window'),
+                                                               'action'        
                => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiproject.view',
+                                                                               
        'target'                => '_blank'
+
+                                                                               
)),
+                                                               'parameters'    
=> $parameters
                                                        );
                                                }
                                                else
                                                {
-                                                       $content[$j]['row'][]= 
array('link'=>'dummy');
+                               //                      
$datatable['rowactions']['action'][] = array('link'=>'dummy');
                                                }
 
-                                               if ($this->acl_edit && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_EDIT))
+                                               if (isset($project_entry) && 
$this->acl_edit && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_EDIT))
                                                {
-                                                       $content[$j]['row'][]= 
array(
+                                                       
$datatable['rowactions']['action'][] = array(
+                                                               'my_name'       
                => 'edit',
                                                        'statustext'    => 
lang('edit the project'),
                                                        'text'          => 
lang('edit'),
-                                                       'link'          => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit','id'=> $project_entry['project_id']))
+                                                               'action'        
                => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiproject.edit'
+
+                                                                               
)),
+                                                               'parameters'    
=> $parameters
+                                                       );
+                                                       
$datatable['rowactions']['action'][] = array(
+                                                               'my_name'       
                => 'edit',
+                                                               'statustext'    
        => lang('edit the project'),
+                                                               'text'          
                => lang('open edit in new window'),
+                                                               'action'        
                => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiproject.edit',
+                                                                               
        'target'                => '_blank'
+                                                                               
)),
+                                                               'parameters'    
=> $parameters
                                                        );
                                                }
                                                else
                                                {
-                                                       $content[$j]['row'][]= 
array('link'=>'dummy');
+                               //                      
$datatable['rowactions']['action'][] = array('link'=>'dummy');
                                                }
 
-                                               if ($this->acl_delete && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_DELETE))
+
+
+
+                                               if(isset($project_entry) && 
$this->acl_delete && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_DELETE))
                                                {
-                                                       $content[$j]['row'][]= 
array(
-                                                       'statustext'    => 
lang('delete the project'),
+                                                       
$datatable['rowactions']['action'][] = array(
+                                                               'my_name'       
                => 'delete',
                                                        'text'          => 
lang('delete'),
-                                                       'link'          => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.delete', 'project_id'=> $project_entry['project_id']))
+                                                               'confirm_msg'   
=> lang('do you really want to delete this entry'),
+                                                               'action'        
        => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                (
+                                                                               
                        'menuaction'    => 'property.uiproject.delete'
+                                                                               
                )),
+                                                               'parameters'    
=> $parameters2
                                                        );
                                                }
                                                else
                                                {
-                                                       $content[$j]['row'][]= 
array('link'=>'dummy');
-                                               }
+                               //                      
$datatable['rowactions']['action'][] = array('link'=>'dummy');
                                        }
 
-                                       $j++;
+                                               if (isset($project_entry) && 
$this->acl_add && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_ADD))
+                                               {
+                                                       
$datatable['rowactions']['action'][] = array(
+                                                                               
                'my_name'                       => 'add',
+                                                                               
                'text'                  => lang('add'),
+                                                                               
                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
                                                (
+                                                                               
                                                        'menuaction'    => 
'property.uiproject.edit'
+                                                                               
                                                ))
+                                                                               
);
                                }
                        }
 
-                       $count_uicols_descr=count($uicols['descr']);
+                                               unset($parameters);
+                       }
+                       $count_uicols_descr = count($uicols['descr']);
+
+
                        for ($i=0;$i<$count_uicols_descr;$i++)
                        {
+
                                if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'location_code',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uiproject.index',
-                                                                               
                                                //      'type_id'       => 
$type_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'lookup'        => 
$lookup,
-                                                                               
                                                        'from'          => 
$from,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'start_date'    => 
$start_date,
-                                                                               
                                                        'end_date'      => 
$end_date,
-                                                                               
                                                        'wo_hour_cat_id'=> 
$this->wo_hour_cat_id
-                                                                               
                                                )
-                                                                               
));
-                                       }
-                                       if($uicols['name'][$i]=='project_id')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'project_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uiproject.index',
-                                                                               
                                                //      'type_id'       => 
$type_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'lookup'        => 
$lookup,
-                                                                               
                                                        'from'          => 
$from,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'start_date'    => 
$start_date,
-                                                                               
                                                        'end_date'      => 
$end_date,
-                                                                               
                                                        'wo_hour_cat_id'=> 
$this->wo_hour_cat_id
-                                                                               
                                                )
-                                                                               
));
-                                       }
-                                       if($uicols['name'][$i]=='address')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'address',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uiproject.index',
-                                                                               
                                                //      'type_id'       => 
$type_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'lookup'        => 
$lookup,
-                                                                               
                                                        'from'          => 
$from,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'start_date'    => 
$start_date,
-                                                                               
                                                        'end_date'      => 
$end_date,
-                                                                               
                                                        'wo_hour_cat_id'=> 
$this->wo_hour_cat_id
-                                                                               
                                                )
-                                                                               
));
-                                       }
-                               }
-                       }
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
isset($uicols['formatter'][$i]) && $uicols['formatter'][$i] ? 
$uicols['formatter'][$i] : '""';//($uicols['formatter'][$i]==''?  '""' : 
$uicols['formatter'][$i]);
 
-                       if(!$lookup)
+                                       
$datatable['headers']['header'][$i]['className']                = 
isset($uicols['classname'][$i]) && $uicols['classname'][$i] ? 
$uicols['classname'][$i] : '';
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       if($uicols['name'][$i]=='project_id' || 
$uicols['name'][$i]=='address' || $uicols['name'][$i]=='project_group')
                        {
-                               if($this->acl_read)
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']   = $uicols['name'][$i];
+                                       }
+                                       if($uicols['name'][$i]=='loc1')
                                {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('view');
-                                       $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'location_code';
                                }
-                               if($this->acl_edit)
-                               {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('edit');
-                                       $i++;
-                               }
-                               if($this->acl_delete)
-                               {
-                                       $table_header[$i]['width']              
        = '5%';
-                                       $table_header[$i]['align']              
        = 'center';
-                                       $table_header[$i]['header']             
        = lang('delete');
-                                       $i++;
-                               }
                        }
                        else
                        {
-                               $table_header[$i]['width']              = '5%';
-                               $table_header[$i]['align']              = 
'center';
-                               $table_header[$i]['header']             = 
lang('select');
+                                       
$datatable['headers']['header'][$i]['formatter']                = '""';
+                                       
$datatable['headers']['header'][$i]['className']                = '';
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = '';
+                               }
                        }
 
-//_debug_array($content);
-                       if($this->acl_add)
+                       $function_exchange_values = '';
+                       if($lookup)
                        {
-                               $table_add[] = array
+                               $lookup_target = array
                                (
-                                       'lang_add'                      => 
lang('add'),
-                                       'lang_add_statustext'           => 
lang('add a project'),
-                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit'))
+                                       'menuaction'            => 
'property.ui'.$from.'.edit',
+                                       'origin'                        => 
phpgw::get_var('origin'),
+                                       'origin_id'                     => 
phpgw::get_var('origin_id')
                                );
-                       }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uiproject.index',
-                                               'sort'                  
=>$this->sort,
-                                               'order'                 
=>$this->order,
-                                               'cat_id'                
=>$this->cat_id,
-                                               'district_id'           
=>$this->district_id,
-                                               'filter'                
=>$this->filter,
-                                               'status_id'             
=>$this->status_id,
-                                               'lookup'                
=>$lookup,
-                                               'from'                  =>$from,
-                                               'query'                 
=>$this->query,
-                                               'start_date'            
=>$start_date,
-                                               'end_date'              
=>$end_date,
-                                               'wo_hour_cat_id'        
=>$this->wo_hour_cat_id,
-                       );
+                               for ($i=0;$i<$count_uicols_name;$i++)
+                               {
+                                       if($uicols['name'][$i]=='project_id')
+                                       {
+                                               $function_exchange_values .= 
"var code_project = data.getData('".$uicols["name"][$i]."');"."\r\n";
+                                               $function_exchange_values .= 
"valida('".$GLOBALS['phpgw']->link('/index.php',$lookup_target)."', 
code_project);";
+                                               $function_detail .= "var 
url=data+'&project_id='+param;"."\r\n";
+                                               $function_detail .= 
"window.open(url,'_self');";
+
+                                       }
+                               }
+                               $datatable['exchange_values'] = 
$function_exchange_values;
+                               $datatable['valida'] = $function_detail;
+                       }
 
                        $link_date_search = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.date_search'));
 
@@ -374,80 +662,131 @@
                                                'start_date'            
=>$start_date,
                                                'end_date'              
=>$end_date,
                                                'start'                 
=>$this->start,
-                                               'wo_hour_cat_id'        
=>$this->wo_hour_cat_id,
+                                               'wo_hour_cat_id'        
=>$this->wo_hour_cat_id
                        );
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_download'                 => 'download',
-                               'link_download'                 => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'            => 
lang('Download table to your browser'),
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($project_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                               'start_date'                    =>$start_date,
-                               'end_date'                      =>$end_date,
-                               'lang_none'                     =>lang('None'),
-                               'lang_date_search'              => lang('Date 
search'),
-                               'lang_date_search_help'         => lang('Narrow 
the search by dates'),
-                               'link_date_search'              => 
$link_date_search,
+                       $appname        = lang('Project');
+                       $function_msg   = lang('list Project');
 
-                               'lang_select'                   => 
lang('select'),
-                               'lookup_action'                 => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit')),
-                               'lookup'                        => $lookup,
-                               'allow_allrows'                 => false,
-                               'start_record'                  => $this->start,
-                               'record_limit'                  => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                   => 
count($project_list),
-                               'all_records'                   => 
$this->bo->total_records,
-                               'link_url'                      => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                      => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                   => lang('no 
category'),
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'project_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
 
-                               'cat_filter'                    => 
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data)),
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
 
-                               'district_list'                 => 
$this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'              => lang('no 
district'),
-                               'lang_district_statustext'      => lang('Select 
the district the selection belongs to. To do not use a district select NO 
DISTRICT'),
-                               'select_district_name'          => 
'district_id',
-                               'select_action'                 => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && isset($column['java_link']) && 
$column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' title='{$column['statustext']}'>" 
.$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+               
+                               /*
+                               * FIXME:
+                               * Temporary fix to avoid doubled get of first 
page in table all the way from the database - saves about a second
+                               * Should be fixed in the js if possible.
+                               */
+                               $json_get = 
phpgwapi_cache::session_get('property', 'project_index_json_get');
+                               if(!$json_get)
+                               {
+                                               
phpgwapi_cache::session_set('property', 'project_index_json',$json);
+                                               
phpgwapi_cache::session_set('property', 'project_index_json_get', 1);
+                               }
 
-                               'lang_status_statustext'        => lang('Select 
the status the agreement belongs to. To do not use a category select NO 
STATUS'),
-                               'status_name'                   => 'status_id',
-                               'lang_no_status'                => lang('No 
status'),
-                               'status_list'                   => 
$this->bo->select_status_list('filter',$this->status_id),
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
 
-                               'lang_wo_hour_cat_statustext'   => lang('Select 
the workorder hour category'),
-                               'lang_no_wo_hour_cat'           => lang('no 
hour category'),
-                               'wo_hour_cat_list'              => 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id')),
-
-                               'lang_user_statustext'          => lang('Select 
the user the project belongs to. To do not use a category select NO USER'),
-                               'select_user_name'              => 'filter',
-                               'lang_no_user'                  => lang('No 
user'),
-                               'user_list'                     => 
$this->bocommon->get_user_list_right2('filter',2,$this->filter,$this->acl_location),
-
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                         => $this->query,
-                               'lang_search'                   => 
lang('search'),
-                               'table_header'                  => 
$table_header,
-                               'values'                        => 
(isset($content)?$content:''),
-                               'table_add'                     => $table_add
-                       );
-
-                       $appname        = lang('Project');
-                       $function_msg   = lang('list Project');
-
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_project' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'project.index', 'property' );
                        $this->save_sessiondata();
                }
 
                function date_search()
                {
+                       //cramirez: necesary for windows.open . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('date_search'));
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
                //      $GLOBALS['phpgw_info']['flags']['nonavbar'] = true;
@@ -491,20 +830,35 @@
 
                function edit()
                {
+                       $id = phpgw::get_var('id', 'int');
+
                        if(!$this->acl_add && !$this->acl_edit)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiproject.view', 'id'=> $id));
                        }
-                       $id                             = phpgw::get_var('id', 
'int');
+
                        $values                         = 
phpgw::get_var('values');
+                       $values_attribute                       = 
phpgw::get_var('values_attribute');
                        $add_request                    = 
phpgw::get_var('add_request');
+                       $values['project_group']        = 
phpgw::get_var('project_group');
+                       $values['ecodimb']                      = 
phpgw::get_var('ecodimb');
+                       $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int', 'POST');
+                       $values['b_account_name']       = 
phpgw::get_var('b_account_name', 'string', 'POST');
+                       $values['contact_id']           = 
phpgw::get_var('contact', 'int', 'POST');
+                       $auto_create                            = false;
+
+                       $datatable = array();
 
-                       $config                         = 
CreateObject('phpgwapi.config');
+                       /*$datatable['config']['base_java_url'] = 
"menuaction:'property.uiproject.edit',"
+                                                                               
                ."id:'{$id}'";*/
+
+                       $config                         = 
CreateObject('phpgwapi.config','property');
                        $bolocation                     = 
CreateObject('property.bolocation');
 
                        $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
-                       $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
 
+                       $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",'property');
+
                        if(isset($insert_record_entity) && 
is_array($insert_record_entity))
                        {
                                for ($j=0;$j<count($insert_record_entity);$j++)
@@ -513,7 +867,8 @@
                                }
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
+                       
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('project','attributes_form'));
 
                        $bypass = phpgw::get_var('bypass', 'bool');
 
@@ -546,13 +901,25 @@
                                        $boticket= 
CreateObject('property.botts');
                                        $ticket = 
$boticket->read_single($origin_id);
                                        $values['descr'] = $ticket['details'];
-                                       $values['name'] = $ticket['subject'];
+                                       $values['name'] = $ticket['subject'] ? 
$ticket['subject'] : $ticket['category_name'];
                                        $ticket_notes = 
$boticket->read_additional_notes($origin_id);
                                        $i = count($ticket_notes)-1;
                                        
if(isset($ticket_notes[$i]['value_note']) && $ticket_notes[$i]['value_note'])
                                        {
                                                $values['descr'] .= ": " . 
$ticket_notes[$i]['value_note'];
                                        }
+                                       $values['contact_id'] = 
$ticket['contact_id'];
+                                       $tts_status_create_project      = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_create_project'])
 ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_create_project']
 : '';
+                                       if($tts_status_create_project)
+                                       {
+                                               
$boticket->update_status(array('status' => $tts_status_create_project), 
$origin_id);
+                                       }
+                                       
+                                       if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['auto_create_project_from_ticket'])
+                                               && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['auto_create_project_from_ticket']
 == 'yes')
+                                       {
+                                               $auto_create = true;
+                                       }
                                }
 
                                if($p_entity_id && $p_cat_id)
@@ -594,11 +961,16 @@
                                        );
                        }
 
-                       $config->read_repository();
+                       $config->read();
 
                        $save='';
                        if (isset($values['save']))
                        {
+                               if($GLOBALS['phpgw']->session->is_repost())
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+                               }
+
                                $save=true;
 
                                if(!isset($values['location']))
@@ -609,8 +981,8 @@
 
                                if(!isset($values['end_date']) || 
!$values['end_date'])
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select an end date!'));
-                                       $error_id=true;
+//                                     
$receipt['error'][]=array('msg'=>lang('Please select an end date!'));
+//                                     $error_id=true;
                                }
 
                                if(!$values['name'])
@@ -649,45 +1021,50 @@
                                        $error_id=true;
                                }
 
+                               if(isset($values_attribute) && 
is_array($values_attribute))
+                               {
+                                       foreach ($values_attribute as 
$attribute )
+                                       {
+                                               if($attribute['nullable'] != 1 
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                               }
+                                       }
+                               }
+
 
                                if($id)
                                {
-                                       $values['project_id']=$id;
+                                       $values['id'] = $id;
                                        $action='edit';
                                }
 
                                if(!$receipt['error'])
                                {
-                                       if(!$id)
-                                       {
-                                               
$values['project_id']=$this->bo->next_project_id();
-                                               $id     = $values['project_id'];
-                                       }
 
                                        if($values['copy_project'])
                                        {
                                                $action='add';
-                                               $values['project_id']   = 
$this->bo->next_project_id();
-                                               $id     = $values['project_id'];
                                        }
-                                       $receipt = 
$this->bo->save($values,$action);
-                                       if($receipt['error'])
+
+                                       $receipt = 
$this->bo->save($values,$action,$values_attribute);
+
+                                       if (! $receipt['error'])
                                        {
-                                               unset($id);
-                                               unset($values['project_id']);
+                                               $id = $receipt['id'];
                                        }
 
                                        if ( 
isset($GLOBALS['phpgw_info']['server']['smtp_server']) 
                                                && 
$GLOBALS['phpgw_info']['server']['smtp_server']
-                                               && 
$config->config_data['mailnotification'] )
+                                               && 
$config->config_data['project_approval'] )
                                        {
                                                if 
(!is_object($GLOBALS['phpgw']->send))
                                                {
                                                        $GLOBALS['phpgw']->send 
= CreateObject('phpgwapi.send');
                                                }
 
-                                               if ($values['approval'] && 
$values['mail_address'])
-                                               {
+
+                                               $action_params['responsible'] = 
$_account_id;
                                                        
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
                                                        
$from_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
                                                        $headers = 
"Return-Path: <". $from_email .">\r\n";
@@ -696,28 +1073,50 @@
                                                        $headers .= 
"Content-type: text/html; charset=iso-8859-1\r\n";
                                                        $headers .= 
"MIME-Version: 1.0\r\n";
 
-                                                       $subject = 
lang(Approval).": ". $values['project_id'];
-                                                       $message = '<a href 
="http://' . $GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit','id'=> $values['project_id'])).'">' . lang(Project) . 
" " . $values['project_id'] ." ". lang('needs approval') .'</a>';
+                                               $subject = lang(Approval).": ". 
$id;
+                                               $message = '<a href ="http://' 
. $GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit','id'=> $id)).'">' . lang('project %1 needs 
approval',$id) .'</a>';
 
-                                                       $bcc = $from_email;
+                                               $bcc = '';//$from_email;
 
-                                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email',$values['mail_address'], $subject, 
stripslashes($message), '', $cc, $bcc, $from_email, $from_name, 'html');
+                                               $action_params = array
+                                               (
+                                                       'appname'               
        => 'property',
+                                                       'location'              
        => '.project',
+                                                       'id'                    
        => $id,
+                                                       'responsible'           
=> '',
+                                                       'responsible_type'  => 
'user',
+                                                       'action'                
        => 'approval',
+                                                       'remark'                
        => '',
+                                                       'deadline'              
        => ''
+                                               );
 
+                                               if 
(isset($values['mail_address']) && is_array($values['mail_address']))
+                                               {
+                                                       foreach 
($values['mail_address'] as $_account_id => $_address)
+                                                       {
+                                                               
if(isset($values['approval'][$_account_id]) && 
$values['approval'][$_account_id])
+                                                               {
+                                                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email',$_address, $subject, 
stripslashes($message), '', $cc, $bcc, $from_email, $from_name, 'html');
+                                                                       
$action_params['responsible'] = $_account_id;
+                                                                       
execMethod('property.sopending_action.set_pending_action', $action_params);
                                                        if(!$rcpt)
                                                        {
-                                                               
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '" . 
$values['mail_address'] . "', subject='$subject' failed !!!");
+                                                                               
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '" . 
$_address . "', subject='$subject' failed !!!");
                                                                
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
                                                                
$bypass_error=true;
                                                        }
                                                        else
                                                        {
-                                                               
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',$values['mail_address']));
+                                                                               
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
+                                                                       }
+                                                               }
                                                        }
                                                }
 
-                                               if 
(isset($receipt['notice_owner']) AND is_array($receipt['notice_owner']))
+                                               if 
(isset($receipt['notice_owner']) && is_array($receipt['notice_owner']) 
+                                                && 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner']
 == 1)
                                                {
-                                                       
if($this->account!=$values['coordinator'] && 
$config->config_data['workorder_approval'])
+                                                       
if($this->account!=$values['coordinator'] && 
$config->config_data['mailnotification'])
                                                        {
                                                                
$prefs_coordinator = 
$this->bocommon->create_preferences('property',$values['coordinator']);
                                                                $to = 
$prefs_coordinator['email'];
@@ -725,7 +1124,7 @@
                                                                
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
                                                                
$from_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
 
-                                                               $body = '<a 
href ="http://' . $GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit', 'id'=> $values['project_id'])).'">' . lang('project 
%1 has been edited',$id) .'</a>' . "\n";
+                                                               $body = '<a 
href ="http://' . $GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit', 'id'=> $id)).'">' . lang('project %1 has been 
edited',$id) .'</a>' . "\n";
                                                                
foreach($receipt['notice_owner'] as $notice)
                                                                {
                                                                        $body 
.= $notice . "\n";
@@ -772,7 +1171,8 @@
                                }
                        }
 
-                       $record_history = '';
+                       //$record_history = '';
+                       $record_history = array();
                        if(isset($bypass_error) || ((!isset($receipt['error']) 
|| $add_request) && !$bypass) && $id)
                        {
                                $values = $this->bo->read_single($id);
@@ -799,6 +1199,12 @@
                                }
                        }
 
+                       /* Preserve attribute values from post */
+                       if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
+                       {
+                               $values = 
$this->bocommon->preserve_attribute_values($values,$values_attribute);
+                       }
+
                        $table_header_history[] = array
                        (
                                'lang_date'             => lang('Date'),
@@ -823,8 +1229,45 @@
                        else
                        {
                                $function_msg = lang('Add Project');
+                               $values = $this->bo->read_single(0, $values);
+                       }
+
+                       $tabs = array();
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
+                       {
+                               foreach ($values['attributes'] as & $attribute)
+                               {
+                                       if($attribute['history'] == true)
+                                       {
+                                               $link_history_data = array
+                                               (
+                                                       'menuaction'    => 
'property.uiproject.attrib_history',
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'id'            => $id,
+                                                       'edit'          => true
+                                               );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
+                               }
+
+                               $attributes_groups = 
$this->custom->get_attribute_groups('property', $this->acl_location, 
$values['attributes']);
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $tabs[str_replace(' ', '_', 
$group['name'])] = array('label' => $group['name'], 'link' => '#' . 
str_replace(' ', '_', $group['name']));
+                                               $group['link'] = str_replace(' 
', '_', $group['name']);
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($values['attributes']);
                        }
 
+
                        if (isset($values['cat_id']))
                        {
                                $this->cat_id = $values['cat_id'];
@@ -843,6 +1286,30 @@
                                                'entity_data'   => 
(isset($values['p'])?$values['p']:'')
                                                ));
 
+                       $b_account_data = array();
+                       $ecodimb_data = array();
+
+                       if(isset($config->config_data['budget_at_project']) && 
$config->config_data['budget_at_project'])
+                       {
+                               
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+                                               'b_account_id'          => 
$values['b_account_id'],
+                                               'b_account_name'        => 
$values['b_account_name']));
+
+
+
+                               
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array(
+                                               'ecodimb'                       
=> $values['ecodimb'],
+                                               'ecodimb_descr'         => 
$values['ecodimb_descr']));
+                       }
+
+
+                       
$contact_data=$this->bocommon->initiate_ui_contact_lookup(array(
+                                               'contact_id'            => 
$values['contact_id'],
+                                               'contact_name'          => 
$values['contact_name'],
+                                               'field'                         
=> 'contact',
+                                               'type'                          
=> 'form'));
+
+
                        if(isset($values['contact_phone']))
                        {
                                for 
($i=0;$i<count($location_data['location']);$i++)
@@ -864,12 +1331,45 @@
                        (
                                'menuaction'    => 'property.uirequest.index',
                                'query'         => 
(isset($values['location_data']['loc1'])?$values['location_data']['loc1']:''),
-                               'project_id'    => 
(isset($values['project_id'])?$values['project_id']:'')
+                               'project_id'    => (isset($id)?$id:'')
                        );
 
-                       $supervisor_id= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from']:'');
-                       $need_approval = 
(isset($config->config_data['workorder_approval'])?$config->config_data['workorder_approval']:'');
+                       $supervisor_id = 0;
 
+                       if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
+                               && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'] )
+                       {
+                               $supervisor_id = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'];
+                       }
+
+                       $need_approval = 
isset($config->config_data['project_approval'])?$config->config_data['project_approval']:'';
+                       $supervisor_email = array();
+                       if ($supervisor_id && $need_approval)
+                       {
+                               $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
+                               $supervisor_email[] = array
+                               (
+                                       'id'      => $supervisor_id,
+                                       'address' => $prefs['email'],
+                               );
+                               if ( isset($prefs['approval_from']) )
+                               {
+                                       $prefs2 = 
$this->bocommon->create_preferences('property', $prefs['approval_from']);
+
+                                       if(isset($prefs2['email']))
+                                       {
+                                               $supervisor_email[] = array
+                                               (
+                                                       'id'      => 
$prefs['approval_from'],
+                                                       'address' => 
$prefs2['email'],
+                                               );
+                                               $supervisor_email = 
array_reverse($supervisor_email);
+                                       }
+                                       unset($prefs2);
+                               }
+                               unset($prefs);
+                       }
+
                        
$project_status=(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['project_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['project_status']:'');
                        
$project_category=(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['project_category'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['project_category']:'');
                        if(!isset($values['status']))
@@ -887,12 +1387,6 @@
                                $values['coordinator']=$this->account;
                        }
 
-                       if ($supervisor_id && $need_approval=='yes')
-                       {
-                               $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
-                               $supervisor_email = $prefs['email'];
-                       }
-
                        if(!isset($values['start_date']) || 
!$values['start_date'])
                        {
                                $values['start_date'] = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
@@ -916,76 +1410,136 @@
                                $values['sum'] = $values['sum'] + 
$values['reserve'];
                        }
 
+                       $value_remainder = $values['sum'];
+                       if(isset($values['sum_workorder_actual_cost']))
+                       {
+                               $value_remainder = $values['sum'] - 
$values['sum_workorder_actual_cost'];
+                       }
+                       $values['sum']  = number_format($values['sum'], 0, ',', 
' ');
+                       $value_remainder = number_format($value_remainder, 0, 
',', ' ');
+                       $values['planned_cost']  = 
number_format($values['planned_cost'], 0, ',', ' ');
+
                        $jscal = CreateObject('phpgwapi.jscalendar');
                        $jscal->add_listener('values_start_date');
                        $jscal->add_listener('values_end_date');
 
-                       $data = array
+                       
$project_group_data=$this->bocommon->initiate_project_group_lookup(array(
+                                               'project_group'                 
=> $values['project_group'],
+                                               'project_group_descr'   => 
$values['project_group_descr']));
+                       
+
+                       //---datatable 
settings---------------------------------------------------      
+                       
+                       $datavalues[0] = array
                        (
-                               'tabs'                                          
        => self::_generate_tabs(),
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($values['workorder_budget']),
+                                       'total_records'                 => 
count($values['workorder_budget']),
+                                       'edit_action'                   => 
json_encode($GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit'))),
+                                       'is_paginator'                  => 1,
+                                       'footer'                                
=> 0
+                       );
 
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
 
-                               'value_origin'                                  
=> isset($values['origin']) ? $values['origin'] : '',
-                               'value_origin_type'                             
=> (isset($origin)?$origin:''),
-                               'value_origin_id'                               
=> (isset($origin_id)?$origin_id:''),
-               //              'selected_request'                              
=> (isset($selected_request)?$selected_request:''),
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array(key => 
workorder_id,label=>lang('Workorder'),sortable=>true,resizeable=>true,formatter=>'YAHOO.widget.DataTable.formatLink'),
+                                                                               
                array(key => 
budget,label=>lang('Budget'),sortable=>true,resizeable=>true,formatter=>FormatterRight),
+                                                                               
                array(key => 
calculation,label=>lang('Calculation'),sortable=>true,resizeable=>true,formatter=>FormatterRight),
+                                                                               
                array(key => actual_cost,label=>lang('actual 
cost'),sortable=>true,resizeable=>true,formatter=>FormatterRight),
+                                                                       //      
        array(key => charge_tenant,label=>lang('charge 
tenant'),sortable=>true,resizeable=>true),
+                                                                               
        array(key => 
vendor_name,label=>lang('Vendor'),sortable=>true,resizeable=>true),
+                                                                               
        array(key => 
status,label=>lang('Status'),sortable=>true,resizeable=>true)))
+                       );
+
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($record_history),
+                                       'total_records'                 => 
count($record_history),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
 
+
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      json_encode(array(      
array(key => value_date,label=>lang('Date'),sortable=>true,resizeable=>true),
+                                                                               
                array(key => 
value_user,label=>lang('User'),Action=>true,resizeable=>true),
+                                                                               
                array(key => 
value_action,label=>lang('action'),sortable=>true,resizeable=>true),
+                                                                               
                array(key => value_old_value,label=>lang('old value'),  
sortable=>true,resizeable=>true),
+                                                                               
        array(key => value_new_value,label=>lang('new 
value'),sortable=>true,resizeable=>true)))
+                       );
+
+                       
//----------------------------------------------datatable settings--------
+
+
+
+                       $suppresscoordination                   = 
isset($config->config_data['project_suppresscoordination']) && 
$config->config_data['project_suppresscoordination'] ? 1 : '';
+
+                       $data = array
+                       (
+                               'suppressmeter'                                 
        => isset($config->config_data['project_suppressmeter']) && 
$config->config_data['project_suppressmeter'] ? 1 : '',
+                               'suppresscoordination'                          
=> $suppresscoordination,
+                               'attributes_group'                              
        => $attributes,
+                               'lookup_functions'                              
        => isset($values['lookup_functions'])?$values['lookup_functions']:'',
+                               'b_account_data'                                
        => $b_account_data,
+                               'ecodimb_data'                                  
        => $ecodimb_data,
+                               'contact_data'                                  
        => $contact_data,
+                               'property_js'                                   
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
                => $datavalues,
+                               'myColumnDefs'                                  
        => $myColumnDefs,
+                               'tabs'                                          
                => self::_generate_tabs($tabs,array('coordination' => 
$suppresscoordination)),
+                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'value_origin'                                  
        => isset($values['origin']) ? $values['origin'] : '',
+                               'value_origin_type'                             
        => isset($origin)?$origin:'',
+                               'value_origin_id'                               
        => isset($origin_id)?$origin_id:'',
                                'lang_select_request'                           
=> lang('Select request'),
                                'lang_select_request_statustext'                
=> lang('Add request for this project'),
                                'lang_request_statustext'                       
=> lang('Link to the request for this project'),
                                'lang_delete_request_statustext'                
=> lang('Check to delete this request from this project'),
                                'link_select_request'                           
=> $GLOBALS['phpgw']->link('/index.php',$link_request_data),
                                'link_request'                                  
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.view')),
-
                                'add_workorder_action'                          
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit')),
                                'lang_add_workorder'                            
=> lang('Add workorder'),
                                'lang_add_workorder_statustext'                 
=> lang('Add a workorder to this project'),
-
-                               'table_header_workorder_budget'                 
=> $table_header_workorder_budget,
                                'lang_no_workorders'                            
=> lang('No workorder budget'),
                                'workorder_link'                                
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit')),
                                'record_history'                                
=> $record_history,
                                'table_header_history'                          
=> $table_header_history,
                                'lang_history'                                  
=> lang('History'),
                                'lang_no_history'                               
=> lang('No history'),
-
                                'img_cal'                                       
        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
                                'lang_datetitle'                                
=> lang('Select date'),
-
                                'lang_start_date_statustext'                    
=> lang('Select the estimated end date for the Project'),
                                'lang_start_date'                               
=> lang('Project start date'),
                                'value_start_date'                              
=> $values['start_date'],
-
                                'lang_end_date_statustext'                      
=> lang('Select the estimated end date for the Project'),
                                'lang_end_date'                                 
=> lang('Project end date'),
                                'value_end_date'                                
=> isset($values['end_date']) ? $values['end_date'] : '' ,
-
                                'lang_copy_project'                             
=> lang('Copy project ?'),
                                'lang_copy_project_statustext'                  
=> lang('Choose Copy Project to copy this project to a new project'),
-
                                'lang_charge_tenant'                            
=> lang('Charge tenant'),
                                'lang_charge_tenant_statustext'                 
=> lang('Choose charge tenant if the tenant i to pay for this project'),
-                               'charge_tenant'                                 
=> (isset($values['charge_tenant'])?$values['charge_tenant']:''),
-
+                               'charge_tenant'                                 
        => isset($values['charge_tenant'])?$values['charge_tenant']:'',
                                'lang_power_meter'                              
=> lang('Power meter'),
                                'lang_power_meter_statustext'                   
=> lang('Enter the power meter'),
-                               'value_power_meter'                             
=> (isset($values['power_meter'])?$values['power_meter']:''),
-
+                               'value_power_meter'                             
        => isset($values['power_meter'])?$values['power_meter']:'',
                                'lang_budget'                                   
=> lang('Budget'),
-                               'value_budget'                                  
=> (isset($values['budget'])?$values['budget']:''),
+                               'value_budget'                                  
        => isset($values['budget'])?$values['budget']:'',
                                'lang_budget_statustext'                        
=> lang('Enter the budget'),
-
                                'lang_reserve'                                  
=> lang('reserve'),
-                               'value_reserve'                                 
=> (isset($values['reserve'])?$values['reserve']:''),
+                               'value_reserve'                                 
        => isset($values['reserve'])?$values['reserve']:'',
                                'lang_reserve_statustext'                       
=> lang('Enter the reserve'),
-
-                               'value_sum'                                     
        => (isset($values['sum'])?$values['sum']:''),
-
+                               'value_sum'                                     
                => isset($values['sum'])?$values['sum']:'',
                                'lang_reserve_remainder'                        
=> lang('reserve remainder'),
-                               'value_reserve_remainder'                       
=> (isset($reserve_remainder)?$reserve_remainder:''),
-                               'value_reserve_remainder_percent'               
=> (isset($remainder_percent)?$remainder_percent:''),
-
+                               'value_reserve_remainder'                       
=> isset($reserve_remainder)?$reserve_remainder:'',
+                               'value_reserve_remainder_percent'       => 
isset($remainder_percent)?$remainder_percent:'',
+                               'lang_planned_cost'                             
        => lang('planned cost'),
+                               'value_planned_cost'                            
=> $values['planned_cost'],
                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'form',
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
@@ -995,41 +1549,39 @@
                                'lang_save'                                     
=> lang('save'),
                                'lang_done'                                     
=> lang('done'),
                                'lang_name'                                     
=> lang('Name'),
-
                                'lang_project_id'                               
=> lang('Project ID'),
-                               'value_project_id'                              
=> (isset($values['project_id'])?$values['project_id']:''),
-                               'value_name'                                    
=> (isset($values['name'])?$values['name']:''),
+                               'value_project_id'                              
        => isset($id)?$id:'',
+                               'project_group_data'                            
=> $project_group_data,
+                               'value_name'                                    
        => isset($values['name'])?$values['name']:'',
                                'lang_name_statustext'                          
=> lang('Enter Project Name'),
-
                                'lang_other_branch'                             
=> lang('Other branch'),
                                'lang_other_branch_statustext'                  
=> lang('Enter other branch if not found in the list'),
-                               'value_other_branch'                            
=> (isset($values['other_branch'])?$values['other_branch']:''),
-
+                               'value_other_branch'                            
=> isset($values['other_branch'])?$values['other_branch']:'',
                                'lang_descr_statustext'                         
=> lang('Enter a description of the project'),
                                'lang_descr'                                    
=> lang('Description'),
-                               'value_descr'                                   
=> (isset($values['descr'])?$values['descr']:''),
-
+                               'value_descr'                                   
        => isset($values['descr'])?$values['descr']:'',
                                'lang_remark_statustext'                        
=> lang('Enter a remark to add to the history of the project'),
                                'lang_remark'                                   
=> lang('remark'),
-                               'value_remark'                                  
=> (isset($values['remark'])?$values['remark']:''),
+                               'value_remark'                                  
        => isset($values['remark'])?$values['remark']:'',
                                'lang_done_statustext'                          
=> lang('Back to the list'),
                                'lang_save_statustext'                          
=> lang('Save the project'),
                                'lang_no_cat'                                   
=> lang('Select category'),
-                               'value_cat_id'                                  
=> (isset($values['cat_id'])?$values['cat_id']:''),
-                               'cat_select'                            => 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
+                               'value_cat_id'                                  
        => isset($values['cat_id'])?$values['cat_id']:'',
+                               'cat_select'                                    
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'])),
                                'lang_workorder_id'                             
=> lang('Workorder ID'),
-                               'sum_workorder_budget'                          
=> (isset($values['sum_workorder_budget'])?$values['sum_workorder_budget']:''),
-                               'sum_workorder_calculation'                     
=> 
(isset($values['sum_workorder_calculation'])?$values['sum_workorder_calculation']:''),
-                               'workorder_budget'                              
=> (isset($values['workorder_budget'])?$values['workorder_budget']:''),
-                               'sum_workorder_actual_cost'                     
=> 
(isset($values['sum_workorder_actual_cost'])?$values['sum_workorder_actual_cost']:''),
-                               'lang_actual_cost'                              
=> lang('Actual cost'),
-                               'lang_coordinator'                              
=> lang('Coordinator'),
+                               //'sum_workorder_budget'                        
        => 
isset($values['sum_workorder_budget'])?$values['sum_workorder_budget']:'',
+                               //'sum_workorder_calculation'                   
=> 
isset($values['sum_workorder_calculation'])?$values['sum_workorder_calculation']:'',
+                               //'workorder_budget'                            
        => isset($values['workorder_budget'])?$values['workorder_budget']:'',
+                               //'sum_workorder_actual_cost'                   
=> 
isset($values['sum_workorder_actual_cost'])?$values['sum_workorder_actual_cost']:'',
                                'lang_sum'                                      
=> lang('Sum'),
+                               //'lang_actual_cost'                            
        => lang('Actual cost'),
+                               'value_remainder'                               
        => $value_remainder,
+                               'lang_remainder'                                
        => lang('remainder'),
+                               'lang_coordinator'                              
        => lang('Coordinator'),
                                'lang_user_statustext'                          
=> lang('Select the coordinator the project belongs to. To do not use a 
category select NO USER'),
                                'select_user_name'                              
=> 'values[coordinator]',
                                'lang_no_user'                                  
=> lang('Select coordinator'),
                                'user_list'                                     
=> 
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl_location),
-
                                'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
                                'status_name'                                   
=> 'values[status]',
                                'lang_no_status'                                
=> lang('Select status'),
@@ -1037,11 +1589,9 @@
                                'lang_status_statustext'                        
=> lang('What is the current status of this project ?'),
                                'lang_confirm_status'                           
=> lang('Confirm status'),
                                'lang_confirm_statustext'                       
=> lang('Confirm status to the history'),
-
-                               'branch_list'                                   
=> 
$this->bo->select_branch_p_list((isset($values['project_id'])?$values['project_id']:'')),
+                               'branch_list'                                   
        => $this->bo->select_branch_p_list((isset($id)?$id:'')),
                                'lang_branch'                                   
=> lang('branch'),
                                'lang_branch_statustext'                        
=> lang('Select the branches for this project'),
-
                                'key_responsible_list'                          
=> 
$this->bo->select_branch_list((isset($values['key_responsible'])?$values['key_responsible']:'')),
                                'lang_no_key_responsible'                       
=> lang('Select key responsible'),
                                'lang_key_responsible'                          
=> lang('key responsible'),
@@ -1057,17 +1607,67 @@
                                'lang_key_deliver'                              
=> lang('key deliver location'),
                                'lang_key_deliver_statustext'                   
=> lang('Select where to deliver the key'),
 
-                               'need_approval'                                 
=> (isset($need_approval)?$need_approval:''),
+                               'need_approval'                                 
        => $need_approval,
                                'lang_ask_approval'                             
=> lang('Ask for approval'),
                                'lang_ask_approval_statustext'                  
=> lang('Check this to send a mail to your supervisor for approval'),
-                               'value_approval_mail_address'                   
=> (isset($supervisor_email)?$supervisor_email:''),
+                               'value_approval_mail_address'           => 
$supervisor_email,
 
                                'currency'                                      
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
                        );
+                       //_debug_array($data);die;
+
+                       if( $auto_create )
+                       {
+                               $location= explode('-', 
$values['location_data']['location_code']);
 
+                               $level = count($location);
+                               for ($i = 1; $i < $level+1; $i++)
+                               {
+                                       $values['location']["loc$i"] = 
$location[($i-1)];
+                               }
+
+                               $values['street_name'] = 
$values['location_data']['street_name'];
+                               $values['street_number'] = 
$values['location_data']['street_number'];
+                               $values['location_name'] = 
$values['location_data']["loc{$level}_name"];
+                               $values['extra'] = $values['p'][0];
+
+                               unset($values['location_data']);
+                               unset($values['p']);
+
+                               $receipt = $this->bo->save($values, 'add', 
array());
+
+                               if (! $receipt['error'])
+                               {
+                                       $id = $receipt['id'];
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit', 'project_id'=> $id));
+                               }
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => 
$data));
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
                        $appname                = lang('project');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'project.edit', 'property' );
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
@@ -1079,20 +1679,19 @@
                        }
 
                        $project_id = phpgw::get_var('project_id', 'int');
-                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($project_id);
+                               return "project_id ".$project_id." ".lang("has 
been deleted");
+                       }
 
+                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
                        $link_data = array
                        (
                                'menuaction' => 'property.uiproject.index',
                                'project_id'    => $project_id
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               $this->bo->delete($project_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array
@@ -1191,12 +1790,24 @@
 
                        $categories = 
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id));
 
+                       $project_group_data = 
$this->bocommon->initiate_project_group_lookup(array(
+                                               'project_group'                 
=> $values['project_group'],
+                                               'project_group_descr'   => 
$values['project_group_descr'],
+                                               'type'                          
        => 'view'));
+
+                       $config                 = 
CreateObject('phpgwapi.config','property');
+                       $config->read();
+
+                       $suppresscoordination                   = 
isset($config->config_data['project_suppresscoordination']) && 
$config->config_data['project_suppresscoordination'] ? 1 : '';
                        $data = array
                        (
-                               'tabs'                                          
        => self::_generate_tabs(),
+                               'suppressmeter'                                 
=> isset($config->config_data['project_suppressmeter']) && 
$config->config_data['project_suppressmeter'] ? 1 : '',
+                               'suppresscoordination'                  => 
$suppresscoordination,
+                               'tabs'                                          
        => self::_generate_tabs(array(),array('coordination' => 
$suppresscoordination)),
 
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
 
+                               'project_group_data'            => 
$project_group_data,
                                'value_origin'                          => 
$values['origin'],
                        //      'value_origin_type'                     => 
$origin,
                        //      'value_origin_id'                       => 
$origin_id,
@@ -1299,7 +1910,7 @@
 
                }
 
-               protected function _generate_tabs()
+               protected function _generate_tabs($tabs_ = array(), $suppress = 
array())
                {
                        $tabs = array
                        (
@@ -1307,12 +1918,19 @@
                                'location'              => array('label' => 
lang('location'), 'link' => '#location'),
                                'budget'                => array('label' => 
lang('Time and budget'), 'link' => '#budget'),
                                'coordination'  => array('label' => 
lang('coordination'), 'link' => '#coordination'),
-                               'extra'                 => array('label' => 
lang('extra'), 'link' => '#extra'),
                                'history'               => array('label' => 
lang('history'), 'link' => '#history')
                        );
-
+                       $tabs = array_merge($tabs, $tabs_);
+                       foreach($suppress as $tab => $remove)
+                       {
+                               if($remove)
+                               {
+                                       unset($tabs[$tab]);
+                               }
+                       }
                        phpgwapi_yui::tabview_setup('project_tabview');
 
                        return  phpgwapi_yui::tabview_generate($tabs, 
'general');
                }
+
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.uir_agreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uir_agreement.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uir_agreement.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -32,6 +32,8 @@
         * @package property
         */
 
+       phpgw::import_class('phpgwapi.yui');
+
        class property_uir_agreement
        {
                var $grants;
@@ -124,7 +126,7 @@
                        {
 
                                
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-                               
$GLOBALS['phpgw']->preferences->read_repository();
+                               $GLOBALS['phpgw']->preferences->read();
                                
$GLOBALS['phpgw']->preferences->add('property','r_agreement_columns',$values['columns'],'user');
                                
$GLOBALS['phpgw']->preferences->save_repository();
 
@@ -487,6 +489,7 @@
                        $values         = phpgw::get_var('values');
                        $delete_item    = phpgw::get_var('delete_item', 'bool');
                        $item_id        = phpgw::get_var('item_id', 'int', 
'GET');
+                       $active_tab             = phpgw::get_var('tab', 
'string', 'REQUEST', 'general');
 
                        $config         = 
CreateObject('phpgwapi.config','property');
                        $boalarm                = 
CreateObject('property.boalarm');
@@ -805,34 +808,7 @@
                                                'account_id'=> $account_id
                                                ));
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
 
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true,link_data => array()));
@@ -865,7 +841,7 @@
                                'id'            =>$id
                        );
 
-                       $config->read_repository();
+                       $config->read();
                        $link_to_files = $config->config_data['files_url'];
 
                        $j      = count($r_agreement['files']);
@@ -884,6 +860,47 @@
                        
$GLOBALS['phpgw']->js->validate_file('core','check','property');
                        
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
 
+                       if (isset($r_agreement['attributes']) && 
is_array($r_agreement['attributes']))
+                       {
+
+               /*              foreach ($values['attributes'] as & $attribute)
+                               {
+                                       if($attribute['history'] == true)
+                                       {
+                                               $link_history_data = array
+                                               (
+                                                       'menuaction'    => 
'property.uis_agreement.attrib_history',
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'id'            => $id,
+                                                       'edit'          => true
+                                               );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
+                               }
+               */
+
+                               phpgwapi_yui::tabview_setup('edit_tabview');
+                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
+
+                               $location = $this->acl_location;
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $r_agreement['attributes']);
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($r_agreement['attributes']);
+                               
+                               $tabs['details']        = array('label' => 
lang('details'), 'link' => '#details');
+                       }
+
+
                        $data = array
                        (
 
@@ -926,17 +943,10 @@
                                'member_of_name'                                
=> 'member_id',
                                'member_of_list'                                
=> $member_of_data['cat_list'],
 
-                               'lang_dateformat'                               
=> lang(strtolower($dateformat)),
-                               'dateformat_validate'                   => 
$dateformat_validate,
-                               'onKeyUp'                                       
        => $onKeyUp,
-                               'onBlur'                                        
        => $onBlur,
-                               'lang_attributes'                               
=> lang('Attributes'),
-                               'attributes_header'                             
=> $attributes_header,
-                               'attributes_values'                             
=> $r_agreement['attributes'],
+                               'attributes_group'                              
=> $attributes,
                                'lookup_functions'                              
=> $r_agreement['lookup_functions'],
-                               'dateformat'                                    
=> $dateformat,
-
                                'img_cal'                                       
        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+
                                'lang_datetitle'                                
=> lang('Select date'),
 
                                'lang_start_date_statustext'    => lang('Select 
the estimated end date for the Project'),
@@ -977,13 +987,13 @@
                                'values_common'                                 
=> $content_common,
                                'table_header_common'                   => 
$table_header_common,
                                'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, $active_tab)                   
        
                        );
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('rental agreement') . ': ' . ($id?lang('edit') . ' ' . 
lang($this->role):lang('add') . ' ' . lang($this->role));
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
                function download()
@@ -1089,7 +1099,7 @@
                                }
                                elseif (!$values['save'] && !$values['apply'] 
&& !$values['update']):
                                {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uir_agreement.edit', 'id'=> $r_agreement_id));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uir_agreement.edit', 'id'=> $r_agreement_id, 'tab' => 'details'));
                                }
                                endif;
                        }
@@ -1108,34 +1118,6 @@
                        );
 
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
                        $jscal = CreateObject('phpgwapi.jscalendar');
                        $jscal->add_listener('values_start_date');
                        $jscal->add_listener('values_end_date');
@@ -1214,7 +1196,6 @@
                                                ));
 
                        
$GLOBALS['phpgw']->js->validate_file('core','check','property');
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
 
                        $data = array
                        (
@@ -1231,15 +1212,8 @@
                                'lang_cancel_statustext'                        
=> lang('Leave the rental agreement untouched and return back to the list'),
                                'lang_save_statustext'                          
=> lang('Save the rental agreement and return back to the list'),
 
-                               'lang_dateformat'                               
        => lang(strtolower($dateformat)),
-                               'dateformat_validate'                           
=> $dateformat_validate,
-                               'onKeyUp'                                       
                => $onKeyUp,
-                               'onBlur'                                        
                => $onBlur,
-                               'lang_attributes'                               
        => lang('Attributes'),
-                               'attributes_header'                             
        => $attributes_header,
                                'attributes_values'                             
        => $values['attributes'],
                                'lookup_functions'                              
        => $values['lookup_functions'],
-                               'dateformat'                                    
        => $dateformat,
 
                                'img_cal'                                       
                => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
                                'lang_datetitle'                                
        => lang('Select date'),
@@ -1506,7 +1480,7 @@
                        );
 
 
-                       $config->read_repository();
+                       $config->read();
                        $link_to_files = $config->config_data['files_url'];
 
                        $j      = count($r_agreement['files']);
@@ -1609,7 +1583,7 @@
                                                if ($values['save'])
                                                {
                                                        
$GLOBALS['phpgw']->session->appsession('session_data','r_agreement_receipt',$receipt);
-                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uir_agreement.edit', 'id'=> $r_agreement_id));
+                                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uir_agreement.edit', 'id'=> $r_agreement_id, 'tab' => 'details'));
                                                }
                                        }
                                }
@@ -1634,7 +1608,7 @@
                                }
                                elseif (!$values['save'] && !$values['apply'] 
&& !$values['update']):
                                {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uir_agreement.edit', 'id'=> $r_agreement_id));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uir_agreement.edit', 'id'=> $r_agreement_id, 'tab' => 'details'));
                                }
                                endif;
                        }

Modified: people/sigurdne/modules/property/trunk/inc/class.uirequest.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uirequest.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uirequest.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,9 +24,11 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage project
-       * @version $Id$
+       * @version $Id$
        */
 
+       phpgw::import_class('phpgwapi.yui');
+
        /**
         * Description
         * @package property
@@ -60,15 +62,13 @@
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::project::request';
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                               = 
CreateObject('property.borequest',true);
                        $this->boproject                        = 
CreateObject('property.boproject');
                        $this->bocommon                         = & 
$this->bo->bocommon;
                        $this->cats                                     = & 
$this->bo->cats;
                        $this->bolocation                       = 
CreateObject('property.bolocation');
-                       $this->config                           = 
CreateObject('phpgwapi.config');
+                       $this->config                           = 
CreateObject('phpgwapi.config','property');
 
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location                     = 
'.project.request';
@@ -134,9 +134,10 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('request','table_header',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
+                       $dry_run = false;
+
+                       $datatable = array();
+                       $values_combo_box = array();
 
                        $project_id = phpgw::get_var('project_id', 'int'); // 
lookup for maintenance planning
 
@@ -145,319 +146,505 @@
                                $lookup = true;
                        }
 
-                       $request_list = $this->bo->read(array('project_id' => 
1,'allrows'=>$this->allrows));
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                               if(!$lookup)
+                               {
+                                       $datatable['menu']      = 
$this->bocommon->get_menu();
+                               }
+
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uirequest.index',
+                                                                       
'lookup'    => $lookup,
+                                                                       
'cat_id'        => $this->cat_id,
+                                                                       
'filter'        => $this->filter,
+                                                                       
'status_id'     => $this->status_id,
+                                                                       
'project_id'    => $project_id,
+                                                                       'query' 
        => $this->query
+
+                                       ));
+                               $datatable['config']['allow_allrows'] = true;
 
-//_debug_array($request_list);
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uirequest.index',"
+
+                                                                               
                ."query:'{$this->query}',"
+                                                                               
."lookup:'{$lookup}',"
+                                                                               
                        ."project_id:'{$project_id}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."status_id:'{$this->status_id}',"
+                                                                               
."cat_id:'{$this->cat_id}'";
+
+                               $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bo->select_status_list('filter',$this->status_id);
+                               $default_value = array ('id'=>'','name'=> 
lang('no status'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $values_combo_box[2]  = 
$this->bocommon->get_user_list('filter',$this->filter,$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1);
+                               $default_value = array 
('user_id'=>'','name'=>lang('no user'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uirequest.index',
+                                                                       
'lookup'                        => $lookup,
+                                                                       
'cat_id'        => $this->cat_id,
+                                                                       
'filter'        => $this->filter,
+                                                                       
'status_id'     => $this->status_id,
+                                                                       
'project_id'    => $project_id,
+                                                                       'query' 
        => $this->query
+                                                               )
+                                                       ),
+                                               'fields'        => array(
+                                       'field' => array(
+                                                          array( //boton       
CATEGORY
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),
+                                                               array( //boton  
STATUS
+                                                                   'id' => 
'btn_status_id',
+                                                                   'name' => 
'status_id',
+                                                                   'value'     
=> lang('Status'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                               array( //boton  
FILTER
+                                                                   'id' => 
'btn_user_id',
+                                                                   'name' => 
'filter',
+                                                                   'value'     
=> lang('User'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_export',
+                                                                               
'value' => lang('download'),
+                                                                               
'tab_index' => 8
+                                                                           ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_update',
+                                                                               
'value' => lang('Update project'),
+                                                                               
'tab_index' => 7
+                                                                           ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 6
+                                                                           ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 5
+                                                               ),
+                                                                           
array( //hidden request
+                                                                               
        'type'  => 'hidden',
+                                                                               
        'id'    => 'myValuesForUpdatePHP',
+                                                                               
        'name'  => 'myValuesForUpdatePHP',
+                                                                               
        'value' => ''
+                                                                               
),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   //'value'   
 => '',//$query,
+                                                                   'value'    
=> phpgw::get_var('query'),
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                                               
                        array(
+                                                                               
                'type'=> 'link',
+                                                                               
                'id'  => 'btn_priority_key',
+                                                                               
                'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                       array(
+                                                                               
                           'menuaction' => 
'property.uirequest.priority_key'))."','','width=350,height=250')",
+                                                                               
                 'value' => lang('Priority key'),
+                                                                               
                 'tab_index' => 3
+                                                                               
            )
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id') 
//i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
              ),
+                                                                               
                                         array( //div values  combo_box_2
+                                                                               
                    'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2], 'user_id')
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
 
+                               if(!$this->acl_manage)
+                               {
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][9]);
+                               }
+
+                               if(!$this->acl_add)
+                               {
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][5]);
+                               }
+
+                               if(!$project_id)
+                               {
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][4]);
+                               }
+                               $dry_run = true;
+                       }
+
+                       $request_list = array();
+                       $request_list = $this->bo->read(array('project_id' => 
1,'allrows'=>$this->allrows,'dry_run' =>$dry_run));
                        $uicols = $this->bo->uicols;
-//_debug_array($uicols);
 
                        $j=0;
-                       while (is_array($request_list) && list(,$request_entry) 
= each($request_list))
+                       if (isset($request_list) && is_array($request_list))
                        {
-                               for ($k=0;$k<count($uicols['name']);$k++)
+                               foreach($request_list as $request)
                                {
-                                       if($uicols['input_type'][$k]!='hidden')
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
                                        {
-
-                                               
if($request_entry['query_location'][$uicols['name'][$k]])
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       
if(isset($request['query_location'][$uicols['name'][$i]]))
                                                {
-                                                       
$content[$j]['row'][$k]['statustext']           = lang('search');
-                                                       
$content[$j]['row'][$k]['text']                 = 
$request_entry[$uicols['name'][$k]];
-                                                       
$content[$j]['row'][$k]['link']                 = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.index', 'query'=> 
$request_entry['query_location'][$uicols['name'][$k]], 'project_id'=> 
$project_id));
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['statustext']               = 
lang('search');
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$request[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['java_link']                = true;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']                             
= $request['query_location'][$uicols['name'][$i]];
                                                }
                                                else
                                                {
-                                                       
$content[$j]['row'][$k]['value']                = 
$request_entry[$uicols['name'][$k]];
-                                                       
$content[$j]['row'][$k]['name']                 = $uicols['name'][$k];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$request[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['lookup']                   = 
$lookup;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+
+                                                               
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $request[$uicols['name'][$i]])
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']            = lang('link');
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']             = 
$request[$uicols['name'][$i]];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$request[$uicols['name'][$i]];
                                                }
 
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                    = 
$request[$uicols['name'][$i]];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                     = 
$uicols['name'][$i];
                                        }
 
+                                       if($lookup)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i + 1]['name']                         
= 'select';
+                                               
$datatable['rows']['row'][$j]['column'][$i + 1]['statustext']           = 
lang('select');
+                                               
$datatable['rows']['row'][$j]['column'][$i + 1]['align']                        
= 'center';
+                                               
$datatable['rows']['row'][$j]['column'][$i + 1]['value']                        
= '<input name="add_request[request_id][]" id="add_request[request_id][]"  
class="myValuesForPHP close_order" type="hidden" value=""/> <input 
type="checkbox" name="add_request[request_id_tmp][]" 
id="add_request[request_id_tmp][]" value="'.$request['request_id'].'" 
class="close_order_tmp">';                                     }
+                                       $j++;
+                               }
                                }
 
+                       // NO pop-up
+                       $datatable['rowactions']['action'] = array();
                                if(!$lookup)
                                {
+                               $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 'id',
+                                                       'source'        => 
'request_id'
+                                               ),
+                                       )
+                               );
+
                                        if($this->acl_read)
                                        {
-                                               
$content[$j]['row'][$k]['statustext']                   = lang('view the 
request');
-                                               $content[$j]['row'][$k]['text'] 
                        = lang('view');
-                                               $content[$j]['row'][$k]['link'] 
                        = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.view', 'id'=> $request_entry['request_id']));
-                                               $k++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uirequest.view'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
-
                                        if($this->acl_edit)
                                        {
-                                               
$content[$j]['row'][$k]['statustext']                   = lang('edit the 
request');
-                                               $content[$j]['row'][$k]['text'] 
                        = lang('edit');
-                                               $content[$j]['row'][$k]['link'] 
                        = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.edit', 'id'=> $request_entry['request_id']));
-                                               $k++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'edit',
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uirequest.edit'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
-
                                        if($this->acl_delete)
                                        {
-                                               
$content[$j]['row'][$k]['statustext']                   = lang('delete the 
request');
-                                               $content[$j]['row'][$k]['text'] 
                        = lang('delete');
-                                               $content[$j]['row'][$k]['link'] 
                        = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.delete', 'id'=> $request_entry['request_id']));
-                                               $k++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'delete',
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uirequest.delete'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
 
+                               if($this->acl_add)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'add',
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
        (
+                                                                               
                'menuaction'    => 'property.uirequest.edit'
+                                                                               
        ))
+                                       );
+                               }
+                               unset($parameters);
                                }
                                else
                                {
+
+                               $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 'id',
+                                                       'source'        => 
'request_id'
+                                               ),
+                                       )
+                               );
+
                                        if($this->acl_read)
                                        {
-                                               
$content[$j]['row'][$k]['statustext']                   = lang('view the 
request');
-                                               $content[$j]['row'][$k]['text'] 
                        = lang('view');
-                                               
$content[$j]['row'][$k]['target']                       = '_blank';
-                                               $content[$j]['row'][$k]['link'] 
                        = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.view', 'id'=> $request_entry['request_id']));
-                                               
$content[$j]['row'][$k]['request_id']                   = 
$request_entry['request_id'];
-                                               $k++;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('view'),
+                                               'target'                        
=> '_blank',
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uirequest.view'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
-
                                }
 
-                               $j++;
-                       }
+                       $uicols_count   = count($uicols['descr']);
 
-                       for ($i=0;$i<count($uicols['descr']);$i++)
+                       for ($i=0;$i<$uicols_count;$i++)
                        {
+
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
                                if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1')
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       if($uicols['name'][$i]=='request_id' || 
$uicols['name'][$i]=='budget' ||  $uicols['name'][$i]=='score')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'location_code',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uirequest.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'project_id'    
=>$project_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                                        }
-                                       if($uicols['name'][$i]=='request_id')
+                                       if($uicols['name'][$i]=='loc1')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'request_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uirequest.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'project_id'    
=>$project_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = "location_code";
                                        }
-                                       if($uicols['name'][$i]=='score')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'score',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uirequest.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'project_id'    
=>$project_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
+
                                        }
-                                       if($uicols['name'][$i]=='budget')
+                               else
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'budget',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uirequest.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'project_id'    
=>$project_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
-                                       }
-                                       if($uicols['name'][$i]=='address')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'address',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uirequest.index',
-                                                                               
                                                        'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'project_id'    
=>$project_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id)
-                                                                               
));
-                                       }
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
                                }
                        }
 
-                       if($this->acl_read)
+                       if($lookup)
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
                                $i++;
-                       }
+                               $datatable['headers']['header'][$i]['name']     
                = 'select';
+                               $datatable['headers']['header'][$i]['text']     
                = lang('select');
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = false;
+                               $datatable['headers']['header'][$i]['format']   
                = '';
+                               $datatable['headers']['header'][$i]['sortable'] 
                = false;
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               
$datatable['headers']['header'][$i]['formatter']                = '""';
+                       }
+
+                       // path for property.js
+                       $datatable['property_js'] =  
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       //$datatable['pagination']['records_returned'] = 
count($request_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       if(!$lookup)
+
+                       $appname                                        = 
lang('request');
+                       $function_msg                           = lang('list 
request');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               if($this->acl_edit)
+                           //avoid ,in the last page, reformate paginator when 
records are lower than records_returned
+                               if(count($request_list) <= 
$datatable['pagination']['records_limit'])
                                {
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       $table_header[$i]['header']             
= lang('edit');
-                                       $i++;
+                                       
$datatable['pagination']['records_returned']= count($request_list);
                                }
-                               if($this->acl_delete)
+                               else
                                {
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       $table_header[$i]['header']             
= lang('delete');
-                                       $i++;
+                                       
$datatable['pagination']['records_returned']= 
$datatable['pagination']['records_limit'];
                                }
+
+                           $datatable['sorting']['currentPage']        = 1;
+                           $datatable['sorting']['order']      = 'request_id'; 
// name key Column in myColumnDef
+                           $datatable['sorting']['sort']       = 'asc'; // ASC 
/ DESC
                        }
                        else
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('select');
+                               $datatable['sorting']['currentPage']    = 
phpgw::get_var('currentPage');
+                           $datatable['pagination']['records_returned']= 
phpgw::get_var('recordsReturned', 'int');
+                           $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // name of column of Database
+                           $datatable['sorting']['sort']       = 
phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-//_debug_array($content);
-                       if($this->acl_add)
-                       {
-                               $table_add[] = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
request'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.edit'))
-                               );
-                       }
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation');
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uirequest.index',
-                                               'sort'          => $this->sort,
-                                               'order'         => $this->order,
-                                               'cat_id'        => 
$this->cat_id,
-                                               'district_id'   => 
$this->district_id,
-                                               'filter'        => 
$this->filter,
-                                               'status_id'     => 
$this->status_id,
-                                               'project_id'    => $project_id,
-                                               'query'         => $this->query
-                       );
 
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $link_download = array
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 
'property.uirequest.download',
-                                               'sort'          => $this->sort,
-                                               'order'         => $this->order,
-                                               'cat_id'        => 
$this->cat_id,
-                                               'district_id'   => 
$this->district_id,
-                                               'filter'        => 
$this->filter,
-                                               'status_id'     => 
$this->status_id,
-                                               'project_id'    => $project_id,
-                                               'query'         => $this->query
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                               'currentPage'           => 
$datatable['sorting']['currentPage'],
+                                       'records'                       => 
array()
                        );
 
-                       if($this->acl_manage)
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
                        {
-                               $link_priority_key = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.priority_key'));
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
                        }
-
-                       if(!$this->allrows)
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                                                 $json_row[$column['name']] = 
$column['value'];
                        }
-                       else
+                                       }
+                                        $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
                        {
-                               $record_limit   = $this->bo->total_records;
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_download'                         => 
'download',
-                               'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                    => 
lang('Download table to your browser'),
 
-                               'lang_priority_key'                     => 
lang('Priority key'),
-                               'lang_priority_help'                    => 
lang('To alter the priority key'),
-                               'link_priority_key'                     => 
$link_priority_key,
-                               'lang_select'                           => 
lang('select'),
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'lang_update_project'                   => 
lang('Update project'),
-                               'lang_add_to_project_statustext'        => 
lang('add selected request to project'),
-                               'add_to_project_action'                 => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit', 'id'=> $project_id)),
-                               'project_id'                            => 
$project_id,
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
 
-                               'lookup'                                => 
$lookup,
-                               'allow_allrows'                         => true,
-                               'allrows'                               => 
$this->allrows,
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($request_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                           => 
lang('no category'),
-                               'cat_filter'                    => 
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data)),
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'request.index', 'property' );
+
+                       //$this->save_sessiondata();
 
-                               'district_list'                         => 
$this->bocommon->select_district_list('filter',$this->district_id),
-                               'lang_no_district'                      => 
lang('no district'),
-                               'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                  => 
'district_id',
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-
-                               'lang_status_statustext'                => 
lang('Select the status the agreement belongs to. To do not use a category 
select NO STATUS'),
-                               'status_name'                           => 
'status_id',
-                               'lang_no_status'                        => 
lang('No status'),
-                               'status_list'                           => 
$this->boproject->select_status_list('filter',$this->status_id),
-
-                               'lang_user_statustext'                  => 
lang('Select the user the request belongs to. To do not use a category select 
NO USER'),
-                               'select_user_name'                      => 
'filter',
-                               'lang_no_user'                          => 
lang('No user'),
-                               'user_list'                             => 
$this->bocommon->get_user_list('filter',$this->filter,$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                 => 
$this->query,
-                               'lang_search'                           => 
lang('search'),
-                               'table_header'                          => 
$table_header,
-                               'values'                                => 
$content,
-                               'table_add'                             => 
$table_add
-                       );
-
-                       $appname                                        = 
lang('request');
-                       $function_msg                                   = 
lang('list request');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
                }
 
 
@@ -467,6 +654,10 @@
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>16, 'acl_location'=> $this->acl_location));
                        }
+
+                       //cramirez: necesary for windows.open . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array('request'));
                        $GLOBALS['phpgw_info']['flags'][noheader] = true;
                        $GLOBALS['phpgw_info']['flags'][nofooter] = true;
@@ -487,6 +678,12 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
+                       $function_exchange_values = '';
+                       if ($receipt != '')
+                       {
+                               $function_exchange_values = 
"window.opener.myexecuteTEMP();";
+                       }
+
                        $data = array
                        (
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -495,6 +692,7 @@
                                'lang_priority_key_statustext'          => 
lang('Weight for prioritising'),
                                'lang_save'                             => 
lang('save'),
                                'priority_key'                          => 
$priority_key,
+                               'exchange_values'               => 
$function_exchange_values
                        );
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('priority_form' => $data));
@@ -504,11 +702,13 @@
 
                function edit()
                {
+                       $id     = phpgw::get_var('id', 'int');
+
                        if(!$this->acl_add && !$this->acl_edit)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uirequest.view', 'id'=> $id));
                        }
-                       $id     = phpgw::get_var('id', 'int');
+
                        $values = phpgw::get_var('values');
 
                        $bypass                         = 
phpgw::get_var('bypass', 'bool');
@@ -539,7 +739,7 @@
                                $origin_id      = phpgw::get_var('origin_id', 
'int');
 
                                //23.jun 08: This will be handled by the 
interlink code - just doing a quick hack for now...
-                               if($origin == 'tts' && $origin_id && 
!$values['descr'])
+                               if($origin == '.ticket' && $origin_id && 
!$values['descr'])
                                {
                                        $boticket= 
CreateObject('property.botts');
                                        $ticket = 
$boticket->read_single($origin_id);
@@ -563,7 +763,7 @@
 
                                if($location_code)
                                {
-                                       $values['location_data'] = 
$this->bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+                                       $values['location_data'] = 
$this->bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num,
 'view' => true));
                                }
 
                        }
@@ -591,7 +791,7 @@
 
 
 //_debug_array($values);
-                       $this->config->read_repository();
+                       $this->config->read();
 
                        if ($values['save'])
                        {
@@ -618,14 +818,16 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
                                }
 
-                               if($id)
+                               if(isset($values['budget']) && 
$values['budget'] && !ctype_digit($values['budget']))
                                {
-                                       $values['request_id']=$id;
-                                       $action='edit';
+                                       
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
+                                       $error_id=true;
                                }
-                               elseif(!$receipt['error'])
+
+                               if($id)
                                {
-                                       
$values['request_id']=$this->bo->next_id();
+                                       $values['id']=$id;
+                                       $action='edit';
                                }
 
                                if(!$receipt['error'])
@@ -633,10 +835,12 @@
                                        if($values['copy_request'])
                                        {
                                                $action='add';
-                                               $values['request_id']   = 
$this->bo->next_id();
-                                               $id     = $values['request_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
+                                       if (! $receipt['error'])
+                                       {
+                                               $id = $receipt['id'];
+                                       }
 
 //----------files
                                        $bofiles        = 
CreateObject('property.bofiles');
@@ -646,7 +850,7 @@
                                        }
 
                                        $values['file_name']=str_replace(" 
","_",$_FILES['file']['name']);
-                                       $to_file = 
"{$bofiles->fakebase}/request/{$values['request_id']}/{$values['file_name']}";
+                                       $to_file = 
"{$bofiles->fakebase}/request/{$id}/{$values['file_name']}";
 
                                        if(!$values['document_name_orig'] && 
$bofiles->vfs->file_exists(array(
                                                        'string' => $to_file,
@@ -658,7 +862,7 @@
 
                                        if($values['file_name'])
                                        {
-                                               
$bofiles->create_document_dir("request/{$values['request_id']}");
+                                               
$bofiles->create_document_dir("request/{$id}");
                                                $bofiles->vfs->override_acl = 1;
 
                                                if(!$bofiles->vfs->cp (array (
@@ -671,7 +875,7 @@
                                                $bofiles->vfs->override_acl = 0;
                                        }
 //---------end files
-                                       $id = $values['request_id'];
+
                                        $function_msg = lang('Edit request');
 
                                        if ($values['notify'])
@@ -683,8 +887,8 @@
                                                $headers .= "Bcc: " . 
$coordinator_name . "<" . $coordinator_email .">\r\n";
                                                $headers .= "Content-type: 
text/plain; charset=iso-8859-1\r\n";
 
-                                               $subject = lang(notify).": ". 
$values['request_id'];
-                                               $message = lang(request) . " " 
. $values['request_id'] ." ". lang('is registered');
+                                               $subject = lang(notify).": ". 
$id;
+                                               $message = lang(request) . " " 
. $id ." ". lang('is registered');
 
                                                if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
                                                {
@@ -837,8 +1041,61 @@
                                
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
                        }
 
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($record_history),
+                                       'total_records'                 => 
count($record_history),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array(key => value_date,label=>lang('Date'),sortable=>true,resizeable=>true),
+                                                                               
                array(key => 
value_user,label=>lang('User'),sortable=>true,resizeable=>true),
+                                                                               
                array(key => 
value_action,label=>lang('Action'),sortable=>true,resizeable=>true),
+                                                                               
        array(key => value_new_value,label=>lang('New 
Value'),sortable=>true,resizeable=>true)))
+                       );
+       
+                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+                       
+                       for($z=0; $z<count($values['files']); $z++)
+                       {
+                               if ($link_to_files != '') {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$values['files'][$z]['directory'].'/'.$values['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$values['files'][$z]['name'].'</a>';
+                               }
+                               else {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$values['files'][$z]['file_name'].'" 
target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$values['files'][$z]['name'].'</a>';
+                               }                               
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'" style="cursor:help">';
+                       }                                                       
                
+
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      json_encode(array(      
array(key => 
file_name,label=>lang('Filename'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => delete_file,label=>lang('Delete 
file'),sortable=>false,resizeable=>true,formatter=>FormatterCenter)))
+                       );
+                                                                       
                        $data = array
                        (
+                               'property_js'                                   
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
                => $datavalues,
+                               'myColumnDefs'                                  
        => $myColumnDefs,
+                               'tabs'                                          
        => self::_generate_tabs(),
                                'fileupload'                            => true,
                                'link_view_file'                        => 
$GLOBALS['phpgw']->link('/index.php',$link_file_data),
                                'link_to_files'                         => 
$link_to_files,
@@ -911,7 +1168,7 @@
                                'lang_done'                             => 
lang('done'),
 
                                'lang_request_id'                       => 
lang('request ID'),
-                               'value_request_id'                      => 
$values['request_id'],
+                               'value_request_id'                      => $id,
 
                                'lang_title'                            => 
lang('Title'),
                                'value_title'                           => 
$values['title'],
@@ -936,7 +1193,7 @@
                                'lang_no_user'                          => 
lang('Select coordinator'),
                                'user_list'                             => 
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl_location),
 
-                               'status_list'                           => 
$this->boproject->select_status_list('select',$values['status']),
+                               'status_list'                           => 
$this->bo->select_status_list('select',$values['status']),
                                'status_name'                           => 
'values[status]',
                                'lang_no_status'                        => 
lang('Select status'),
                                'lang_status'                           => 
lang('Status'),
@@ -962,23 +1219,46 @@
 
                        );
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
                        $appname        = lang('request');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('request', 
'files'));
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'request.edit', 'property' );
                }
 
                function delete()
                {
+                       $id = phpgw::get_var('id', 'int');
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id);
+                               return "id ".$id." ".lang("has been deleted");
+                       }
+
                        if(!$this->acl_delete)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
                        }
 
-                       $id = phpgw::get_var('id', 'int');
+                       //$id = phpgw::get_var('id', 'int');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
                        $link_data = array
@@ -1104,7 +1384,7 @@
                                'id'            =>$id
                        );
 
-                       $this->config->read_repository();
+                       $this->config->read();
                        $link_to_files = 
$this->config->config_data['files_url'];
 
                        $j      = count($values['files']);
@@ -1181,7 +1461,7 @@
                                'lang_no_user'                                  
=> lang('Select coordinator'),
                                'user_list'                                     
=> 
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
 
-                               'status_list'                                   
=> $this->boproject->select_status_list('select',$values['status']),
+                               'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
                                'lang_status'                                   
=> lang('Status'),
 
                                'branch_list'                                   
=> $this->boproject->select_branch_list($values['branch_id']),
@@ -1206,5 +1486,20 @@
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
+
+               protected function _generate_tabs()
+               {
+                       $tabs = array
+                       (
+                               'general'               => array('label' => 
lang('general'), 'link' => '#general'),
+                               'location'              => array('label' => 
lang('importance'), 'link' => '#importance'),
+                               'budget'                => array('label' => 
lang('documents'), 'link' => '#documents'),
+                               'history'               => array('label' => 
lang('history'), 'link' => '#history')
+                       );
+
+                       phpgwapi_yui::tabview_setup('project_tabview');
+
+                       return  phpgwapi_yui::tabview_generate($tabs, 
'general');
+               }
        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.uiresponsible.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiresponsible.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiresponsible.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -9,13 +9,13 @@
        * @package phpgroupware
        * @subpackage property
        * @category core
-       * @version $Id: class.uiresponsible.inc.php 732 2008-02-10 16:21:14Z 
sigurd $
+       * @version $Id: class.uiresponsible.inc.php 3442 2009-08-28 14:28:53Z 
sigurd $
        */
 
        /*
           This program is free software: you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 3 of the License, or
+          the Free Software Foundation, either version 2 of the License, or
           (at your option) any later version.
 
           This program is distributed in the hope that it will be useful,
@@ -35,6 +35,8 @@
         * @category core
         */
 
+       phpgw::import_class('phpgwapi.yui');
+       
        class property_uiresponsible
        {
 
@@ -162,6 +164,8 @@
 
                public function index()
                {
+                       $bocommon       = CreateObject('property.bocommon');
+                       
                        if(!$this->acl_read)
                        {
                                $this->no_access();
@@ -176,203 +180,380 @@
                                $GLOBALS['phpgw_info']['flags']['headonly']     
        = true;
                        }
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('responsible', 
'nextmatchs','search_field'));
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
 
-                       $responsible_info = $this->bo->read_type();
 
-                       $content = array();
-                       foreach ( $responsible_info as $entry )
-                       {
-                               $link_edit                                      
= '';
-                               $lang_edit_text         = '';
-                               $text_edit                                      
= '';
-                               if ($this->acl_edit && !$lookup)
-                               {
-                                       $link_edit                              
= $GLOBALS['phpgw']->link('/index.php', array
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
                                                                                
                (
-                                                                               
                        'menuaction'    => 'property.uiresponsible.edit_type',
-                                                                               
                        'id'                    => $entry['id'],
-                                                                               
                        'location'              => str_replace('property', '', 
$entry['app_name'])
+                                                               'menuaction'=> 
'property.uiresponsible.index',
+                                                                       'query' 
        => $this->query,
+                                                                       
'location'      => $this->location,
+                                                                       
'lookup'        => $lookup
+
                                                                                
                ));
-                                       $lang_edit_text                 = 
lang('edit type');
-                                       $text_edit                              
= lang('edit');
+                                       
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiresponsible.index',"                                    
                                                        
+                                                                               
                        ."query:'{$this->query}',"
+                                                                               
                        ."location:'{$this->location}',"
+                                                                               
                        ."lookup:'{$lookup}'";          
+                               
+                               $values_combo_box[0]  = 
$this->bolocation->select_location('filter', $this->location);
+                               $default_value = array 
('id'=>'','descr'=>lang('No location'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'    => 'property.uiresponsible.index',
+                                                                       'query' 
        => $this->query,
+                                                                       
'location'      => $this->location,
+                                                                       
'lookup'        => $lookup
+                                                               )
+                                                       ),
+                                               'fields'        => array(
+                                       'field' => array(
+                                                               array(
+                                                                       'type' 
=> 'button',
+                                                                   'id' => 
'btn_location',
+                                                                   'name' => 
'location',
+                                                                   'value'     
=> lang('No location'),                                                         
    
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 1
+                                                               ),              
                                                                                
                                
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 4
+                                                                           ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'size'    
=> 28,
+                                                                   'tab_index' 
=> 2
+                                                               )               
                                        
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
array( //div values  combo_box_0
+                                                                               
                    'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$bocommon->select2String($values_combo_box[0], 'id','descr') //i.e.  
id,value/id,vale/
+                                                                               
              )
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
                                }
 
-                               $link_delete                            = '';
-                               $text_delete                            = '';
-                               $lang_delete_text               = '';
-                               if ($this->acl_delete && !$lookup)
+                       $responsible_info = array();
+                       $responsible_info = $this->bo->read_type();
+                                                                               
                                                                                
                        
+                       $uicols = array (
+                               'input_type'    =>      
array(hidden,text,text,text,text,hidden,text,text,hidden,hidden),
+                               'name'                  =>      
array(id,name,descr,category,created_by,created_on,app_name,active,loc,location),
+                               'formatter'             =>      
array('','','','','','','','','',''),
+                               'descr'                 =>      
array('',lang('name'),lang('descr'),lang('category'),lang('supervisor'),'',lang('location'),lang('active'),'','')
+                       );
+
+                       $j=0;
+                       if (isset($responsible_info) && 
is_array($responsible_info))
                                {
-                                       $link_delete                    = 
$GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                (
-                                                                               
                        'menuaction'    => 'property.uiresponsible.delete_type',
-                                                                               
                        'id'                    => $entry['id']
-                                                                               
                ));
-                                       $text_delete                    = 
lang('delete');
-                                       $lang_delete_text               = 
lang('delete type');
+                               foreach($responsible_info as $entry)
+                               {
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {                                       
                
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                                       
+                                                       if ($uicols['name'][$i] 
== 'active')
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
($entry[$uicols['name'][$i]] == 1 ? 'X' : '');
+                                                       }
+                                                       else if 
($uicols['name'][$i] == 'loc')
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
str_replace('property', '', $entry['app_name']);
+                                                       }
+                                                       else {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$entry[$uicols['name'][$i]];
                                }
+                                       }
+                                       $j++;
+                               }
+                       }
+       
 
-                               $link_contacts                          = '';
-                               $text_contacts                          = '';
-                               $lang_contacts_text                     = '';
-                               $lang_select                            = '';
-                               $lang_select_text                       = '';
-                               if (!$lookup)
+                       $uicols_count   = count($uicols['descr']);
+
+                       for ($i=0;$i<$uicols_count;$i++)
                                {
-                                       $link_contacts                  = 
$GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                (
-                                                                               
                        'menuaction'    => 'property.uiresponsible.contact',
-                                                                               
                        'type_id'=> $entry['id']
-                                                                               
                ));
-                                       $text_contacts                  = 
lang('contacts');
-                                       $lang_contacts_text             = 
lang('list of contacts for this responsibility type');
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                               
+                                       if($uicols['name'][$i]=='name')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'name';
+                                       }               
                                }
                                else
                                {
-                                       $lang_select                    = 
lang('select');
-                                       $lang_select_text               = 
lang('select responsibility type for this contact');
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
                                }
+                               }
 
-                               $content[] = array
+                       $datatable['rowactions']['action'] = array();
+                       
+                       if(!$lookup)
+                       {
+                               $parameters = array
                                (
-                                       'id'                                    
=> $entry['id'],
-                                       'name'                                  
=> $entry['name'],
-                                       'descr'                                 
=> $entry['descr'],
-                                       'active'                                
=> $entry['active'] == 1 ? 'X' : '',
-                                       'created_by'                    => 
$entry['created_by'],
-                                       'created_on'                    => 
$entry['created_on'],
-                                       'category'                              
=> $entry['category'],
-                                       'app_name'                              
=> $entry['app_name'],
-                                       'link_contacts'                 => 
$link_contacts,
-                                       'text_contacts'                 => 
$text_contacts,
-                                       'lang_contacts_text'    => 
$lang_contacts_text,
-                                       'link_edit'                             
=> $link_edit,
-                                       'text_edit'                             
=> $text_edit,
-                                       'lang_edit_text'                => 
$lang_edit_text,
-                                       'link_delete'                   => 
$link_delete,
-                                       'text_delete'                   => 
$text_delete,
-                                       'lang_delete_text'              => 
$lang_delete_text,
-                                       'lang_select'                   => 
$lang_select,
-                                       'lang_select_text'              => 
$lang_select_text
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 'id',
+                                                       'source'        => 'id'
+                                               ),                              
        
+                                       )
                                );
-                       }
 
-                       $table_header[] = array
+                               $parameters2 = array
                        (
-                               'sort_name'     => 
$this->nextmatchs->show_sort_order(array
+                                       'parameter' => array
                                (
-                                       'sort'  => $this->sort,
-                                       'var'   => 'name',
-                                       'order' => $this->order,
-                                       'extra' => array
+                                               array
                                        (
-                                               'menuaction'    => 
'property.uiresponsible.index',
-                                               'allrows'               => 
$this->allrows,
-                                               'location'              => 
$this->location
+                                                       'name'          => 
'type_id',
+                                                       'source'        => 'id'
+                                               ),
+                                               array
+                                               (
+                                                       'name'          => 
'location',
+                                                       'source'        => 
'location'
+                                               )
                                        )
-                               )),
-                               'lang_name'                     => lang('name'),
-                               'lang_descr'            => lang('descr'),
-                               'lang_category'         => lang('category'),
-                               'lang_created_by'       => lang('supervisor'),
-                               'lang_app_name'         => lang('location'),
-                               'lang_active'           => lang('active'),
-                               'lang_contacts'         => !$lookup ? 
lang('contacts') : '',
-                               'lang_edit'                     => 
$this->acl_edit && !$lookup ? lang('edit') : '',
-                               'lang_delete'           => $this->acl_delete && 
!$lookup ? lang('delete') : '',
-                               'lang_select'           => $lookup ? 
lang('select') : ''
                        );
 
-                       if(!$this->allrows)
+                               $parameters3 = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 'id',
+                                                       'source'        => 'id'
+                                               ),
+                                               array
+                                               (
+                                                       'name'          => 
'location',
+                                                       'source'        => 
'location'
+                                               ),                              
                
+                                       )
+                               );
+                                                               
+                               if($this->acl_edit)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiresponsible.edit_type',
+//                                                                             
        'location'              => $this->location
+                                                                               
)),
+                                               'parameters'    => $parameters3
+                                       );
                        }
-                       else
+                               
+                               if($this->acl_delete)
                        {
-                               $record_limit   = $this->bo->total_records;
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'delete',
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiresponsible.delete_type'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                        }
 
-                       $link_data = array
+                               $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'contacts',
+                                       'text'                  => 
lang('contacts'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 
'property.uiresponsible.index',
-                               'sort'                  => $this->sort,
-                               'order'                 => $this->order,
-                               'query'                 => $this->query,
-                               'location'              => $this->location,
-                               'lookup'                => $lookup
-
+                                                                               
'menuaction'    => 'property.uiresponsible.contact'
+                                                                       )),
+                                       'parameters'    => $parameters2
                        );
 
-                       $link_add_action = array
+                               if($this->acl_add)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                                       'my_name'               
        => 'add',
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                        (
                                'menuaction'    => 
'property.uiresponsible.edit_type',
                                'location'              => $this->location
+                                                                               
        ))
                        );
+                               }                               
 
-                       $table_add = array();
-                       if(!$lookup)
+                               unset($parameters);
+                       }
+                       
+                       if($lookup)
                        {
-                               $table_add[] = array
+
+                               $function_exchange_values = '';
+       
+                               $function_exchange_values .= 
'opener.document.getElementsByName("responsibility_id")[0].value = "";' ."\r\n";
+                               $function_exchange_values .= 
'opener.document.getElementsByName("responsibility_name")[0].value = "";' 
."\r\n";
+                               
+                               $function_exchange_values .= 
'opener.document.getElementsByName("responsibility_id")[0].value = 
data.getData("id");' ."\r\n";
+                               $function_exchange_values .= 
'opener.document.getElementsByName("responsibility_name")[0].value = 
data.getData("name");' ."\r\n";
+                               
+                               $function_exchange_values .= 'window.close()';
+       
+                               $datatable['exchange_values'] = 
$function_exchange_values;
+                               $datatable['valida'] = '';
+
+                       }                                                       
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                
+
+                       // path for property.js
+                       $datatable['property_js'] =  
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned'] = 
count($responsible_info);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'name'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                                (
-                                       'lang_add'                              
=> lang('add'),
-                                       'lang_add_statustext'   => lang('add 
type'),
-                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php', $link_add_action)
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                                );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
                        }
-                       else
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
                        {
-                               
if(!isset($GLOBALS['phpgw_info']['flags']['java_script']))
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
                                {
-                                       
$GLOBALS['phpgw_info']['flags']['java_script'] = '';
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                        $json['records'][] = $json_row;
                                }
-
-                               $GLOBALS['phpgw_info']['flags']['java_script'] 
.= "\n"
-                                       . '<script type="text/javascript">' 
."\n"
-                                       . "//<[CDATA[\n"
-                                       . 'function Exchange_values(thisform)' 
."\r\n"
-                                       . "{\r\n"
-                                       . 
"opener.document.form.responsibility_id.value = thisform.elements[0].value;\r\n"
-                                       . 
"opener.document.form.responsibility_name.value = 
thisform.elements[1].value;\r\n"
-                                       . "window.close()\r\n"
-                                       . "}\r\n"
-                                       . "//]]\n"
-                                       . "</script>\n";
                        }
 
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data', 'responsible_receipt');
                        $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($receipt);
                        $GLOBALS['phpgw']->session->appsession('session_data', 
'responsible_receipt', '');
 
-                       $data = array
-                       (
-                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
        => true,
-                               'allrows'                                       
                => $this->allrows,
-                               'start_record'                                  
        => $this->start,
-                               'record_limit'                                  
        => $record_limit,
-                               'num_records'                                   
        => $responsible_info ? count($responsible_info) : 0,
-                               'all_records'                                   
        => $this->bo->total_records,
-                               'select_action'                                 
        => $GLOBALS['phpgw']->link('/index.php', $link_data),
-                               'link_url'                                      
                => $GLOBALS['phpgw']->link('/index.php', $link_data),
-                               'img_path'                                      
                => $GLOBALS['phpgw']->common->get_image_path('phpgwapi', 
'default'),
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                         
                => $this->query,
-                               'lang_search'                                   
        => lang('search'),
-                               'table_header_type'                             
        => $table_header,
-                               'table_add'                                     
                => $table_add,
-                               'values_type'                                   
        => $content,
-                               'lang_no_location'                              
        => lang('No location'),
-                               'lang_location_statustext'                      
=> lang('Select submodule'),
-                               'select_name_location'                          
=> 'location',
-                               'location_list'                                 
        => $this->bolocation->select_location('filter', $this->location),
-                       );
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               $json ['message']                       = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+                               
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $function_msg= lang('list available responsible types');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('responsible matrix') . ":: {$function_msg}";
 
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('list_type' => $data));
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'responsible.index', 'property' );
+                       
                        $this->_save_sessiondata();
                }
 
@@ -390,6 +571,11 @@
                                return;
                        }
 
+                       if(!$GLOBALS['phpgw']->locations->get_id('property', 
$this->location))
+                       {
+                               $receipt['error'][]=array('msg'=>lang('not a 
valid location!'));
+                       }
+
                        $id             = phpgw::get_var('id', 'int');
                        $values = phpgw::get_var('values', 'string', 'POST');
 
@@ -405,9 +591,10 @@
 
                                if ((isset($values['save']) && $values['save']) 
|| (isset($values['apply']) && $values['apply']))
                                {
+                                       $values['location'] = $this->location;
                                        if(!$values['cat_id'] || 
$values['cat_id'] == 'none')
                                        {
-                                               
$receipt['error'][]=array('msg'=>lang('Please select a category!'));
+                       //                      
$receipt['error'][]=array('msg'=>lang('Please select a category!'));
                                        }
                                        if(!$values['name'])
                                        {
@@ -499,7 +686,7 @@
                                                                                
                                )),
                        );
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('responsible matrix') . "::{$function_msg}";
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('responsible matrix') . "::{$this->location}::{$function_msg}";
                        $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit_type' => $data));
                }
 
@@ -567,6 +754,7 @@
                                        'created_on'                    => 
$entry['created_on'],
                                        'contact_name'                  => 
$entry['contact_name'],
                                        'remark'                                
=> $entry['remark'],
+                                       'ecodimb'                               
=> $entry['ecodimb'],
                                        'link_edit'                             
=> $link_edit,
                                        'text_edit'                             
=> $text_edit,
                                        'lang_edit_text'                => 
$lang_edit_text,
@@ -617,6 +805,19 @@
                                                'type_id'               => 
$type_id
                                        )
                                )),
+                               'sort_ecodimb'  => 
$this->nextmatchs->show_sort_order(array
+                               (
+                                       'sort'  => $this->sort,
+                                       'var'   => 'ecodimb',
+                                       'order' => $this->order,
+                                       'extra' => array
+                                       (
+                                               'menuaction'    => 
'property.uiresponsible.contact',
+                                               'allrows'               => 
$this->allrows,
+                                               'location'              => 
$this->location,
+                                               'type_id'               => 
$type_id
+                                       )
+                               )),
                                'lang_contact'          => lang('contact'),
                                'lang_location'         => lang('location'),
                                'lang_item'                     => lang('item'),
@@ -625,6 +826,7 @@
                                'lang_created_on'       => lang('created'),
                                'lang_created_by'       => lang('supervisor'),
                                'lang_remark'           => lang('remark'),
+                               'lang_ecodimb'          => lang('dimb'),
                                'lang_edit'                     => 
$this->acl_edit ? lang('edit') : '',
                //              'lang_delete'           => $this->acl_delete ? 
lang('delete') : '',
                        );
@@ -739,6 +941,8 @@
 
                        if (isset($values) && is_array($values))
                        {
+                               $values['ecodimb']                      = 
phpgw::get_var('ecodimb');
+
                                if(!$this->acl_edit)
                                {
                                        $this->no_access();
@@ -796,7 +1000,7 @@
 
                                        if(!isset($values['location']['loc1']))
                                        {
-                                               
$receipt['error'][]=array('msg'=>lang('Please select a location!'));
+                       //                      
$receipt['error'][]=array('msg'=>lang('Please select a location!'));
                                        }
 
                                        
if($GLOBALS['phpgw']->session->is_repost())
@@ -878,6 +1082,10 @@
                                                'entity_data'   => 
isset($values['p']) ? $values['p'] : ''
                                                ));
 
+                       $ecodimb_data=$bocommon->initiate_ecodimb_lookup(array(
+                                               'ecodimb'                       
=> $values['ecodimb'],
+                                               'ecodimb_descr'         => 
$values['ecodimb_descr']));
+
                        $link_data = array
                        (
                                'menuaction'    => 
'property.uiresponsible.edit_contact',
@@ -900,12 +1108,12 @@
                                . " var strURL = phpGWLink('index.php', 
oArgs);\n"
                                . ' 
Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");'
 . "\r\n"
                                . '}'."\r\n"
-                               . 'function lookup_responsibility()' ."\r\n"
-                               . "{\r\n"
-                               . ' var oArgs = {' . 
$lookup_link_responsibility . "};\n"
-                               . " var strURL = phpGWLink('index.php', 
oArgs);\n"
-                               . ' 
Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");'
 . "\r\n"
-                               . '}'."\r\n"
+//                             . 'function lookup_responsibility()' ."\r\n"
+//                             . "{\r\n"
+//                             . ' var oArgs = {' . 
$lookup_link_responsibility . "};\n"
+//                             . " var strURL = phpGWLink('index.php', 
oArgs);\n"
+//                             . ' 
Window1=window.open(strURL,"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");'
 . "\r\n"
+//                             . '}'."\r\n"
                                . '//]]' ."\n"
                                . "</script>\n";
 
@@ -920,8 +1128,11 @@
                        $jscal->add_listener('values_active_from');
                        $jscal->add_listener('values_active_to');
 
+                       $type = $this->bo->read_single_type($type_id);
+
                        $data = array
                        (
+                               'ecodimb_data'                                  
=> $ecodimb_data,
                                'value_entry_date'                              
=> isset($values['entry_date']) ? $values['entry_date'] : '',
                                'value_name'                                    
=> isset($values['name']) ? $values['name'] : '',
                                'value_remark'                                  
=> isset($values['remark']) ? $values['remark'] : '',
@@ -929,9 +1140,9 @@
                                'lang_remark'                                   
=> lang('remark'),
 
                                'lang_responsibility'                   => 
lang('responsibility'),
-                               'lang_responsibility_status_text'=> lang('click 
to select responsibility'),
-                               'value_responsibility_id'               => 
isset($values['responsibility_id']) ? $values['responsibility_id'] : '',
-                               'value_responsibility_name'             => 
isset($values['responsibility_name']) ? $values['responsibility_name'] : '',
+                               'lang_responsibility_status_text'=> 
lang('responsibility'),
+                               'value_responsibility_id'               => 
$type_id,
+                               'value_responsibility_name'             => 
$type['name'],
 
                                'lang_contact'                                  
=> lang('contact'),
                                'lang_contact_status_text'              => 
lang('click to select contact'),
@@ -1003,44 +1214,15 @@
                {
                        if(!$this->acl_delete)
                        {
-                               $this->no_access();
-                               return;
+                               return 'No access';
                        }
 
                        $id                             = phpgw::get_var('id', 
'int');
 
-                       $link_data = array
-                       (
-                               'menuaction' => 'property.uiresponsible.index'
-                       );
-
-                       if ( phpgw::get_var('confirm', 'bool', 'POST') )
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
                                $this->bo->delete_type($id);
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+                               return lang('id %1 has been deleted', $id);
                        }
-
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
-                       $data = array
-                       (
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
-                               'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                                        (
-                                                                               
                                                'menuaction'=> 
'property.uiresponsible.delete_type',
-                                                                               
                                                'id'=> $id
-                                                                               
                                        )),
-                               'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
-                               'lang_yes'                              => 
lang('yes'),
-                               'lang_yes_statustext'   => lang('Delete the 
entry'),
-                               'lang_no_statustext'    => lang('Back to the 
list'),
-                               'lang_no'                               => 
lang('no')
-                       );
-
-                       $function_msg   = lang('delete');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('responsible matrix') . "::{$function_msg}";
-
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('delete' => $data));
                }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.uis_agreement.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uis_agreement.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uis_agreement.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -32,6 +32,8 @@
         * @package property
         */
 
+       phpgw::import_class('phpgwapi.yui');
+
        class property_uis_agreement
        {
                var $grants;
@@ -53,7 +55,6 @@
                        'view_item'             => true,
                        'view_file'             => true,
                        'download'                      => true,
-                       'attrib_history'=> true,
                        'import'                => true
                );
 
@@ -61,19 +62,16 @@
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::agreement::service';
-                       $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo               = 
CreateObject('property.bos_agreement',true);
-                       $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->bocommon                         = & 
$this->bo->bocommon;
 
                        $this->role             = $this->bo->role;
 
-                       $this->cats             = 
CreateObject('phpgwapi.categories');
-                       $this->cats->app_name   = 'fm_vendor';
-
+                       $this->cats                                     = & 
$this->bo->cats;
                        $this->acl              = & $GLOBALS['phpgw']->acl;
-                       $this->acl_location= '.s_agreement';
+                       $this->acl_location                     = 
'.s_agreement';
 
                        $this->acl_read         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
                        $this->acl_add          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
@@ -123,7 +121,7 @@
                        {
 
                                
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-                               
$GLOBALS['phpgw']->preferences->read_repository();
+                               $GLOBALS['phpgw']->preferences->read();
                                
$GLOBALS['phpgw']->preferences->add('property','s_agreement_columns',$values['columns'],'user');
                                
$GLOBALS['phpgw']->preferences->save_repository();
 
@@ -175,201 +173,391 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs',
-                                                                               
'filter_member_of'));
-
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt','');
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uis_agreement.index',
+                                       'sort'          =>$this->sort,
+                                       'order'         =>$this->order,
+                                       'cat_id'        =>$this->cat_id,
+                                       'filter'        =>$this->filter,
+                                       'query'         =>$this->query,
+                                       'role'          => $this->role,
+                                       'member_id'     => $this->member_id
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uis_agreement.index',"
+                                                                               
                ."sort:'{$this->sort}',"
+                                                                               
                ."order:'{$this->order}',"
+                                                                               
."cat_id: '{$this->cat_id}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."query:'{$this->query}',"
+                                                                               
."role:'{$this->role}',"
+                                                                               
."member_id:'{$this->member_id}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uis_agreement.index',
+                                       'sort'          =>$this->sort,
+                                       'order'         =>$this->order,
+                                       'cat_id'        =>$this->cat_id,
+                                       'filter'        =>$this->filter,
+                                       'query'         =>$this->query,
+                                       'role'          => $this->role,
+                                       'member_id'     => $this->member_id
+
+                               );
+
+                               $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true,'link_data' =>$link_data));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no member'));
+                               array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'s_agreement','order'=>'descr'));
+                               $default_value = array 
('id'=>'','name'=>lang('no category'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $values_combo_box[2]  = 
$this->bo->select_vendor_list('filter',$this->vendor_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no vendor'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uis_agreement.index',
+                                                               'sort'          
=>$this->sort,
+                                                               'order'         
=>$this->order,
+                                                               'cat_id'        
=>$this->cat_id,
+                                                               'filter'        
=>$this->filter,
+                                                               'query'         
=>$this->query,
+                                                               'role'          
=> $this->role,
+                                                               'member_id'     
=> $this->member_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
//boton  CATEGORY
+                                                                           
'id' => 'btn_member_id',
+                                                                           
'name' => 'member_id',
+                                                                           
'value'     => lang('Member'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//boton  STATUS
+                                                                           
'id' => 'btn_cat_id',
+                                                                           
'name' => 'category_id',
+                                                                           
'value'     => lang('Category'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                       array( 
//boton  HOUR CATEGORY
+                                                                           
'id' => 'btn_vendor_id',
+                                                                           
'name' => 'vendor_id',
+                                                                           
'value'     => lang('Vendor'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       ),
+                                                                       array(
+                                                                               
        'type' => 'link',
+                                                                               
        'id' => 'btn_columns',
+                                                                               
        'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                               
                                                                                
                   array
+                                                                               
                                                                                
                      (
+                                                                               
                                                                                
                       'menuaction' => 'property.uis_agreement.columns',
+                                                                               
                                                                                
                                   'role'               => $this->role
+                                                                               
                                                                                
                      ))."','','width=300,height=600,scrollbars=1')",
+                                                                               
                                        'value' => lang('columns'),
+                                                                               
                                        'tab_index' => 9
+                                                                               
                                )
+                                                                               
),
+                                                       'hidden_value' => array(
+                                                                               
        array( //div values  combo_box_0
+                                                                               
                            'id' => 'values_combo_box_0',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[0]['cat_list'], 'cat_id')
+                                                                               
                      ),
+                                                                               
                array( //div values  combo_box_1
+                                                                               
                            'id' => 'values_combo_box_1',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
                      ),
+                                                                               
                                                 array( //div values  
combo_box_2
+                                                                               
                            'id' => 'values_combo_box_2',
+                                                                               
                            'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
                      )
+                                                                               
                        )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
                        $list = $this->bo->read();
 
                        $uicols         = $this->bo->uicols;
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
-                       $j=0;
-
                        if (isset($list) AND is_array($list))
                        {
-                               foreach($list as $entry)
+                               foreach($list as $list_entry)
                                {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       for ($k=0;$k<$count_uicols_name;$k++)
                                        {
-                                               
if($uicols['input_type'][$i]!='hidden')
+                                               
if($uicols['input_type'][$k]!='hidden')
                                                {
-                                                       
$content[$j]['row'][$i]['value']                = $entry[$uicols['name'][$i]];
-                                                       
$content[$j]['row'][$i]['name']                 = $uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                    = 
$list_entry[$uicols['name'][$k]];
                                                }
                                        }
+                                       $j++;
+                                               }
+                                       }
 
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
's_agreement_id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
                                        if($this->acl_read)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('view the 
entity');
-                                               $content[$j]['row'][$i]['text'] 
                        = lang('view');
-                                               
$content[$j]['row'][$i++]['link']                       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uis_agreement.view','id'=> $entry['id'], 'role'=> $this->role));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'view',
+                                                       'statustext'    => 
lang('view this entity'),
+                                                       'text'                  
=> lang('view'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.view',
+                                                                               
'role'                  => $this->role
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
                                        }
+
                                        if($this->acl_edit)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
s_agreement');
-                                               $content[$j]['row'][$i]['text'] 
                        = lang('edit');
-                                               
$content[$j]['row'][$i++]['link']                       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uis_agreement.edit','id'=> $entry['id'], 'role'=> $this->role));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'    => 
lang('edit this entity'),
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.edit',
+                                                                               
'role'                  => $this->role
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
                                        }
+
                                        if($this->acl_delete)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('delete the 
s_agreement');
-                                               $content[$j]['row'][$i]['text'] 
                        = lang('delete');
-                                               
$content[$j]['row'][$i++]['link']                       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uis_agreement.delete', 's_agreement_id'=> $entry['id'], 'role'=> 
$this->role));
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'delete',
+                                                       'statustext'    => 
lang('delete this entity'),
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.delete',
+                                                                               
'role'                  => $this->role
+                                                                       )),
+                                               'parameters'    => $parameters2
+                                               );
                                        }
 
-                                       $j++;
-                               }
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add an entity'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.edit',
+                                                                               
'role'                  => $this->role
+                                                                       ))
+                                               );
                        }
 
-//html_print_r($content);
-                       for ($i=0;$i<count($uicols['descr']);$i++)
+                       unset($parameters);
+                       unset($parameters2);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
                                if($uicols['input_type'][$i]!='hidden')
                                {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if(!isset($uicols['datatype'][$i]) || 
($uicols['datatype'][$i]!='T' && $uicols['datatype'][$i]!='CH'))
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id' || 
$uicols['name'][$i]=='name' || $uicols['name'][$i]=='org_name' || 
$uicols['name'][$i]=='category' || $uicols['name'][$i]=='start_date' || 
$uicols['name'][$i]=='end_date' || $uicols['name'][$i]=='status')
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
= $this->nextmatchs->show_sort_order(array
-                                                       (
-                                                               'sort'  => 
$this->sort,
-                                                               'var'   => 
$uicols['name'][$i],
-                                                               'order' => 
$this->order,
-                                                               'extra' => 
array('menuaction'   => 'property.uis_agreement.index',
-                                                                               
                        'query'         => $this->query,
-                                                                               
//                      'lookup'        => $lookup,
-                                                                               
//                      'district_id'   => $this->district_id,
-                                                                               
//                      'start_date'    => $start_date,
-                                                                               
                        'role'          => $this->role,
-                                                                               
                        'member_id'     => $this->member_id,
-                                                                               
                        'allrows'       => $this->allrows,
-                                                                               
//                      'end_date'      => $end_date
-                                                                               
                        )
-                                                       ));
-                                       }
-                               }
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                        }
 
-                       if($this->acl_read)
+                                       if($uicols['name'][$i]=='category')
                        {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
-                               $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'org_name';
                        }
-                       if($this->acl_edit)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('edit');
-                               $i++;
                        }
-                       if($this->acl_delete)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('delete');
-                               $i++;
                        }
 
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       if($this->acl_add)
-                       {
-                               $table_add = array
-                               (
-                                       'lang_add'              => lang('add'),
-                                       'lang_add_statustext'   => lang('add a 
service agreement'),
-                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uis_agreement.edit', 'role'=> $this->role))
-                               );
-                       }
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uis_agreement.index',
-                               'sort'          =>$this->sort,
-                               'order'         =>$this->order,
-                               'cat_id'        =>$this->cat_id,
-                               'filter'        =>$this->filter,
-                               'query'         =>$this->query,
-                               'role'          => $this->role,
-                               'member_id'     => $this->member_id
+                       $appname                                        = 
lang('agreement');
+                       $function_msg           = lang('List') . ' ' . 
lang($this->role);
 
-                       );
-
-                       if(!$this->allrows)
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $link_columns = array
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 
'property.uis_agreement.columns',
-                               'role'          => $this->role
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true,'link_data' => $link_data));
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-//_debug_array($member_of_data);
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'lang_columns'                                  
=> lang('columns'),
-                               'link_columns'                                  
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
-                               'lang_columns_help'                             
=> lang('Choose columns'),
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
=> $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                           
=> lang('Select the category the s_agreement belongs to. To do not use a 
category select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
=> $this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'s_agreement','order'=>'descr')),
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
 
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'lang_no_vendor'                                
=> lang('no vendor'),
-                               'lang_vendor_statustext'                        
=> lang('Select the vendor the s_agreement belongs to.'),
-                               'vendor_list'                                   
=> $this->bo->select_vendor_list('filter',$this->vendor_id),
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
 
-                               'lang_no_member'                                
=> lang('no member'),
-                               'member_of_name'                                
=> 'member_id',
-                               'member_of_list'                                
=> $member_of_data['cat_list'],
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
 
-                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
-                               'lang_filter_statustext'                        
=> lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
-                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
-                               'query'                                         
=> $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
=> $content,
-                               'table_add'                                     
=> $table_add
-                       );
-                       $this->save_sessiondata();
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('service agreement') . ': ' . lang('list ' . $this->role);
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uisagreement.index', 'property' );
                }
 
                function list_content($list,$uicols,$edit_item='',$view_only='')
@@ -401,7 +589,7 @@
                                        }
                                        if($this->acl_edit && !$edit_item && 
!$view_only)
                                        {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
s_agreement');
+                                               
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
agreement');
                                                $content[$j]['row'][$i]['text'] 
                                = lang('edit');
                                                
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uis_agreement.edit_item', 's_agreement_id'=> $entry['agreement_id'], 
'id'=> $entry['id']));
                                        }
@@ -466,6 +654,8 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
                        }
 
+                       $active_tab             = phpgw::get_var('tab', 
'string', 'POST', 'items');
+
                        $import = CreateObject('property.import');
 
                        $importfile = $import->importfile();
@@ -486,7 +676,7 @@
                                        {
                                                $this->bo->import($values,$id);
                                        }
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uis_agreement.edit', 'id'=> $id));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uis_agreement.edit', 'id'=> $id, 'tab' => $active_tab));
                                }
                                else
                                {
@@ -496,30 +686,39 @@
                        }
                        else
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uis_agreement.edit', 'id'=> $id));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uis_agreement.edit', 'id'=> $id, 'tab' => $active_tab));
                        }
                }
 
                function edit()
                {
-                       $id                             = phpgw::get_var('id', 
'int');
+                       $id                             = phpgw::get_var('id'); 
// in case of bigint
+
+                       if(!$this->acl_add && !$this->acl_edit)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uis_agreement.view', 'id'=> $id));
+                       }
+
                        $values                 = phpgw::get_var('values');
-                       $delete_item    = phpgw::get_var('delete_item', 'bool');
-                       $item_id                = phpgw::get_var('item_id', 
'int', 'GET');
+                       $delete_item    = phpgw::get_var('delete_item');
+                       $item_id                = phpgw::get_var('item_id');
+                       $active_tab             = phpgw::get_var('tab', 
'string', 'REQUEST', 'general');
 
                        $config         = 
CreateObject('phpgwapi.config','property');
                        $boalarm                = 
CreateObject('property.boalarm');
+                       $get_items = false;
 
                        if($delete_item && $id && $item_id)
                        {
                                $this->bo->delete_item($id,$item_id);
+                               $get_items = true;
                        }
 
                        $values_attribute  = phpgw::get_var('values_attribute');
 
                        $insert_record_s_agreement = 
$GLOBALS['phpgw']->session->appsession('insert_record_values.s_agreement','property');
 
-//_debug_array($insert_record_s_agreement);
+
                        for ($j=0;$j<count($insert_record_s_agreement);$j++)
                        {
                                
$insert_record['extra'][$insert_record_s_agreement[$j]] = 
$insert_record_s_agreement[$j];
@@ -530,6 +729,7 @@
 
                        if (is_array($values))
                        {
+                               $values['ecodimb']      = 
phpgw::get_var('ecodimb');
                                while (is_array($insert_record['extra']) && 
list($key,$column) = each($insert_record['extra']))
                                {
                                        if($_POST[$key])
@@ -538,7 +738,6 @@
                                        }
                                }
 
-//_debug_array($values);
 
                                if ($values['save'] || $values['apply']):
                                {
@@ -552,11 +751,22 @@
                                                
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
                                        }
 
+
+                                       if(($values['ecodimb'] 
||$values['b_account_id']) && (!isset($values['budget']) || !$values['budget']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Missing budget value'));
+                                       }
+
+
                                        if(!$values['last_name'])
                                        {
 //                                             
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
                                        }
 
+                                       if(isset($values['budget']) && 
$values['budget'] && !ctype_digit($values['budget']))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
+                                       }
 
                                        if($id)
                                        {
@@ -568,6 +778,11 @@
                                                
$values['s_agreement_id']=$this->bo->request_next_id();
                                        }
 
+                                       if(isset($values['delete_b_year']) && 
is_array($values['delete_b_year']))
+                                       {
+                                               
$this->bo->delete_year_from_budget($values['delete_b_year'],$id);
+                                       }
+
                                        $bofiles        = 
CreateObject('property.bofiles');
                                        if(isset($values['file_action']) && 
is_array($values['file_action']))
                                        {
@@ -630,7 +845,7 @@
                                        {
                                                $receipt = 
$this->bo->update($values);
                                        }
-
+                                       $get_items = true;
                                }
                                elseif($values['delete_alarm'] && 
count($values['alarm'])):
                                {
@@ -660,6 +875,7 @@
                                        {
                                                $receipt = 
$boalarm->add_alarm('s_agreement',$this->bo->read_event(array('s_agreement_id'=>$id)),$time,$values['user_id']);
                                        }
+
                                }
                                elseif (!$values['save'] && !$values['apply'] 
&& !$values['update']):
                                {
@@ -668,7 +884,6 @@
                                endif;
                        }
 
-
                        $s_agreement = 
$this->bo->read_single(array('s_agreement_id'=>$id));
 
                        /* Preserve attribute values from post */
@@ -730,6 +945,9 @@
                                                'b_account_id'          => 
$s_agreement['b_account_id'],
                                                'b_account_name'        => 
$s_agreement['b_account_name']));
 
+                       
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array(
+                                               'ecodimb'                       
=> $s_agreement['ecodimb'],
+                                               'ecodimb_descr'         => 
$s_agreement['ecodimb_descr']));
 
                        $alarm_data=$this->bocommon->initiate_ui_alarm(array(
                                                
'acl_location'=>$this->acl_location,
@@ -743,34 +961,6 @@
                                                'account_id'=> $account_id
                                                ));
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true,link_data => array()));
@@ -789,7 +979,7 @@
                                'id'            =>$id
                        );
 
-                       $config->read_repository();
+                       $config->read();
                        $link_to_files = $config->config_data['files_url'];
 
                        $j      = count($s_agreement['files']);
@@ -806,16 +996,418 @@
 
                        
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
                        
$GLOBALS['phpgw']->js->validate_file('core','check','property');
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
 
+                       $tabs = array();
+
+                       if (isset($s_agreement['attributes']) && 
is_array($s_agreement['attributes']))
+                       {
+
+               /*              foreach ($values['attributes'] as & $attribute)
+                               {
+                                       if($attribute['history'] == true)
+                                       {
+                                               $link_history_data = array
+                       (
+                                                       'menuaction'    => 
'property.uis_agreement.attrib_history',
+                                                       'attrib_id'     => 
$attribute['id'],
+                                                       'id'            => $id,
+                                                       'edit'          => true
+                                               );
+
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
+                               }
+               */
+
+                               phpgwapi_yui::tabview_setup('edit_tabview');
+                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
+
+                               $location = $this->acl_location;
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $s_agreement['attributes']);
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($s_agreement['attributes']);
+
+                               $tabs['items']  = array('label' => 
lang('items'), 'link' => '#items');
+                       }
+
+//----------JSON CODE ----------------------------------------------
+
+                       //---GET ITEMS
+                       if( phpgw::get_var('phpgw_return_as') == 'json' &&  
$get_items )
+                       {
+                               //$this->bo->delete_item($id,$item_id);
+                               $list           = $this->bo->read_details($id);
+                               $list           = 
$this->list_content($list,$uicols);
+                               $content        = $list['content'];
+
+                               $content_values = array();
+
+                               for($y=0;$y<count($content);$y++)
+                               {
+                                       
for($z=0;$z<count($content[$y]['row']);$z++)
+                                       {
+                                               
if($content[$y]['row'][$z+1]['name']!='')
+                                               {
+                                                       
$content_values[$y][$content[$y]['row'][$z+1]['name']] = 
$content[$y]['row'][$z+1]['value'];
+                                               }
+                                       }
+                               }
+
+                               /*$datavalues[0] = array
+                               (
+                                               'name'                          
        => "0",
+                                               'values'                        
        => json_encode($content_values),
+                                               'total_records'                 
=> count($content_values),
+                                               'edit_action'                   
=> "''",
+                                               'is_paginator'                  
=> 0,
+                                               'permission'                    
=> json_encode($permissions['rowactions']),
+                                               'footer'                        
        => 0
+                               );*/
+                               if(count($content_values))
+                               {
+                                       return json_encode($content_values);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+
+                       //---GET ALARM
+                       else if( phpgw::get_var('phpgw_return_as') == 'json' && 
!$get_items )
+                       {
+                               
$alarm_data=$this->bocommon->initiate_ui_alarm(array(
+                                               
'acl_location'=>$this->acl_location,
+                                               'alarm_type'=> 's_agreement',
+                                               'type'          => 'form',
+                                               'text'          => 'Email 
notification',
+                                               'times'         => 
isset($times)?$times:'',
+                                               'id'            => $id,
+                                               'method'        => 
isset($method)?$method:'',
+                                               'data'          => 
isset($data)?$data:'',
+                                               'account_id'=> 
isset($account_id)?$account_id:''
+                                               ));
+                               //$alarm_data['values'] = array();
+                               if(count($alarm_data['values']))
+                               {
+                                       return 
json_encode($alarm_data['values']);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+
+                       //--------------------JSON code-----
+
+
+
+
+                       //_debug_array($id);die;
+
+
+
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
's_agreement_id',
+                                               'source'        => $id,
+                                               'ready'         => 1
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'item_id'
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'from',
+                                               'source'        => 
$view_only?'view':'edit',
+                                               'ready'         => 1
+                                       )
+                               )
+                       );
+
+                       $parameters2 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
's_agreement_id',
+                                               'source'        => $id,
+                                               'ready'         => 1
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'item_id'
+                                       )
+                               )
+                       );
+
+                       $parameters3 = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => $id,
+                                               'ready'         => 1
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'item_id',
+                                               'source'        => 'item_id'
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 
'delete_item',
+                                               'source'        => 1,
+                                               'ready'         => 1
+                                       )
+                               )
+                       );
+
+                       //_debug_array($parameters3);die;
+
+                       /*REQUIRES VALIDATION OF PERMISSIONS*/
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => lang('View'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.view_item'
+                                                                       )),
+                                       'parameters'    => $parameters
+                       );
+
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => lang('Edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.edit_item'
+                                                                       )),
+                                       'parameters'    => $parameters2
+                       );
+
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => 
lang('Delete'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.edit'
+                                                                       )),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'parameters'    => $parameters3
+                       );
+
+                       $content_values = array();
+
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<count($content[$y]['row']);$z++)
+                               {
+                                       
if($content[$y]['row'][$z+1]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z+1]['name']] = 
$content[$y]['row'][$z+1]['value'];
+                                       }
+                               }
+                       }
+
+//------- alarm--------
+   $datavalues[0] = array
+   (
+    'name'   => "0",
+    'values'   => json_encode($alarm_data['values']),
+    'total_records' => count($alarm_data['values']),
+    'is_paginator' => 0,
+    'permission'=> '""',
+    'footer'  => 0
+   );
+
+         $myColumnDefs[0] = array
+         (
+          'name'   => "0",
+          'values'  => json_encode(array( array('key' => 'time', 
'label'=>$alarm_data['header'][0]['lang_time'], 
'sortable'=>true,'resizeable'=>true,'width'=>140),
+                    array('key' => 'text', 
'label'=>$alarm_data['header'][0]['lang_text'], 
'sortable'=>true,'resizeable'=>true,'width'=>340),
+                    array('key' => 'user', 
'label'=>$alarm_data['header'][0]['lang_user'], 
'sortable'=>true,'resizeable'=>true,'width'=>200),
+                          array('key' => 
'enabled','label'=>$alarm_data['header'][0]['lang_enabled'],'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterCenter','width'=>60),
+                          array('key' => 
'alarm_id','label'=>"dummy",'sortable'=>true,'resizeable'=>true,'hidden'=>true),
+                          array('key' => 
'select','label'=>$alarm_data['header'][0]['lang_select'], 
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>60)))
+   );
+
+         $myButtons[0] = array
+         (
+          'name'   => "0",
+          'values'  => json_encode(array( array('id' 
=>'values[enable_alarm]','type'=>'buttons', 'value'=>'Enable', 
'label'=>$alarm_data[alter_alarm][0][lang_enable], 'funct'=> 'onActionsClick' , 
'classname'=> 'actionButton', 'value_hidden'=>""),
+                    array('id' =>'values[disable_alarm]','type'=>'buttons', 
'value'=>'Disable', 'label'=>$alarm_data[alter_alarm][0][lang_disable], 
'funct'=> 'onActionsClick' , 'classname'=> 'actionButton', 'value_hidden'=>""),
+                    array('id' =>'values[delete_alarm]','type'=>'buttons', 
'value'=>'Delete', 'label'=>$alarm_data[alter_alarm][0][lang_delete], 'funct'=> 
'onActionsClick' , 'classname'=> 'actionButton', 'value_hidden'=>""),
+                    ))
+   );
+
+         $myButtons[1] = array
+         (
+          'name'   => "1",
+          'values'  => json_encode(array( array(id =>'values[time][days]', 
'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['day_list'],"1_0",'values[time][days]'
 ), 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
+                    array('id' =>'values[time][hours]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['hour_list'],"1_1",'values[time][hours]'),
 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
+                    array('id' =>'values[time][mins]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['minute_list'],"1_2",'values[time][mins]'),
 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
+                    array('id' =>'values[user_id]',  'type'=>'menu',  
'value'=>$this->bocommon->make_menu_user($alarm_data['add_alarm']['user_list'],"1_3",'values[user_id]'),
 
'label'=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"name"),'classname'=>
 'actionsFilter', 
'value_hidden'=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"id")),
+
+                    array('id' =>'values[add_alarm]',  'type'=>'buttons', 
'value'=>'Add',  'label'=>$alarm_data['add_alarm']['lang_add'],   'funct'=> 
'onAddClick' , 'classname'=> 'actionButton', 'value_hidden'=>""),
+                    ))
+   );
+
+
+//---------items------------------------------------
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($content_values),
+                                       'total_records'                 => 
count($content_values),
+                                       'is_paginator'                  => 0,
+                                       'permission'                    => 
json_encode($permissions['rowactions']),
+                                       'footer'                                
=> 0
+                       );
+
+                       $td_count = 0;
+                       $ColumnDefs_data = array();
+                       if(isset($uicols['input_type']) && 
$uicols['input_type'])
+                       {
+                               foreach($uicols['input_type'] as $key => 
$input_type)
+                               {
+                                       if($input_type != 'hidden')
+                                       {
+                                               $ColumnDefs_data[] = array
+                                               (
+                                                       'key'                   
=> $uicols['name'][$key],
+                                                       'label'                 
=> $uicols['descr'][$key],
+                                                       'sortable'              
=> true,
+                                                       'resizeable'    => true
+                                               );
+                                               $td_count ++;
+                                       }
+                               }
+                       }
+
+                       $ColumnDefs_data[] = array
+                       (
+                               'key'                   => 'update',
+                               'label'                 => lang('Update'),
+                               'sortable'              => true,
+                               'resizeable'    => true,
+                               'formatter'             => 
'myFormatterCheckUpdate'
+                       );
+//_debug_array($ColumnDefs_data);
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      
json_encode($ColumnDefs_data)
+                       );
+                       unset($ColumnDefs_data);
+
+                       $myButtons[2] = array
+                       (
+                               'name'                  => "2",
+                               'values'                =>      
json_encode(array(      array('type'=>'text', 'label'=>' New index:', 
'classname'=> 'index-opt'),
+                                                                               
                                array('id' =>'values[new_index]', 
'type'=>'inputText', size=>12, 'classname'=> 'index-opt'),
+                                                                               
                                array('id' 
=>'values[update]','type'=>'buttons',        'value'=>'Update',      
'label'=>'Update',      funct=> onUpdateClick , 'classname'=> '')
+                                                                               
                                ))
+                       );
+
+                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+
+                       for($z=0; $z<count($s_agreement['files']); $z++)
+                       {
+                               if ($link_to_files != '') {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$s_agreement['files'][$z]['directory'].'/'.$s_agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$s_agreement['files'][$z]['name'].'</a>';
+                               }
+                               else {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$s_agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$s_agreement['files'][$z]['name'].'</a>';
+                               }
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$s_agreement['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'" style="cursor:help">';
+                       }
+
+                       $datavalues[2] = array
+                       (
+                                       'name'                                  
=> "2",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'permission'                    => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[2] = array
+                       (
+                               'name'          => "2",
+                               'values'        =>      json_encode(array(      
array('key' => 
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                array('key' => 'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
+                       );
+
+                       if($id)
+                       {
+                               $content_budget = $this->bo->get_budget($id);
+                               foreach($content_budget as & $b_entry)
+                               {
+                                       $b_entry['delete_year'] = '<input 
type="checkbox" name="values[delete_b_year][]" value="'.$b_entry['year'].'" 
title="'.lang('Check to delete year').'">';                               
+                               }
+                       }
+
+                       $datavalues[3] = array
+                       (
+                                       'name'                                  
=> "3",
+                                       'values'                                
=> json_encode($content_budget),
+                                       'total_records'                 => 
count($content_budget),
+                                       'permission'                    => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 1
+                       );
+
+       
+                       $myColumnDefs[3] = array
+                       (
+                               'name'          => "3",
+                               'values'        =>      json_encode(array(      
array('key' => 
'year','label'=>lang('year'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'category','label'=>lang('category'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'ecodimb','label'=>lang('dimb'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 'budget_account','label'=>lang('budget 
account'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 'actual_cost','label'=>lang('actual 
cost'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                array('key' => 'delete_year','label'=>lang('Delete 
budget'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
+                       );
+
+//--------------------------------------------JSON CODE------------
+
+                       $this->cats->app_name           = 'property.project';
+
                        $data = array
                        (
-                               'link_import'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uis_agreement.import')),
+                               'td_count'                                      
=> $td_count,
+                               'property_js'                                   
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                                 
        => json_encode(array('menuaction' => 
"property.uis_agreement.edit",'id'=>$id)),
+                               'datatable'                                     
                => $datavalues,
+                               'myColumnDefs'                                  
        => $myColumnDefs,
+                               'myButtons'                                     
                => $myButtons,
+
+                               'link_import'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uis_agreement.import', 'tab' => 'items')),
                                'alarm_data'                            => 
$alarm_data,
                                'lang_alarm'                            => 
lang('Alarm'),
                                'lang_download'                         => 
'download',
                                'link_download'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                    => 
lang('Download table to your browser'),
+                               'lang_download_help'            => 
lang('Download table to your browser'),
 
                                'fileupload'                            => true,
                                'link_view_file'                        => 
$GLOBALS['phpgw']->link('/index.php',$link_file_data),
@@ -850,13 +1442,7 @@
                                'member_of_name'                        => 
'member_id',
                                'member_of_list'                        => 
$member_of_data['cat_list'],
 
-                               'lang_dateformat'                       => 
lang(strtolower($dateformat)),
-                               'dateformat_validate'                   => 
$dateformat_validate,
-                               'onKeyUp'                               => 
$onKeyUp,
-                               'onBlur'                                => 
$onBlur,
-                               'lang_attributes'                       => 
lang('Attributes'),
-                               'attributes_header'                     => 
$attributes_header,
-                               'attributes_values'                     => 
$s_agreement['attributes'],
+                               'attributes_group'                              
=> $attributes,
                                'lookup_functions'                      => 
$s_agreement['lookup_functions'],
                                'dateformat'                            => 
$dateformat,
 
@@ -876,7 +1462,22 @@
                                'value_termination_date'                => 
$s_agreement['termination_date'],
 
                                'vendor_data'                           => 
$vendor_data,
+
+                               'lang_budget'                                   
=> lang('Budget'),
+                               'lang_budget_statustext'                => 
lang('Budget for selected year'),
+                               'value_budget'                                  
=> $s_agreement['budget'],
+                               'currency'                                      
        => $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+
+                               'lang_year'                                     
        => lang('year'),
+                               'lang_year_statustext'                  => 
lang('Budget year'),
+                               'year'                                          
        => 
$this->bocommon->select_list($s_agreement['year'],$this->bo->get_year_list($id)),
+
                                'b_account_data'                        => 
$b_account_data,
+                               'ecodimb_data'                          => 
$ecodimb_data,
+                               'lang_category'                                 
        => lang('category'),
+                               'lang_no_cat'                                   
        => lang('Select category'),
+                               'cat_select'                                    
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[order_category]','selected' => $s_agreement['order_category'])),
+
                                'lang_name'                             => 
lang('name'),
                                'lang_name_statustext'                  => 
lang('name'),
                                'value_name'                            => 
$s_agreement['name'],
@@ -896,17 +1497,38 @@
                                'lang_detail_import_statustext'=> lang('import 
details to this agreement from spreadsheet'),
                                'lang_import'                           => 
lang('import'),
                                'textareacols'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
+                               'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               'tabs'                                          
=> phpgwapi_yui::tabview_generate($tabs, $active_tab)
                        );
 
+//_debug_array($data);die;
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('service agreement') . ': ' . ($id?lang('edit') . ' ' . 
lang($this->role):lang('add') . ' ' . lang($this->role));
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uis_agreement.edit', 'property' );
                }
 
                function download()
                {
+                       if(!$this->acl_read)
+                       {
+                               return;
+                       }
                        $id     = phpgw::get_var('id', 'int');
                        $list = $this->bo->read_details($id);
                        $uicols         = $this->bo->uicols;
@@ -915,7 +1537,12 @@
 
                function edit_item()
                {
-                       $s_agreement_id = phpgw::get_var('s_agreement_id', 
'int');
+                       if(!$this->acl_add && !$this->acl_edit)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>2, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $s_agreement_id = phpgw::get_var('s_agreement_id'); // 
in case of bigint
                        $id     = phpgw::get_var('id', 'int');
                        $values         = phpgw::get_var('values');
                        $delete_last    = phpgw::get_var('delete_last', 'bool', 
'GET');
@@ -1020,34 +1647,6 @@
                        );
 
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $member_of_data = 
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals' 
=> true,link_data => array()));
@@ -1072,6 +1671,40 @@
                        $content        = $list['content'];
                        $table_header=$list['table_header'];
 
+                       //------JSON code-------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               $content_values = array();
+                               $hidden = '';
+
+                               for($y=0;$y<count($content);$y++)
+                               {
+                                       
for($z=0;$z<count($content[$y]['row']);$z++)
+                                       {
+                                               
if($content[$y]['row'][$z]['name']!='')
+                                               {
+                                                       
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                               }
+                                       }
+                               }
+
+                               $hidden .= " <input 
name='values[select][".$content_values[$y - 1]['item_id']."]'  type='hidden' 
value='".$content_values[$y - 1]['cost']."'/>";
+                               $hidden .= " <input 
name='values[id][".$content_values[$y - 1]['item_id']."]'  type='hidden' 
value='".$content_values[$y - 1]['index_count']."'/>";
+
+                               $content_values[$y - 1]['index_date'] .= 
$hidden;
+
+                               if(count($content_values))
+                               {
+                                       return json_encode($content_values);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+                       //--------------------JSON code-----
+
+
                        for ($i=0; $i<count($list['content'][0]['row']); $i++)
                        {
                                $set_column[]=true;
@@ -1104,30 +1737,160 @@
                                                'entity_data'   => $values['p']
                                                ));
 
-                       for ($i=0;$i<count($values['attributes']);$i++)
+                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                       
$GLOBALS['phpgw']->js->validate_file('core','check','property');
+
+                       //$tabs = array();
+
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
-                               if($values['attributes'][$i]['history']==1)
+                               foreach ($values['attributes'] as & $attribute)
                                {
+                                       if($attribute['history'] == true)
+                               {
                                        $link_history_data = array
                                        (
-                                               'menuaction'    => 
'property.uis_agreement.attrib_history',
-                                               's_agreement_id'        => 
$s_agreement_id,
-                                               'attrib_id'     => 
$values['attributes'][$i]['id'],
-                                               'item_id'       => $id,
+                                                       'menuaction'    => 
'property.uientity.attrib_history',
+                                                       'acl_location'  => 
'.s_agreement',
+                                                       'id'                    
=> $s_agreement_id,
+                                                       'attrib_id'             
=> $attribute['id'],
+                                                       'detail_id'             
=> $id,
                                                'edit'          => true,
                                                'role'          =>'detail'
                                        );
 
-                                       
$values['attributes'][$i]['link_history']=$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
                                }
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-                       
$GLOBALS['phpgw']->js->validate_file('core','check','property');
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
+                               //phpgwapi_yui::tabview_setup('edit_tabview');
+                               //$tabs['general']      = array('label' => 
lang('general'), 'link' => '#general');
 
+                               $location = $this->acl_location . '.detail';
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $values['attributes']);
+
+                               $attributes = array();
+                               foreach ($attributes_groups as $group)
+                               {
+                                       if(isset($group['attributes']))
+                                       {
+                                               $attributes[] = $group;
+                                       }
+                               }
+                               unset($attributes_groups);
+                               unset($s_agreement['attributes']);
+
+                               /*if($content)
+                               {
+                                       $tabs['history']        = array('label' 
=> lang('history'), 'link' => '#history');
+                               }*/
+                       }
+
+                       $content_values = array();
+
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<count($content[$y]['row']);$z++)
+                               {
+                                       if($content[$y]['row'][$z]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                       }
+                               }
+                       }
+
+                       $hidden = '';
+
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<count($content[$y]['row']);$z++)
+                               {
+                                       if($content[$y]['row'][$z]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                       }
+                               }
+                       }
+                       $hidden .= " <input 
name='values[select][".$content_values[$y - 1]['item_id']."]'  type='hidden' 
value='".$content_values[$y - 1]['cost']."'/>";
+                       $hidden .= " <input 
name='values[id][".$content_values[$y - 1]['item_id']."]'  type='hidden' 
value='".$content_values[$y - 1]['index_count']."'/>";
+
+                       $content_values[$y - 1]['index_date'] .= $hidden;
+
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
's_agreement_id',
+                                               'source'        => 
$s_agreement_id,
+                                               'ready'         => 1
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'from',
+                                               'source'        => 
$view_only?'view':'edit',
+                                               'ready'         => 1
+                                       )
+                               )
+                       );
+
+
+                       /*REQUIRES VALIDATION OF PERMISSIONS*/
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => lang('View'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.view_item'
+                                                                       )),
+                                       'parameters'    => $parameters
+                       );
+
+
+
+
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($content_values),
+                                       'total_records'                 => 
count($content_values),
+                                       'is_paginator'                  => 0,
+                                       'permission'                    => 
json_encode($permissions['rowactions']),
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array('key' => 
'item_id','label'=>lang('ID'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'cost','label'=>lang('Cost'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'this_index','label'=>lang('index'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'index_count','label'=>lang('index_count'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'index_date','label'=>lang('Date'),'sortable'=>true,'resizeable'=>true)))
+                       );
+
+                       $myButtons[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array('type'=>'text', 'label'=>'New index', 
'classname'=> 'index-opt'),
+                                                                               
                                array('id' =>'values[new_index]', 
'type'=>'inputText', size=>12, 'classname'=> 'index-opt'),
+                                                                               
                                array('id' 
=>'values[update]','type'=>'buttons',        'value'=>'Update',      
'label'=>'Update',      'funct'=> 'onAddClick' , 'classname'=> ''),
+                                                                               
                                array('id' =>'delete','type'=>'buttons',        
'value'=>'Delete',      'label'=>lang('delete last index'),     'funct'=> 
'onDeleteClick' , 'classname'=> '')
+                                                                               
                                ))
+                       );
+
+
+
+
                        $data = array
                        (
+                               'property_js'                                   
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                                 
        => json_encode(array('menuaction' => 
"property.uis_agreement.edit_item",'id'=>$id,'s_agreement_id'=>$s_agreement_id)),
+                               'datatable'                                     
                => $datavalues,
+                               'myColumnDefs'                                  
        => $myColumnDefs,
+                               'myButtons'                                     
                => $myButtons,
+
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'edit_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_id'                                       
=> lang('ID'),
@@ -1141,17 +1904,10 @@
                                'lang_cancel_statustext'                        
=> lang('Leave the service agreement untouched and return back to the list'),
                                'lang_save_statustext'                          
=> lang('Save the service agreement and return back to the list'),
 
-                               'lang_dateformat'                               
=> lang(strtolower($dateformat)),
-                               'dateformat_validate'                           
=> $dateformat_validate,
-                               'onKeyUp'                                       
=> $onKeyUp,
-                               'onBlur'                                        
=> $onBlur,
-                               'lang_attributes'                               
=> lang('Attributes'),
-                               'attributes_header'                             
=> $attributes_header,
-                               'attributes_values'                             
=> $values['attributes'],
+                               'attributes_group'                              
=> $attributes,
                                'lookup_functions'                              
=> $values['lookup_functions'],
-                               'dateformat'                                    
=> $dateformat,
 
-                               'img_cal'                                       
        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                       //      'img_cal'                                       
        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
                                'lang_datetitle'                                
=> lang('Select date'),
 
                                'lang_agreement'                                
=> lang('Agreement'),
@@ -1167,6 +1923,7 @@
                                'img_check'                                     
=> $GLOBALS['phpgw']->common->get_image_path('property').'/check.png',
                                'location_data'                                 
=> $location_data,
 
+                               'img_cal'                                       
        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
                                'lang_cost'                                     
=> lang('cost'),
                                'lang_cost_statustext'                          
=> lang('cost'),
                                'value_cost'                                    
=> $values['cost'],
@@ -1179,20 +1936,42 @@
                                'lang_history_help'                             
=> lang('history of this attribute'),
                                'lang_history_date_statustext'  => lang('Enter 
the date for this reading'),
                                'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
-                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               //'tabs'                                        
                => phpgwapi_yui::tabview_generate($tabs, 'general')
                        );
 
+                       //_debug_array($data['values']);die;
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('service agreement') . ': ' . ($values['id']?lang('edit item') . ' ' . 
$s_agreement['name']:lang('add item') . ' ' . $s_agreement['name']);
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_item' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uis_agreement.edit_item', 'property' );
+
                }
 
                function view_item()
                {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
                        $from = phpgw::get_var('from');
                        $from = $from == 'edit'?'edit':'view';
-                       $s_agreement_id = phpgw::get_var('s_agreement_id', 
'int');
+                       $s_agreement_id = phpgw::get_var('s_agreement_id'); // 
in case of bigint
                        $id     = phpgw::get_var('id', 'int');
 
                        $bolocation                     = 
CreateObject('property.bolocation');
@@ -1227,6 +2006,8 @@
                        $content        = $list['content'];
                        $table_header=$list['table_header'];
 
+//_debug_array($table_header[0]['header']); die;
+
                        $lookup_type='view';
 
                        $location_data=$bolocation->initiate_ui_location(array(
@@ -1240,29 +2021,101 @@
                                                ));
 
 
-                       for ($i=0;$i<count($values['attributes']);$i++)
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
-                               if($values['attributes'][$i]['history']==1)
+                               foreach ($values['attributes'] as & $attribute)
+                       {
+                                       if($attribute['history'] == true)
                                {
                                        $link_history_data = array
                                        (
-                                               'menuaction'    => 
'property.uis_agreement.attrib_history',
-                                               's_agreement_id'        => 
$s_agreement_id,
-                                               'attrib_id'     => 
$values['attributes'][$i]['id'],
-                                               'item_id'       => $id,
+                                                       'menuaction'    => 
'property.uientity.attrib_history',
+                                                       'acl_location'  => 
'.s_agreement',
+                                                       'id'                    
=> $s_agreement_id,
+                                                       'attrib_id'             
=> $attribute['id'],
+                                                       'detail_id'             
=> $id,
                                                'edit'          => false,
                                                'role'          =>'detail'
                                        );
 
-                                       
$values['attributes'][$i]['link_history']=$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                               $attribute['link_history'] = 
$GLOBALS['phpgw']->link('/index.php',$link_history_data);
+                                       }
                                }
                        }
 
+
                        
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
                        
$GLOBALS['phpgw']->js->validate_file('core','check','property');
 
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
's_agreement_id',
+                                               'source'        => 
$s_agreement_id,
+                                               'ready'         => 1
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'from',
+                                               'source'        => 'edit',
+                                               'ready'         => 1
+                                       )
+                               )
+                       );
+
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => lang('View'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.view_item'
+                                                                       )),
+                                       'parameters'    => $parameters
+                       );
+
+                       $content_values = array();
+
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<=count($content[$y]['row']);$z++)
+                               {
+                                       if($content[$y]['row'][$z]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z]['name']] = 
$content[$y]['row'][$z]['value'];
+                                       }
+                               }
+                       }
+
+                    $datavalues[0] = array
+                    (
+                           'name'              => "0",
+                           'values'            => json_encode($content_values),
+                           'total_records' => count($content_values),
+                           'is_paginator'  => 0,
+                           'permission'        => 
json_encode($permissions['rowactions']),
+                           'footer'            => 0
+                    );
+
+                $myColumnDefs[0] = array
+                (
+                       'name'   => "0",
+                       'values'  => json_encode(array( array('key' => 
'item_id', 'label'=>$table_header[0]['header'], 
'sortable'=>true,'resizeable'=>true,'width'=>140),
+                                 array('key' => 'cost', 
'label'=>$table_header[2]['header'], 
'sortable'=>true,'resizeable'=>true,'width'=>340),
+                                 array('key' => 'this_index', 
'label'=>$table_header[3]['header'], 
'sortable'=>true,'resizeable'=>true,'width'=>200),
+                                 array('key' => 'index_count', 
'label'=>$table_header[4]['header'],'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterCenter','width'=>60),
+                                 array('key' => 'index_date', 
'label'=>$table_header[5]['header'],'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterCenter','width'=>60)))
+                         );
+
+
                        $data = array
                        (
+                               'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                                 
=> json_encode(array('menuaction' => "property.uis_agreement.view_item")),
+                               'datatable'                                     
        => $datavalues,
+                               'myColumnDefs'                                  
=> $myColumnDefs,
+
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'edit_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_id'                                       
        => lang('ID'),
@@ -1293,30 +2146,50 @@
                                'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
                        );
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('service agreement') . ': ' . lang('view item') . ' ' . 
$s_agreement['name'];
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view_item' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uis_agreement.edit', 'property' );
+
                }
 
 
                function delete()
                {
-                       $s_agreement_id = phpgw::get_var('s_agreement_id', 
'int');
+                       if(!$this->acl_delete)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>8, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $s_agreement_id = phpgw::get_var('s_agreement_id'); // 
in case of bigint
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
+                       //json code delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($s_agreement_id);
+                               return "s_agreement_id ".$s_agreement_id." 
".lang("has been deleted");
+                       }
+
                        $link_data = array
                        (
                                'menuaction'    => 
'property.uis_agreement.index',
                                'role'          => $this->role
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               $this->bo->delete($s_agreement_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array
@@ -1342,7 +2215,12 @@
 
                function view()
                {
-                       $s_agreement_id = phpgw::get_var('id', 'int');
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $s_agreement_id = phpgw::get_var('id'); // in case of 
bigint
                        $config         = 
CreateObject('phpgwapi.config','property');
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement', 'attributes_view', 
'files'));
@@ -1408,11 +2286,11 @@
                        $link_file_data = array
                        (
                                'menuaction'    => 
'property.uis_agreement.view_file',
-                               'id'            =>$s_agreement_id
+                               'id'            =>              $s_agreement_id
                        );
 
 
-                       $config->read_repository();
+                       $config->read();
                        $link_to_files = $config->config_data['files_url'];
 
                        $j      = count($s_agreement['files']);
@@ -1422,8 +2300,167 @@
                        }
 
 
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 
's_agreement_id',
+                                               'source'        => 
$s_agreement_id,
+                                               'ready'         => 1
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'item_id'
+                                       ),
+                                       array
+                                       (
+                                               'name'          => 'from',
+                                               'source'        => 'view',
+                                               'ready'         => 1
+                                       )
+                               )
+                       );
+
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => lang('View'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uis_agreement.view_item'
+                                                                       )),
+                                       'parameters'    => $parameters
+                       );
+
+
+//------- alarm--------
+            $datavalues[0] = array
+            (
+                   'name'              => "0",
+                   'values'            => json_encode($alarm_data['values']),
+                   'total_records' => count($alarm_data['values']),
+                   'is_paginator'  => 0,
+                   'permission'        => '""',
+                   'footer'            => 0
+            );
+
+         $myColumnDefs[0] = array
+         (
+               'name'   => "0",
+               'values'  => json_encode(array( array('key' => 'time', 
'label'=>$alarm_data['header'][0]['lang_time'], 
'sortable'=>true,'resizeable'=>true,'width'=>140),
+                         array('key' => 'text', 
'label'=>$alarm_data['header'][0]['lang_text'], 
'sortable'=>true,'resizeable'=>true,'width'=>340),
+                         array('key' => 'user', 
'label'=>$alarm_data['header'][0]['lang_user'], 
'sortable'=>true,'resizeable'=>true,'width'=>200),
+                          array('key' => 
'enabled','label'=>$alarm_data['header'][0]['lang_enabled'],'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterCenter','width'=>60),
+                          array('key' => 
'alarm_id','label'=>"dummy",'sortable'=>true,'resizeable'=>true,'hidden'=>true)))
+                 );
+
+
+                       $content_values = array();
+
+                       for($y=0;$y<count($content);$y++)
+                       {
+                               for($z=0;$z<count($content[$y]['row']);$z++)
+                               {
+                                       
if($content[$y]['row'][$z+1]['name']!='')
+                                       {
+                                               
$content_values[$y][$content[$y]['row'][$z+1]['name']] = 
$content[$y]['row'][$z+1]['value'];
+                                       }
+                               }
+                       }
+
+//---------items------------------------------------
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($content_values),
+                                       'total_records'                 => 
count($content_values),
+                                       'is_paginator'                  => 1,
+                                       'permission'                    => 
json_encode($permissions['rowactions']),
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      json_encode(array(      
array('key' => 
'item_id','label'=>lang('ID'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'location_code','label'=>lang('Location'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'address','label'=>lang('Address'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'p_entity_id','label'=>lang('entity_id'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'p_cat_id','label'=>lang('cat_id'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'p_num','label'=>lang('entity_num'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'cost','label'=>lang('Cost'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'this_index','label'=>lang('index'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'index_count','label'=>lang('index_count'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'index_date','label'=>lang('Date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'enhet','label'=>lang('Enhet'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'quantity','label'=>lang('mengde'),'sortable'=>true,'resizeable'=>true)))
+                       );
+
+//---datatable2 settings---------------------------------------------------
+
+                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+
+                       for($z=0; $z<count($s_agreement['files']); $z++)
+                       {
+                               if ($link_to_files != '')
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$s_agreement['files'][$z]['directory'].'/'.$s_agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$s_agreement['files'][$z]['name'].'</a>';
+                               }
+                               else
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$s_agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$s_agreement['files'][$z]['name'].'</a>';
+                               }
+                       }
+
+                       $datavalues[2] = array
+                       (
+                                       'name'                                  
=> "2",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'permission'                    => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[2] = array
+                       (
+                               'name'          => "2",
+                               'values'        =>      
json_encode(array(array('key' => 
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true)))
+                       );
+
+
+                       $content_budget = 
$this->bo->get_budget($s_agreement_id);
+
+                       $datavalues[3] = array
+                       (
+                                       'name'                                  
=> "3",
+                                       'values'                                
=> json_encode($content_budget),
+                                       'total_records'                 => 
count($content_budget),
+                                       'permission'                    => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 1
+                       );
+
+                       $myColumnDefs[3] = array
+                       (
+                               'name'          => "3",
+                               'values'        =>      json_encode(array(      
array('key' => 
'year','label'=>lang('year'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'category','label'=>lang('category'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'ecodimb','label'=>lang('dimb'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 'budget_account','label'=>lang('budget 
account'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                        array('key' => 'actual_cost','label'=>lang('actual 
cost'),'sortable'=>false,'resizeable'=>true)))
+                       );
+
                        $data = array
                        (
+                               'lang_budget'                                   
=> lang('budget'),
+                               'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                                 
=> json_encode(array('menuaction' => "property.uis_agreement.view")),
+                               'datatable'                                     
        => $datavalues,
+                               'myColumnDefs'                                  
=> $myColumnDefs,
+
                                'lang_total_records'                            
=> lang('Total'),
                                'total_records'                                 
=> $total_records,
                                'alarm_data'                                    
=> $alarm_data,
@@ -1476,110 +2513,25 @@
                                'textarearows'                          => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
                        );
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('service agreement') . ': ' . lang('view');
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uis_agreement.edit', 'property' );
+
+                       
//$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
-
-
-               function attrib_history()
-               {
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('attrib_history','nextmatchs'));
-                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
-                       $s_agreement_id         = 
phpgw::get_var('s_agreement_id', 'int');
-                       $item_id        = phpgw::get_var('item_id', 'int');
-                       $attrib_id      = phpgw::get_var('attrib_id', 'int');
-
-                       $data_lookup= array(
-                               'id'            => $s_agreement_id,
-                               'item_id'       => $item_id,
-                               'attrib_id'     => $attrib_id
-                               );
-
-                       $delete = phpgw::get_var('delete', 'bool');
-                       $edit = phpgw::get_var('edit', 'bool');
-
-                       if ($delete)
-                       {
-                               $data_lookup['history_id'] = 
phpgw::get_var('history_id', 'int');
-                               $this->bo->delete_history_item($data_lookup);
-                       }
-
-                       $values = $this->bo->read_attrib_history($data_lookup);
-                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
-                       while (is_array($values) && list(,$entry) = 
each($values))
-                       {
-                               $link_delete_history_data = array
-                                       (
-                                               'menuaction'            => 
'property.uis_agreement.attrib_history',
-                                               's_agreement_id'        => 
$s_agreement_id,
-                                               'item_id'                       
=> $item_id,
-                                               'attrib_id'                     
=> $attrib_id,
-                                               'history_id'            => 
$entry['id'],
-                                               'delete'                        
=> true,
-                                               'edit'                          
=> true,
-                                               'role'                          
=> $this->bo->role
-                                       );
-
-                               if($edit)
-                               {
-                                       $text_delete    = lang('delete');
-                                       $link_delete    = 
$GLOBALS['phpgw']->link('/index.php',$link_delete_history_data);
-                               }
-
-                               $content[] = array
-                               (
-                                       'id'                                    
        => $entry['id'],
-                                       'value'                                 
        => $entry['new_value'],
-                                       'user'                                  
        => $entry['owner'],
-                                       'time_created'                          
=> $GLOBALS['phpgw']->common->show_date($entry['datetime'],$dateformat),
-                                       'link_delete'                           
=> $link_delete,
-                                       'lang_delete_statustext'        => 
lang('delete the item'),
-                                       'text_delete'                           
=> $text_delete,
-                               );
-                       }
-
-
-                       $table_header = array
-                       (
-                               'lang_value'            => lang('value'),
-                               'lang_user'                     => lang('user'),
-                               'lang_time_created'     => lang('time created'),
-                               'lang_delete'           => lang('delete')
-                       );
-
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uis_agreement.attrib_history',
-                               's_agreement_id'=> $s_agreement_id,
-                               'item_id'               => $item_id,
-                               'attrib_id'             => $attrib_id,
-                               'edit'                  => $edit
-                       );
-
-                       $data = array
-                       (
-                               'allow_allrows'         => false,
-                               'start_record'          => $this->start,
-                               'record_limit'          => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'           => count($values),
-                               'all_records'           => 
$this->bo->total_records,
-                               'link_url'                      => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                      => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'values'                        => $content,
-                               'table_header'          => $table_header,
-                       );
-
-                       $attrib_data    = $this->custom->get('property', 
'.s_agreement.detail', $attrib_id);
-                       $appname        = $attrib_data['input_text'];
-
-                       $function_msg   = lang('history');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('attrib_history' => $data));
-               }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.uistandard_2.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uistandard_2.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uistandard_2.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -57,8 +58,6 @@
                        $type   = phpgw::get_var('type');
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
phpgw::get_var('menu_selection');
 
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                                       = 
CreateObject('property.bostandard_2',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
@@ -100,95 +99,278 @@
 
                        $type   = phpgw::get_var('type');
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_2','nextmatchs',
-                                                                               
'search_field'));
+                       $datatable = array();
 
-                       $standard_list = $this->bo->read($type);
-
-                       while (is_array($standard_list) && list(,$standard) = 
each($standard_list))
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uistandard_2.index',
+                                       'type'          => $type
+                               ));
 
-                               $content[] = array
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uistandard_2.index',"
+                                                                               
                        ."type:'{$type}'";
+
+                               $link_data = array
                                (
-                                       'id'                                    
=> $standard['id'],
-                                       'first'                                 
=> $standard['descr'],
-                                       'link_edit'                             
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uistandard_2.edit', 'id'=> $standard['id'], 'type'=> $type, 
'menu_selection' => $GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                       'link_delete'                           
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uistandard_2.delete', 'id'=> $standard['id'], 'type'=> $type, 
'menu_selection' => $GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                                       'lang_view_standardtext'                
=> lang('view the standard'),
-                                       'lang_edit_standardtext'                
=> lang('edit the standard'),
-                                       'lang_delete_standardtext'              
=> lang('delete the standard'),
-                                       'text_view'                             
=> lang('view'),
-                                       'text_edit'                             
=> lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
+                                       'menuaction'    => 
'property.uistandard_2.index',
+                                       'type'          => $type
                                );
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uistandard_2.index',
+                                                               'type'          
=> $type
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array
+                                                               (
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 9
+                                                                               
    ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       )
+                                                                               
)
+                                                                               
)
+                                        )
+                               );
+                               $dry_run = true;
                        }
 
-//_debug_array($content);
+                       $standard_list = $this->bo->read($type);
+                       $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('standard id');
+                       $uicols['name'][1]      = 'descr';
+                       $uicols['descr'][1]     = lang('Descr');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
 
-                       $table_header[] = array
+                       if (isset($standard_list) AND is_array($standard_list))
+                       {
+                               foreach($standard_list as $list_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $list_entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       //_debug_array($datatable);die;
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
                        (
+                               'parameter' => array
+                       (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
 
-                               'lang_descr'            => lang('Descr'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_id'               => 
$this->nextmatchs->show_sort_order(array
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'    => 
lang('edit the actor'),
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uistandard_2.index',
-                                                                               
                                'type'  =>$type,
+                                                                               
'menuaction'            => 'property.uistandard_2.edit',
+                                                                               
'type'                          => $type,
                                                                                
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
-                                                                               
                                )
                                                                                
)),
-                               'lang_id'               => lang('standard id'),
+                                               'parameters'    => $parameters
                        );
+                       }
 
-                       $table_add[] = array
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'delete',
+                                                       'statustext'    => 
lang('delete the actor'),
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_add'              => lang('add'),
-                               'lang_add_standardtext' => lang('add a 
standard'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uistandard_2.edit', 'type'=> $type, 'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection'])),
-                               'lang_done'             => lang('done'),
-                               'lang_done_standardtext'=> lang('back to 
admin'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/admin/index.php')
+                                                                               
'menuaction'    => 'property.uistandard_2.delete',
+                                                                               
'type'                          => $type,
+                                                                               
'menu_selection'        => $GLOBALS['phpgw_info']['flags']['menu_selection']
+                                                                       )),
+                                               'parameters'    => $parameters
                        );
+                       }
+                       unset($parameters);
 
-                       if(!$this->allrows)
+                       if($this->acl_add)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uistandard_2.edit',
+                                                                               
'type'                          => $type,
+                                                                               
'menu_selection'        => $GLOBALS['phpgw_info']['flags']['menu_selection']
+                                                                       ))
+                                               );
                        }
-                       else
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               $record_limit   = $this->bo->total_records;
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
+                                       }
+                               }
                        }
 
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       $data = array
-                       (
-                               'allow_allrows'                         => true,
-                               'allrows'                               => 
$this->allrows,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($standard_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uistandard_2.index', 'type'=> $type)),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_searchfield_standardtext'         => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_standardtext'        => 
lang('Submit the search string'),
-                               'query'                                 => 
$this->query,
-                               'lang_search'                           => 
lang('search'),
-                               'table_header'                          => 
$table_header,
-                               'values'                                => 
$content,
-                               'table_add'                             => 
$table_add
-                       );
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($standard_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-                       $appname        = lang($type);
+                       $appname                                        = 
lang('unit');
                        $function_msg   = lang('list '.$type.' standard');
 
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uistandard_2.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
@@ -200,7 +382,7 @@
                        }
 
                        $type           = phpgw::get_var('type');
-                       $id             = phpgw::get_var('id', 'int');
+                       $id             = phpgw::get_var('id');
                        $values         = phpgw::get_var('values');
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_2'));
@@ -281,9 +463,17 @@
                        }
 
                        $type   = phpgw::get_var('type');
-                       $id             = phpgw::get_var('id', 'int');
+                       $id             = phpgw::get_var('id');
                        $confirm                = phpgw::get_var('confirm', 
'bool', 'POST');
 
+                       //json code delete
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id,$type);
+                               return "id ".$id." ".lang("has been deleted");
+                               
+                       }                       
+
                        $link_data = array
                        (
                                'menuaction' => 'property.uistandard_2.index',
@@ -291,12 +481,8 @@
                                'menu_selection' => 
$GLOBALS['phpgw_info']['flags']['menu_selection']
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               $this->bo->delete($id,$type);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
 
+
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array

Modified: people/sigurdne/modules/property/trunk/inc/class.uistandard_3.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uistandard_3.inc.php       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uistandard_3.inc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -26,6 +26,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.yui');
 
        /**
         * Description
@@ -54,7 +55,6 @@
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
 
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                               = 
CreateObject('property.bostandard_3',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
@@ -98,6 +98,301 @@
 
                        $type   = phpgw::get_var('type');
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'    => 
'property.uistandard_3.index',
+                                       'type'          => $type
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uistandard_3.index',"
+                                                                               
                        ."type:'{$type}'";
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uistandard_3.index',
+                                       'type'          => $type
+                               );
+
+                               $datatable['config']['allow_allrows'] = false;
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
=> 'property.uistandard_3.index',
+                                                               'type'          
=> $type
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array
+                                                               (
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 9
+                                                                               
    ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 8
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 7
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 6
+                                                                       )
+                                                                               
)
+                                                                               
)
+                                        )
+                               );
+                               $dry_run = true;
+                       }
+
+                       $standard_list = $this->bo->read($type);
+                       $uicols['name'][0]      = 'id';
+                       $uicols['descr'][0]     = lang('standard id');
+                       $uicols['name'][1]      = 'num';
+                       $uicols['descr'][1]     = lang('Name');
+                       $uicols['name'][2]      = 'descr';
+                       $uicols['descr'][2]     = lang('Description');
+                       $j = 0;
+                       $count_uicols_name = count($uicols['name']);
+
+                       if (isset($standard_list) AND is_array($standard_list))
+                       {
+                               foreach($standard_list as $list_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
if($uicols['input_type'][$k]!='hidden')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']                     = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']                            
= $list_entry[$uicols['name'][$k]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       //_debug_array($datatable);die;
+                       $datatable['rowactions']['action'] = array();
+
+                       $parameters = array
+                       (
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
+                               )
+                       );
+
+                       if($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'edit',
+                                                       'statustext'    => 
lang('edit the actor'),
+                                                       'text'                  
=> lang('edit'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'            => 'property.uistandard_3.edit',
+                                                                               
'type'                          => $type,
+                                                                               
'menu_selection'        => $GLOBALS['phpgw_info']['flags']['menu_selection']
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
+                       }
+
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'delete',
+                                                       'statustext'    => 
lang('delete the actor'),
+                                                       'text'                  
=> lang('delete'),
+                                                       'confirm_msg'   => 
lang('do you really want to delete this entry'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uistandard_3.delete',
+                                                                               
'type'                          => $type,
+                                                                               
'menu_selection'        => $GLOBALS['phpgw_info']['flags']['menu_selection']
+                                                                       )),
+                                               'parameters'    => $parameters
+                                               );
+                       }
+                       unset($parameters);
+
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'add',
+                                                       'statustext'    => 
lang('add'),
+                                                       'text'                  
=> lang('add'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uistandard_3.edit',
+                                                                               
'type'                          => $type,
+                                                                               
'menu_selection'        => $GLOBALS['phpgw_info']['flags']['menu_selection']
+                                                                       ))
+                                               );
+                       }
+
+                       $datatable['rowactions']['action'][] = array(
+                                                       'my_name'               
        => 'done',
+                                                       'statustext'    => 
lang('done'),
+                                                       'text'                  
=> lang('done'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/admin/index.php')
+                                               );
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'id';
+                                       }
+
+                                       if($uicols['name'][$i]=='num')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'num';
+                                       }
+                               }
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($standard_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $appname                                        = 
lang('standard');
+                       $function_msg   = lang('list '.$type.' attribute');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                       return $json;
+                       }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uistandard_3.index', 'property' );
+
+                       $this->save_sessiondata();
+                       /*if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $type   = phpgw::get_var('type');
+
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_3','nextmatchs',
                                                                                
'search_field'));
 
@@ -185,7 +480,7 @@
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+                       $this->save_sessiondata();*/
                }
 
                function edit()
@@ -276,18 +571,19 @@
                        $id             = phpgw::get_var('id', 'int');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id,$type);
+                               
//$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                               return "id ".$id." ".lang("has been deleted");
+                       }
+
                        $link_data = array
                        (
                                'menuaction' => 'property.uistandard_3.index',
                                'type' => $type
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               $this->bo->delete($id,$type);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array

Modified: people/sigurdne/modules/property/trunk/inc/class.uitemplate.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uitemplate.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uitemplate.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -32,6 +32,8 @@
         * @package property
         */
 
+       phpgw::import_class('phpgwapi.yui');
+
        class property_uitemplate
        {
                var $grants;
@@ -58,8 +60,6 @@
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::project::template';
 
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->bo                               = 
CreateObject('property.botemplate',true);
                        $this->bowo_hour                        = 
CreateObject('property.bowo_hour');
                        $this->bocommon                         = 
CreateObject('property.bocommon');
@@ -92,187 +92,522 @@
 
                function index()
                {
-                       $GLOBALS['phpgw']->xslttpl->add_file(array(
-                                                               'template',
-                                                               'nextmatchs',
-                                                               
'search_field'));
-
-                       $workorder_id = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $lookup         = phpgw::get_var('lookup', 'bool');
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                               
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                               (
+                                       'menuaction'                    => 
'property.uitemplate.index',
+                                       'query'                         => 
$this->query,
+                               'chapter_id'                    => 
$this->chapter_id,
+                               'order'                                 => 
$this->order
+                                       ));
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uitemplate.index',"
+                                                                               
                ."sort: '{$this->sort}',"
+                                                                               
."order: '{$this->order}',"
+                                                                               
."status: '{$this->status}',"
+                                                                               
."workorder_id:'{$workorder_id}',"
+                                                                               
."lookup:'{$lookup}',"
+                                                                               
."query: '{$this->query}'";
+
+                               $values_combo_box[0] = 
$this->bowo_hour->get_chapter_list('filter',$this->chapter_id);
+                               $default_value = array ('id'=>'','name'=> 
lang('select chapter'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bocommon->get_user_list('filter',$this->filter,$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1);
+                               $default_value = array 
('user_id'=>'','name'=>lang('no user'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uitemplate.index',
+                                                               'query'         
                => $this->query,
+                                               'chapter_id'                    
=> $this->chapter_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
//Chapter button
+                                                                           
'id' => 'btn_chap_id',
+                                                                           
'name' => 'chap_id',
+                                                                           
'value'     => lang('Chapter'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                                       array( 
//User button
+                                                                           
'id' => 'btn_user_id',
+                                                                           
'name' => 'user_id',
+                                                                           
'value'     => lang('User'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),      
                                                                                
                                                        
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 7
+                                                                               
    ),                                                                  
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_select',
+                                                                               
        'value' => lang('Select'),
+                                                                               
        'tab_index' => 6
+                                                                               
    ),                                                                  
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 5
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 4
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
                                array( //hidden 
+                                                                               
        'type'  => 'hidden',
+                                                                               
        'name'     => 'workorder_id',
+                                                                               
        'id'    => 'workorder_id',
+                                                                               
        'value' => 0,
+                                                                               
        'style' => 'filter'
+                                                                               
    ),
+                                                                               
                                array( //hidden 
+                                                                               
        'type'  => 'hidden',
+                                                                               
        'name'     => 'template_id',
+                                                                               
        'id'    => 'template_id',
+                                                                               
        'value' => 0,
+                                                                               
        'style' => 'filter'
+                                                                               
    )                                                                   
+                                                                               
),
+                                                       'hidden_value' => array
+                                                                               
          (
+                                                                               
        array
+                                                                               
        ( //div values  combo_box_0
+                                                                               
                        'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0])
+                                                                               
                ),
+                                                                               
                array
+                                                                               
                ( //div values  combo_box_1
+                                                                               
                        'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1],'user_id')
+                                                                               
                )
+                                                                               
          )
+                                                                               
)
+                                        )
+                               );
+
+                               if($lookup)
+                               {
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][4]);
+                               } 
+                               if(!$lookup) {
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][3]);
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][2]);
+                               }
+                               
+                               $dry_run = true;
+                       }
+
                        $template_list  = $this->bo->read();
 
-                       while (is_array($template_list) && list(,$template) = 
each($template_list))
+                       $uicols = array();
+
+                       $uicols['name'][0]['name'] = 'ID';
+                       $uicols['name'][0]['value'] = 'template_id';
+
+                       $uicols['name'][1]['name'] = 'Name';
+                       $uicols['name'][1]['value'] = 'name';
+
+                       $uicols['name'][2]['name'] = 'Description';
+                       $uicols['name'][2]['value'] = 'descr';
+
+                       $uicols['name'][3]['name'] = 'Chapter';
+                       $uicols['name'][3]['value'] = 'chapter';
+
+                       $uicols['name'][4]['name'] = 'owner';
+                       $uicols['name'][4]['value'] = 'owner';
+
+                       $uicols['name'][5]['name'] = 'Entry Date';
+                       $uicols['name'][5]['value'] = 'entry_date';
+
+
+                       $count_uicols_name = count($uicols['name']);
+
+                       $j = 0;
+                       if (isset($template_list) AND is_array($template_list))
                        {
-                               $content_template[] = array
+                               foreach($template_list as $template_entry)
+                               {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k]['value'];
+                                               
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$template_entry[$uicols['name'][$k]['value']];
+                                       }
+                                       if($lookup)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$k + 1]['name']         = 'select';
+                                               
$datatable['rows']['row'][$j]['column'][$k + 1]['value']        = '<input 
type="radio" name="rad_template" value="'.$template_entry['template_id'].'" 
class="myValuesForPHP"">';
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+
+                       if(!$lookup) 
+                       {
+                               $parameters = array
                                (
-                                       'workorder_id'                  => 
$workorder_id,
-                                       'template_id'                   => 
$template['template_id'],
-                                       'name'                          => 
$template['name'],
-                                       'descr'                         => 
$template['descr'],
-                                       'owner'                         => 
$template['owner'],
-                                       'entry_date'                    => 
$template['entry_date'],
-                                       'chapter'                       => 
$template['chapter'],
-                                       'lang_select'                   => 
lang('Select'),
-                                       'form_action_select'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.template')),
-                                       'lang_select_statustext'        => 
lang('Select this template to view the details'),
-                                       'link_view'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.hour','template_id'=> $template['template_id'])),
-                                       'link_edit'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.edit_template','template_id'=> $template['template_id'])),
-                                       'link_delete'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.delete', 'id'=> $template['template_id'])),
-                                       'lang_view_statustext'          => 
lang('view the template'),
-                                       'lang_edit_statustext'          => 
lang('edit the template'),
-                                       'lang_delete_statustext'        => 
lang('delete the template'),
-                                       'text_view'                     => 
lang('view'),
-                                       'text_edit'                     => 
lang('edit'),
-                                       'text_delete'                   => 
lang('delete')
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'template_id',
+                                                       'source'        => 
'template_id'
+                                               ),
+                                       )
                                );
 
-                       }
+                               $parameters2 = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 'id',
+                                                       'source'        => 
'template_id'
+                                               ),
+                                       )
+                               );
 
-                       $table_header_template[] = array
+                               $datatable['rowactions']['action'][] = array
                        (
+                                       'my_name'                       => 
'view',
+                                       'statustext'    => lang('view the 
claim'),
+                                       'text'                  => lang('view'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'property.uitemplate.hour'
+                                               )
+                                       ),
+                                       'parameters'    => $parameters
+                               );
 
-                               'sort_template_id'      => 
$this->nextmatchs->show_sort_order(array
+                               $datatable['rowactions']['action'][] = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'fm_template.id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitemplate.index',
-                                                                               
                                                        'chapter_id'    
=>$this->chapter_id,
-                                                                               
                                                        'query'                 
=>$this->query,
-                                                                               
                                                        'workorder_id'  
=>$workorder_id,
-                                                                               
                                                        'allrows'               
=>$this->allrows)
-                                                                               
)),
-                               'lang_template_id'                      => 
lang('ID'),
-                               'lang_name'                     => lang('Name'),
-                               'sort_name'     => 
$this->nextmatchs->show_sort_order(array
+                                       'my_name'                       => 
'edit',
+                                       'statustext'                    => 
lang('edit the claim'),
+                                       'text'          => lang('edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitemplate.index',
-                                                                               
                                                        'chapter_id'    
=>$this->chapter_id,
-                                                                               
                                                        'query'                 
=>$this->query,
-                                                                               
                                                        'workorder_id'  
=>$workorder_id,
-                                                                               
                                                        'allrows'               
=>$this->allrows)
-                                                                               
)),
-                               'lang_name'             => lang('Name'),
-                               'lang_chapter'          => lang('Chapter'),
-                               'lang_owner'            => lang('owner'),
-                               'lang_entry_date'       => lang('Entry Date'),
-                               'lang_descr'            => lang('Description'),
-                               'lang_view'             => lang('view'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'lang_select'           => lang('select')
+                                                       'menuaction'    => 
'property.uitemplate.edit_template'
+                                               )
+                                       ),
+                                       'parameters'    => $parameters
                        );
 
-                       $link_data = array
+                               $datatable['rowactions']['action'][] = array
                        (
-                               'menuaction'    => 'property.uitemplate.index',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'chapter_id'    => $this->chapter_id,
-                               'workorder_id'  => $workorder_id,
-                               'query'         => $this->query
+                                       'my_name'                       => 
'delete',
+                                       'statustext'                    => 
lang('delete the claim'),
+                                       'text'          => lang('delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'property.uitemplate.delete'
+                                               )
+                                       ),
+                                       'parameters'    => $parameters2
+                               );
+
+                               $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'               => 
'add',
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                                               
        'menuaction'    => 'property.uitemplate.edit_template'
+                                               )
+                                        )
                        );
 
-                       if(!$this->allrows)
+                               unset($parameters);
+                               unset($parameters2);
+                       }
+                       
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i]['value'];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
lang($uicols['name'][$i]['name']);
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                               }
+
+                               if($uicols['name'][$i]['value']=='name')
+                               {
+                                       
$datatable['headers']['header'][$i]['sortable']                 = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols['name'][$i]['value'];
+                               }
+
+                               if($uicols['name'][$i]['value']=='template_id')
+                               {
+                                       
$datatable['headers']['header'][$i]['sortable']                 = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']       = "fm_template.id";
+                               }
                        }
+
+                       if($lookup)
+                       {
+                               $i++;
+                               $datatable['headers']['header'][$i]['name']     
                = 'select';
+                               $datatable['headers']['header'][$i]['text']     
                = lang('select');
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               $datatable['headers']['header'][$i]['sortable'] 
                = false;
+                               $datatable['headers']['header'][$i]['format']   
                = '';
+                               $datatable['headers']['header'][$i]['visible']  
                = true;
+                               
$datatable['headers']['header'][$i]['formatter']                = '""';
+                               
+                       }
+
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($template_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+
+                       $appname                                        = 
lang('template');
+                       $function_msg                           = lang('list 
template');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'template_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $table_add[] = array
-                       (
-                               'lang_add'              => lang('add'),
-                               'lang_add_statustext'   => lang('add a 
template'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.edit_template'))
-                       );
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $table_done[] = array
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'lang_done'             => lang('Done'),
-                               'lang_done_statustext'  => lang('Back to list'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.index','workorder_id'=> $workorder_id))
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'form_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_add_statustext'           => lang('Add 
the selected items'),
-                               'lang_add'                      => lang('Add'),
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                               'chapter_list'                  => 
$this->bowo_hour->get_chapter_list('filter',$this->chapter_id),
-                               'select_chapter'                => 'chapter_id',
-                               'lang_no_chapter'               => lang('Select 
chapter'),
-                               'lang_chapter_statustext'       => lang('Select 
the template-chapter'),
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                               'lookup'                        => $lookup,
-                               'function'                      => 'template',
-                               'allrows'                       => 
$this->allrows,
-                               'allow_allrows'                 => true,
-                               'start_record'                  => $this->start,
-                               'record_limit'                  => 
$record_limit,
-                               'num_records'                   => 
count($template_list),
-                               'all_records'                   => 
$this->bo->total_records,
-                               'link_url'                      => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                      => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                 => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                       return $json;
+                       }
 
-                               'lang_user_statustext'          => lang('Select 
the user the template belongs to. To do not use a category select NO USER'),
-                               'select_user_name'              => 'filter',
-                               'lang_no_user'                  => lang('No 
user'),
-                               'user_list'                     => 
$this->bocommon->get_user_list('filter',$this->filter,$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+                       //-------------------- JSON CODE ----------------------
 
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                         => $this->query,
-                               'lang_search'                   => 
lang('search'),
-                               'table_header_template'         => 
$table_header_template,
-                               'values_template'               => 
$content_template,
-                               'table_add'                     => $table_add,
-                               'table_done'                    => $table_done
-                       );
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                       $appname        = lang('template');
-                       $function_msg   = lang('list template');
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
 
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'template.index', 'property' );
+
                        $this->save_sessiondata();
                }
 
                function hour()
                {
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('template',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
-
                        $delete = phpgw::get_var('delete', 'bool');
                        $hour_id = phpgw::get_var('hour_id', 'int');
 
                        $template_id = phpgw::get_var('template_id', 'int');
 
-                       if($delete && $hour_id)
+                       if($delete && $hour_id && 
phpgw::get_var('phpgw_return_as') == 'json')
                        {
                                $receipt = 
$this->bo->delete_hour($hour_id,$template_id);
+                               return "hour ".$hour_id." ".lang("has been 
deleted");
                        }
                        else
                        {
                                $receipt = array();
                        }
 
+                       $datatable = array();
+                       $values_combo_box = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uitemplate.hour',
+                                               'query'                         
=> $this->query,
+                                               'template_id'                   
=> $template_id,
+
+                                       ));
+                       $datatable['config']['allow_allrows'] = true;
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uitemplate.hour',"
+                                                                               
                                ."template_id:'{$template_id}'";
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uitemplate.hour',
+                                                                       'query' 
                        => $this->query,
+                                                                       
'template_id'           => $template_id
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array
+                                                               (
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_done',
+                                                                               
        'value' => lang('done'),
+                                                                               
        'tab_index' => 4
+                                                                               
    ),
+                                                                               
                                array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 3
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 1
+                                                                       )
+                                                                               
)
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+                       $uicols = array (
+                               array(
+                                       'col_name'=>hour_id,            
'visible'=>false,       'name'=>hour_id,                'label'=>'',            
                        'className'=>'',                                
'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>''),
+                               array(
+                                       'col_name'=>template_id,        
'visible'=>false,       'name'=>template_id,    'label'=>'',                    
                'className'=>'',                                
'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>''),
+                               array(
+                                       'col_name'=>counter,            
'visible'=>false,       'name'=>counter,                'label'=>'',            
                        'className'=>'',                                
'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>''),
+                               array(
+                                       'col_name'=>records,            
'visible'=>true,        'name'=>record,                 
'label'=>lang('Record'),                'className'=>'centerClasss',    
'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>''),
+                               array(
+                                       'col_name'=>building_part ,     
'visible'=>true,        'name'=>building_part,  'label'=>lang('Building part'), 
'className'=>'centerClasss',    'sortable'=>true,       
'sort_field'=>'building_part','formatter'=>''),
+                               array(
+                                       'col_name'=>code,                       
'visible'=>true,        'name'=>'',                             
'label'=>lang('Code'),                  'className'=>'centerClasss',    
'sortable'=>false,      'sort_field'=>'',                       
'formatter'=>''),
+                               array(
+                                       'col_name'=>grouping_descr,     
'visible'=>true,        'name'=>grouping_descr, 'label'=>lang('Grouping'),      
        'className'=>'centerClasss',    'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>hours_descr,        
'visible'=>true,        'name'=>hours_descr,    'label'=>lang('Description'),   
'className'=>'leftClasss',              'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>unit,                       
'visible'=>true,        'name'=>unit,                   'label'=>lang('Unit'),  
                'className'=>'centerClasss',    'sortable'=>false,      
'sort_field'=>'',                       'formatter'=>''),
+                               array(
+                                       'col_name'=>billperae,          
'visible'=>true,        'name'=>billperae,              'label'=>lang('Bill per 
unit'), 'className'=>'rightClasss',             'sortable'=>true,       
'sort_field'=>'billperae',      'formatter'=>'')
+                               );
+               
                        $template_list  = 
$this->bo->read_template_hour($template_id);
-
+                       //_debug_array($template_list);
                        $i=0;
                        $grouping_descr_old='';
-
                        while (is_array($template_list) && list(,$template) = 
each($template_list))
                        {
 
@@ -296,168 +631,175 @@
                                        $code = 
str_replace("-",$template['tolerance'],$template['ns3420_id']);
                                }
 
-
                                $content[] = array
                                (
+                                       'hour_id'                       =>      
$template['hour_id'],
+                                       'template_id'           =>      
$template_id,
                                        'counter'                       => $i,
                                        'record'                        => 
$template['record'],
-                                       'chapter_id'                    => 
$template['chapter_id'],
                                        'grouping_descr'                => 
$template['grouping_descr'],
                                        'building_part'                 => 
$template['building_part'],
-                                       'new_grouping'                  => 
$new_grouping,
                                        'code'                          => 
$code,
-                                       'activity_id'                   => 
$template['activity_id'],
-                                       'activity_num'                  => 
$template['activity_num'],
-                                       'hours_descr'                   => 
$template['hours_descr'],
-                                       'remark'                        => 
$template['remark'],
-                                       'ns3420_id'                     => 
$template['ns3420_id'],
-                                       'tolerance'                     => 
$template['tolerance'],
-                                       'cost'                          => 
$template['cost'],
+                                       'hours_descr'           => 
$template['remark']!= "" ? $template['hours_descr']."<br>".$template['remark'] 
: $template['hours_descr'],
                                        'unit'                          => 
$template['unit'],
                                        'billperae'                     => 
$template['billperae'],
-                                       'building_part'                 => 
$template['building_part'],
-                                       'dim_d'                         => 
$template['dim_d'],
-                                       'link_edit'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.edit_hour','hour_id'=> $template['hour_id'], 
'template_id'=> $template_id)),
-                                       'link_delete'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.hour','delete'=>true, 'template_id'=> $template_id, 
'hour_id'=> $template['hour_id'])),
-                                       'lang_edit_statustext'          => 
lang('edit the template'),
-                                       'lang_delete_statustext'        => 
lang('delete the template'),
-                                       'text_edit'                     => 
lang('edit'),
-                                       'text_delete'                   => 
lang('delete')
                                );
+                               unset($new_grouping);
+                               unset($grouping_descr_old);
+                               unset($code);
 
                                $i++;
                        }
 
-                       $table_header[] = array
-                       (
-                               'lang_record'           => lang('Record'),
-                               'lang_code'             => lang('Code'),
-                               'lang_descr'            => lang('Description'),
-                               'lang_unit'             => lang('Unit'),
-                               'lang_quantity'         => lang('Quantity'),
-                               'lang_billperae'        => lang('Bill per 
unit'),
-                               'lang_cost'             => lang('Cost'),
+                       $j=0;
+                       if (isset($content) && is_array($content))
+                       {
+                               foreach($content as $template)
+                               {
+                                       for ($i=0;$i<count($uicols);$i++)
+                                       {
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']             = 
$uicols[$i]['col_name'];
+                                               
$datatable['rows']['row'][$j]['column'][$i]['value']            = 
$template[$uicols[$i]['name']];
+                                       }
+                                       $j++;
+                               }
+                       }
 
-                               'sort_billperae'        => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'billperae',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitemplate.hour',
-                                                                               
                                                        'template_id'   
=>$template_id,
-                                                                               
                                                        'query'                 
=>$this->query,
-                                                                               
                                                        'allrows'               
=>$this->allrows)
-                                                                               
)),
-                               'lang_select'           => lang('Select'),
-                               'sort_building_part'    => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'building_part',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitemplate.hour',
-                                                                               
                                                        'template_id'   
=>$template_id,
-                                                                               
                                                        'query'                 
=>$this->query,
-                                                                               
                                                        'allrows'               
=>$this->allrows)
-                                                                               
)),
-                               'lang_building_part'    => lang('Building 
part'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete')
-                       );
+                       $datatable['rowactions']['action'] = array();
+                       $parameters = array();
+                       $parameters[] = array('parameter' => array(     
array('name'=> 'hour_id',               'source'        => 'hour_id'),
+                                                                               
                                array('name'=> 'template_id',   'source'        
=> 'template_id')));
 
+                       $parameters[] = array('parameter' => array(     
array('name'=> 'hour_id',               'source'        => 'hour_id'),
+                                                                               
                                array('name'=> 'template_id',   'source'        
=> 'template_id'),
+                                                                               
                                array('name'=> 'delete',                
'source'        => 'template_id')));
 
-                       $table_done[] = array
-                       (
-                               'lang_done'             => lang('Done'),
-                               'lang_done_statustext'  => lang('Back to list'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.index'))
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'edit',
+                                       'text'                  => lang('edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.edit_hour')),
+                                       'parameters'    => $parameters[0]
                        );
-
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uitemplate.hour',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'template_id'   => $template_id,
-                               'allrows'       => $this->allrows,
-                               'query'         => $this->query
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'delete',
+                                       'text'                  => 
lang('delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.hour')),
+                                       'parameters'    => $parameters[1]
                        );
-
-                       $link_data_nextmatch = array
-                       (
-                               'menuaction'    => 'property.uitemplate.hour',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'template_id'   => $template_id,
-                               'query'         => $this->query
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.edit_hour','template_id'=> $template_id)),
                        );
+                       unset($parameters);     
 
-                       $link_data_delete = array
-                       (
-                               'menuaction'    => 'property.uitemplate.hour',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'allrows'       => $this->allrows,
-                               'delete'        => true,
-                               'query'         => $this->query
-                       );
+                       for ($i=0;$i<count($uicols);$i++)
+                       {
+                               $datatable['headers']['header'][$i]['name']     
                = $uicols[$i]['col_name'];
+                               $datatable['headers']['header'][$i]['text']     
        = $uicols[$i]['label'];
+                               $datatable['headers']['header'][$i]['visible']  
        = $uicols[$i]['visible'];
+                               $datatable['headers']['header'][$i]['sortable'] 
        = $uicols[$i]['sortable'];
+                               
$datatable['headers']['header'][$i]['sort_field']       = 
$uicols[$i]['sort_field'];
+                               
$datatable['headers']['header'][$i]['className']        = 
$uicols[$i]['className'];
+                               
$datatable['headers']['header'][$i]['formatter']        = 
($uicols[$i]['formatter']==''?  '""' : $uicols[$i]['formatter']);
+                       }
 
-                       $table_add[] = array
-                       (
-                               'lang_add'      => lang('add'),
-                               'lang_add_statustext'   => lang('add a hour'),
-                               'add_action'    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.edit_hour','template_id'=> $template_id))
-                       );
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       if(!$this->allrows)
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($content);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= $uicols[1]['col_name']; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $data = array
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_add_statustext'                   => 
lang('Add the selected items'),
-                               'lang_add'                              => 
lang('Add'),
-                               'link_delete'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data_delete),
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
 
-                               'function'                              => 
'template',
-                               'allrows'                               => 
$this->allrows,
-                               'allow_allrows'                         => true,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($template_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               $json_row[$column['name']] = 
$column['value'];
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                 => 
$this->query,
-                               'lang_search'                           => 
lang('search'),
-                               'table_header_template_hour'            => 
$table_header,
-                               'values_template_hour'                  => 
$content,
-                               'table_add'                             => 
$table_add,
-                               'table_done'                            => 
$table_done
-                       );
-                       $appname                                        = 
lang('template');
-                       $function_msg                                   = 
lang('view template detail');
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               //_debug_array($json);
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' => 
$data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . lang('template') . ': ' . lang('view template 
detail');
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'template.hour', 'property' );
+
+                       //$this->save_sessiondata();
                }
 
+
                function edit_template()
                {
                        $template_id    = phpgw::get_var('template_id', 'int');
@@ -702,19 +1044,18 @@
                function delete()
                {
                        $id     = phpgw::get_var('id', 'int');
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id);
+                               return "id ".$id." ".lang("has been deleted");
+                       }
+
                        $confirm = phpgw::get_var('confirm', 'bool', 'POST');
-
                        $link_data = array
                        (
                                'menuaction' => 'property.uitemplate.index'
                        );
-
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               $this->bo->delete($id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array

Modified: 
people/sigurdne/modules/property/trunk/inc/class.uitenant_claim.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uitenant_claim.inc.php     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uitenant_claim.inc.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -32,6 +32,7 @@
         * @package property
         */
 
+       phpgw::import_class('phpgwapi.yui');
 
        class property_uitenant_claim
        {
@@ -56,8 +57,6 @@
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::project::claim';
-               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo               = 
CreateObject('property.botenant_claim',true);
@@ -79,6 +78,7 @@
                        $this->status           = $this->bo->status;
                        $this->cat_id           = $this->bo->cat_id;
                        $this->allrows          = $this->bo->allrows;
+                       $this->project_id       = $this->bo->project_id;
                }
 
                function save_sessiondata()
@@ -109,193 +109,371 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt','');
 
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                       (
+                               'menuaction'                    => 
'property.uitenant_claim.index',
+                               'query'                         => $this->query,
+                       'cat_id'                                => 
$this->cat_id,
+                       'order'                                 => $this->order
+                               ));
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uitenant_claim.index',"
+                                                                               
                ."sort: '{$this->sort}',"
+                                                                               
."order: '{$this->order}',"
+                                                                               
."status: '{$this->status}',"
+                                                                               
."project_id: '{$this->project_id}',"                                           
                                
+                                                                               
."query: '{$this->query}'";
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uitenant_claim.index',
+                                       'sort'          => $this->sort,
+                                       'order'         => $this->order,
+                                       'cat_id'        => $this->cat_id,
+                                       'filter'        => $this->filter,
+                                       'status_id'     => $this->status_id,
+                                       'project_id'=> $this->project_id,
+                                       'query'         => $this->query
+                               );
+
+                               $values_combo_box[0] = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'tenant_claim','order'=>'descr'));
+                               $default_value = array ('id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1]  = 
$this->bo->get_status_list(array('format' => 'filter', 'selected' => 
$this->status,'default' => 'open'));
+                               $default_value = array 
('id'=>'','name'=>lang('open'));
+                               array_unshift 
($values_combo_box[1],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                               array(
+                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array(
+                                                               'menuaction'    
        => 'property.uitenant_claim.index',
+                                                               'query'         
                => $this->query,
+                                               'cat_id'                        
        => $this->cat_id
+                                                       )
+                                               ),
+                                       'fields'        => array(
+                                           'field' => array(
+                                                                       array( 
//boton  CATEGORY
+                                                                           
'id' => 'btn_cat_id',
+                                                                           
'name' => 'cat_id',
+                                                                           
'value'     => lang('Category'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+
+                                                                       ),
+                                                                       array( 
//boton  STATUS
+                                                                           
'id' => 'btn_status_id',
+                                                                           
'name' => 'status_id',
+                                                                           
'value'     => lang('Status'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 2
+                                                                       ),
+                                                                       array(
+                                                                               
        'type'  => 'button',
+                                                                               
        'id'    => 'btn_new',
+                                                                               
        'value' => lang('add'),
+                                                                               
        'tab_index' => 5
+                                                                               
    ),
+                                                                       array( 
//boton     SEARCH
+                                                                           
'id' => 'btn_search',
+                                                                           
'name' => 'search',
+                                                                           
'value'    => lang('search'),
+                                                                           
'type' => 'button',
+                                                                           
'tab_index' => 4
+                                                                       ),
+                                                                               
                                array( // TEXT INPUT
+                                                                           
'name'     => 'query',
+                                                                           
'id'     => 'txt_query',
+                                                                           
'value'    => '',//$query,
+                                                                           
'type' => 'text',
+                                                                           
'onkeypress' => 'return pulsar(event)',
+                                                                           
'size'    => 28,
+                                                                           
'tab_index' => 3
+                                                                       ),
+                                                                               
),
+                                                       'hidden_value' => array
+                                                                               
          (
+                                                                               
        array
+                                                                               
        ( //div values  combo_box_0
+                                                                               
                        'id' => 'values_combo_box_0',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[0])
+                                                                               
                ),
+                                                                               
                array
+                                                                               
                ( //div values  combo_box_1
+                                                                               
                        'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1])
+                                                                               
                )
+                                                                               
          )
+                                                                               
)
+                                        )
+                               );
+
+                               $dry_run = true;
+                       }
+
+
                        $claim_list = $this->bo->read(array('project_id' => 
$project_id));
 
-                       while (is_array($claim_list) && list(,$claim) = 
each($claim_list))
+                       $uicols = array();
+                       $uicols['name'][0]['name'] = 'claim id';
+                       $uicols['name'][0]['value'] = 'claim_id';
+
+                       $uicols['name'][1]['name'] = 'Project';
+                       $uicols['name'][1]['value'] = 'project_id';
+
+                       $uicols['name'][2]['name'] = 'name';
+                       $uicols['name'][2]['value'] = 'name';
+
+                       $uicols['name'][3]['name'] = 'time created';
+                       $uicols['name'][3]['value'] = 'entry_date';
+
+                       $uicols['name'][4]['name'] = 'category';
+                       $uicols['name'][4]['value'] = 'category';
+
+                       $uicols['name'][5]['name'] = 'Status';
+                       $uicols['name'][5]['value'] = 'status';
+
+                       $uicols['name'][6]['name'] = 'tenant_id';
+                       $uicols['name'][6]['value'] = 'tenant_id';
+
+                       $count_uicols_name = count($uicols['name']);
+
+                       $j = 0;
+                       if (isset($claim_list) AND is_array($claim_list))
                        {
-                               if($claim['tenant_id'])
+                               foreach($claim_list as $claim_entry)
+                       {
+                                       for ($k=0;$k<$count_uicols_name;$k++)
                                {
-                                       $tenant= 
$this->bocommon->read_single_tenant($claim['tenant_id']);
-                                       $name = $tenant['last_name'] . ', ' . 
$tenant['first_name'];
+                                               
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k]['value'];
+                                               
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$claim_entry[$uicols['name'][$k]['value']];
+
+                                       }
+                                       $j++;
                                }
+                               }
 
-                               $content[] = array
+                       $parameters = array
+                       (
+                               'parameter' => array
                                (
-                                       'claim_id'                              
=> $claim['claim_id'],
-                                       'project_id'                            
=> $claim['project_id'],
-                                       'status'                                
=> lang($claim['status']),
-                                       'name'                                  
=> $name,
-                                       'entry_date'                            
=> $claim['entry_date'],
-                                       'category'                              
=> $claim['category'],
-                                       'link_view'                             
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.view', 'claim_id'=> $claim['claim_id'])),
-                                       'link_edit'                             
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.edit', 'claim_id'=> $claim['claim_id'])),
-                                       'link_delete'                           
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.delete', 'claim_id'=> $claim['claim_id'])),
-                                       'lang_view_statustext'                  
=> lang('view the claim'),
-                                       'lang_edit_statustext'                  
=> lang('edit the claim'),
-                                       'lang_delete_statustext'                
=> lang('delete the claim'),
-                                       'text_view'                             
=> lang('view'),
-                                       'text_edit'                             
=> lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
+                                       array
+                               (
+                                               'name'          => 'claim_id',
+                                               'source'        => 'claim_id'
+                                       ),
+                               )
                                );
-                               unset ($tenant);
-                               unset ($name);
-                       }
 
-                       $table_header = array
+                       if($this->acl_read)
+                       {
+                               $datatable['rowactions']['action'][] = array
                        (
-                               'lang_project'          => lang('Project'),
-                               'lang_name'             => lang('name'),
-                               'lang_status'           => lang('Status'),
-                               'lang_time_created'     => lang('time created'),
-                               'lang_view'             => lang('view'),
-                               'lang_edit'             => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'lang_claim_id'         => lang('claim id'),
-                               'sort_project'          => 
$this->nextmatchs->show_sort_order(array
+                                       'my_name'               => 'view',
+                                       'statustext'    => lang('view the 
claim'),
+                                       'text'                  => lang('view'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'project_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitenant_claim.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'status'        
=>$this->status,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'sort_name'             => 
$this->nextmatchs->show_sort_order(array
+                                               'menuaction'    => 
'property.uitenant_claim.view'
+                                       )
+                               ),
+                               'parameters'    => $parameters
+                               );
+                       }
+
+                       if ($this->acl_edit)
+                       {
+                               $datatable['rowactions']['action'][] = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'org_name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitenant_claim.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'status'        
=>$this->status,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'sort_claim_id'         => 
$this->nextmatchs->show_sort_order(array
+                                       'my_name'                       => 
'edit',
+                                       'statustext'            => lang('edit 
the claim'),
+                                       'text'                          => 
lang('edit'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'claim_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitenant_claim.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'status'        
=>$this->status,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'sort_time_created'     => 
$this->nextmatchs->show_sort_order(array
+                                               'menuaction'    => 
'property.uitenant_claim.edit'
+                                       )
+                               ),
+                               'parameters'    => $parameters
+                               );
+                       }
+
+                       if ($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'entry_date',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitenant_claim.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'status'        
=>$this->status,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'sort_category'         => 
$this->nextmatchs->show_sort_order(array
+                                       'my_name'                       => 
'delete',
+                                       'statustext'            => lang('delete 
the claim'),
+                                       'text'                          => 
lang('delete'),
+                                       'confirm_msg'           => lang('do you 
really want to delete this entry'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'descr',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitenant_claim.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'status'        
=>$this->status,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'lang_category'         => lang('category')
+                                               'menuaction'    => 
'property.uitenant_claim.delete'
+                                       )
+                               ),
+                               'parameters'    => $parameters
                        );
+                       }
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'add',
+                                       'text'                  => lang('add'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                       (
+                                               'menuaction'    => 
'property.uiproject.index',
+                                               'lookup'                =>      
1,
+                                               'from'                  =>  
'tenant_claim'
+                                       )));
 
-                       if ($project_id)
+                       unset($parameters);
+
+                       for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               $lang_add = lang('add another');
-                               $add_action     = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.edit', 'project_id'=> $project_id));
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i]['value'];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
lang($uicols['name'][$i]['name']);
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
                        }
-                       else
+
+                               if($uicols['name'][$i]['value']=='claim_id' || 
$uicols['name'][$i]['value']=='project_id' || 
$uicols['name'][$i]['value']=='name' || 
$uicols['name'][$i]['value']=='entry_date')
                        {
-                               $lang_add = lang('add');
-                               $add_action     = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.index', 'lookup'=>true, 'from'=>'tenant_claim'));
+                                       
$datatable['headers']['header'][$i]['sortable']         = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']   = 
$uicols['name'][$i]['value'];
+                               }
 
+                               if($uicols['name'][$i]['value']=='category')
+                               {
+                                       
$datatable['headers']['header'][$i]['sortable']         = true;
+                                       
$datatable['headers']['header'][$i]['sort_field']   = 'descr';
                        }
 
-                       $table_add = array
-                       (
-                               'lang_add'              => $lang_add,
-                               'lang_add_statustext'   => lang('add a claim'),
-                               'add_action'            => $add_action
-                       );
+                               if($uicols['name'][$i]['value']=='tenant_id')
+                               {
+                                       
$datatable['headers']['header'][$i]['visible']          = false;
+                                       
$datatable['headers']['header'][$i]['format']           = 'hidden';
+                               }
+                       }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 
'property.uitenant_claim.index',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'status'        => $this->status,
-                               'query'         => $this->query
-                       );
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       if(!$this->allrows)
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($claim_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+
+                       $appname                                        = 
lang('Tenant claim');
+                       $function_msg                           = lang('list 
claim');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= 'claim_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
-                       $data = array
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'allow_allrows'                         => true,
-                               'allrows'                               => 
$this->allrows,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($claim_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                           => 
lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the claim belongs to. To do not use a category select 
NO CATEGORY'),
-                               'select_name'                           => 
'cat_id',
-                               'cat_list'                              => 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->cat_id,'type' =>'tenant_claim','order'=>'descr')),
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
+                       );
 
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'filter_list'                           => 
$this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                               'status_name'                           => 
'status',
-                               'status_list'                           => 
$this->bo->get_status_list(array('format' => 'filter', 'selected' => 
$this->status,'default' => 'open')),
-                               'lang_no_status'                        => 
lang('Open'),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                 => 
$this->query,
-                               'lang_search'                           => 
lang('search'),
-                               'table_header'                          => 
$table_header,
-                               'values'                                => 
$content,
-                               'table_add'                             => 
$table_add
-                       );
+                       return $json;
+               }
+                       //-------------------- JSON CODE ----------------------
+
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+
+               $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'tenant_claim.index', 'property' );
                        $this->save_sessiondata();
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('Tenant claim') . ': ' . lang('list claim');
-
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
 
+
                function check()
                {
                        $project_id     = phpgw::get_var('project_id', 'int');
@@ -331,6 +509,7 @@
                        $claim_id = phpgw::get_var('claim_id', 'int');
 
                        $values  = phpgw::get_var('values');
+                       //_debug_array($values);die;
                        $values['project_id']           = 
phpgw::get_var('project_id', 'int');
                        $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int', 'POST');
                        $values['b_account_name']       = 
phpgw::get_var('b_account_name', 'string', 'POST');
@@ -394,8 +573,25 @@
 
                        $project_values = 
$this->boproject->read_single($values['project_id']);
 
-//_debug_array($project_values);
+                       $soinvoice      = CreateObject('property.soinvoice');
+                       
+                       foreach ($project_values['workorder_budget'] as 
&$workorder)
+                       {
+                               $vouchers = 
$soinvoice->read_invoice(array('paid'=>'1','workorder_id' => 
$workorder['workorder_id'], 'user_lid' => 'all'));
+                               if(isset($vouchers[0]['voucher_id']))
+                               {
+                                       $workorder['voucher_id'] = 
$vouchers[0]['voucher_id'];
+                               }
+                               else
+                               {
+                                       $vouchers = 
$soinvoice->read_invoice(array('workorder_id' => $workorder['workorder_id'], 
'user_lid' => 'all'));
+                                       $workorder['voucher_id'] = 
isset($vouchers[0]['voucher_id']) ? $vouchers[0]['voucher_id'] : '';
+                               }
+                       }
 
+
+//_debug_array($project_values);die();
+
                        $table_header_workorder[] = array
                        (
                                'lang_workorder_id'     => lang('Workorder'),
@@ -493,6 +689,52 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
+
+                       
for($d=0;$d<count($project_values['workorder_budget']);$d++)
+                       {
+                               
if($project_values['workorder_budget'][$d]['charge_tenant']==1)
+                               {
+                                       
$project_values['workorder_budget'][$d]['charge_tenant']='x';
+                               }
+
+                               
if($project_values['workorder_budget'][$d]['selected']==1)
+                               {
+                                       
$project_values['workorder_budget'][$d]['selected']='<input type="checkbox" 
name="values[workorder][]" checked 
value="'.$project_values['workorder_budget'][$d]['workorder_id'].'">';
+                               }
+                               else
+                               {
+                                       
$project_values['workorder_budget'][$d]['selected']='<input type="checkbox" 
name="values[workorder][]" 
value="'.$project_values['workorder_budget'][$d]['workorder_id'].'">';
+                               }
+                       }
+
+                       //---datatable0 
settings---------------------------------------------------
+
+                       $datavalues[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                => 
json_encode($project_values['workorder_budget']),
+                               'total_records' => 
count($project_values['workorder_budget']),
+                               'edit_action'   => 
json_encode($GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit'))),
+                               'is_paginator'  => 1,
+                               'footer'                => 0
+                       );
+
+//_debug_array($project_values['workorder_budget']);die();
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array('key' => 'workorder_id',  'label'=>'Workorder',   
'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
+                                                                               
                        array('key' => 'budget',        'label'=>'Budget',      
'sortable'=>true,'resizeable'=>true),
+                                                                               
                        array('key' => 'calculation',   'label'=>'Calculation', 
'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'vendor_name','label'=>'Vendor','sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'charge_tenant','label'=>'Charge 
tenant','sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'status','label'=>'Status','sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'actual_cost','label'=>lang('actual 
cost'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 
'voucher_id','label'=>lang('voucher'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'selected','label'=>'select',    
'sortable'=>false,'resizeable'=>false)))
+                       );
+
                        $data = array
                        (
                                'table_header_workorder'                => 
$table_header_workorder,
@@ -501,6 +743,12 @@
                                'lang_start_date'                       => 
lang('Project start date'),
                                'value_start_date'                      => 
$project_values['start_date'],
 
+                               'property_js'                                   
                => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                                 
                => json_encode(array(menuaction => 
"property.uitenant_claim.edit",claim_id=>$claim_id)),
+                               'datatable'                                     
                        => $datavalues,
+                               'myColumnDefs'                                  
                => $myColumnDefs,
+                               //'myButtons'                                   
                        => $myButtons,
+
                                'lang_end_date'                         => 
lang('Project end date'),
                                'value_end_date'                        => 
$project_values['end_date'],
 
@@ -600,6 +848,27 @@
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('Tenant claim') . ': ' . ($claim_id?lang('edit claim'):lang('add claim'));
 
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+
+                       //_debug_array($data);die;
+
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'uitenant.edit', 'property' );
+                       //-----------------------datatable settings---
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
@@ -612,22 +881,21 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>8, 'acl_location'=> $this->acl_location));
                        }
 
-
                        $claim_id       = phpgw::get_var('claim_id', 'int');
                        $delete         = phpgw::get_var('delete', 'bool', 
'POST');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($claim_id);
+                               return "claim_id ".$claim_id." ".lang("has been 
deleted");
+                       }
+
                        $link_data = array
                        (
                                'menuaction' => 'property.uitenant_claim.index'
                        );
 
-                       if (phpgw::get_var('confirm', 'bool', 'POST'))
-                       {
-                               $this->bo->delete($claim_id);
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
-                       }
-
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
 
                        $data = array

Modified: people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage helpdesk
-       * @version $Id$
+       * @version $Id$
        */
 
        /**
@@ -32,6 +32,8 @@
         * @package property
         */
 
+       phpgw::import_class('phpgwapi.yui');
+
        class property_uitts
        {
                var $public_functions = array
@@ -45,15 +47,22 @@
                        'delete'        => true,
                        'download'              => true,
                        'download2'     => true,
-                       'view_file'     => true
+                       'view_file'     => true,
+                       'edit_status'=> true
                );
 
+               /**
+                * @var boolean $_simple use simplified interface
+                */
+               protected $_simple = false;
+               protected $_show_finnish_date = false;
+
                public function __construct()
                {
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::helpdesk';
                        if($this->tenant_id     = 
$GLOBALS['phpgw']->session->appsession('tenant_id','property'))
                        {
-                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
+       //                      $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
                                $GLOBALS['phpgw_info']['flags']['noheader'] = 
true;
                                $GLOBALS['phpgw_info']['flags']['nofooter'] = 
true;
                        }
@@ -65,25 +74,51 @@
                        $this->bocommon                         = & 
$this->bo->bocommon;
                        $this->cats                                     = & 
$this->bo->cats;
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location                     = '.ticket';
-                       $this->acl_read                         = 
$this->acl->check('.ticket', PHPGW_ACL_READ, 'property');
-                       $this->acl_add                          = 
$this->acl->check('.ticket', PHPGW_ACL_ADD, 'property');
-                       $this->acl_edit                         = 
$this->acl->check('.ticket', PHPGW_ACL_EDIT, 'property');
-                       $this->acl_delete                       = 
$this->acl->check('.ticket', PHPGW_ACL_DELETE, 'property');
-                       $this->acl_manage                       = 
$this->acl->check('.ticket', PHPGW_ACL_PRIVATE, 'property'); // manage
+                       $this->acl_location                     = 
$this->bo->acl_location;
+                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
+                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
+                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
+                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
+                       $this->acl_manage                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_PRIVATE, 'property'); // manage
                        $this->bo->acl_location         = $this->acl_location;
 
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
-                       $this->filter                           = 
$this->bo->filter;
-                       $this->user_filter                      = 
$this->bo->user_filter;
+                       $this->status_id                        = 
$this->bo->status_id;
+                       $this->user_id                          = 
$this->bo->user_id;
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->district_id                      = 
$this->bo->district_id;
                        $this->allrows                          = 
$this->bo->allrows;
                        $this->start_date                       = 
$this->bo->start_date;
                        $this->end_date                         = 
$this->bo->end_date;
+
+                       $user_groups =  
$GLOBALS['phpgw']->accounts->membership($this->account);
+                       $simple_group = 
isset($this->bo->config->config_data['fmttssimple_group']) ? 
$this->bo->config->config_data['fmttssimple_group'] : array();
+                       foreach ( $user_groups as $group => $dummy)
+                       {
+                               if ( in_array($group, $simple_group))
+                               {
+                                       $this->_simple = true;
+                                       break;
+                               }
+                       }
+
+
+                       reset($user_groups);
+                       $group_finnish_date = 
isset($this->bo->config->config_data['fmtts_group_finnish_date']) ? 
$this->bo->config->config_data['fmtts_group_finnish_date'] : array();
+                       foreach ( $user_groups as $group => $dummy)
+                       {
+                               if ( in_array($group, $group_finnish_date))
+                               {
+                                       $this->_show_finnish_date = true;
+                                       break;
+                               }
+                       }
+
+
+
                }
 
                function save_sessiondata()
@@ -94,8 +129,8 @@
                                'query'         => $this->query,
                                'sort'          => $this->sort,
                                'order'         => $this->order,
-                               'filter'        => $this->filter,
-                               'user_filter'   => $this->user_filter,
+                               'status_id'             => $this->status_id,
+                               'user_id'               => $this->user_id,
                                'cat_id'        => $this->cat_id,
                                'district_id'   => $this->district_id,
                                'allrows'       => $this->allrows,
@@ -115,14 +150,13 @@
                        $this->download($external = true);
                }
 
-
                function download($external='')
                {
                        $start_date     = urldecode($this->start_date);
                        $end_date       = urldecode($this->end_date);
 
                        $this->bo->allrows = true;
-                       $list = 
$this->bo->read($start_date,$end_date,$external);
+                       $list = 
$this->bo->read($start_date,$end_date,$external, '', $download = true);
 
                        if (isset($list) AND is_array($list))
                        {
@@ -160,7 +194,7 @@
                                                'address',
                                                'user',
                                                'assignedto',
-                                               'timestampopened'
+                                               'entry_date'
                                                );
 
                        while (is_array($name_temp) && list($name_entry,) = 
each($name_temp))
@@ -189,43 +223,45 @@
                        $this->bocommon->download($list,$name,$descr);
                }
 
-
-               function index()
+               function edit_status()
                {
-                       if($this->tenant_id)
+                       if(!$this->acl_edit)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index2'));
+                               return lang('sorry - insufficient rights');
                        }
 
-                       if(!$this->acl_read)
+                       $new_status = phpgw::get_var('new_status', 'string', 
'GET');
+                       $id             = phpgw::get_var('id', 'int');
+                       $receipt        = 
$this->bo->update_status(array('status'=>$new_status),$id);
+                       if 
(isset($this->bo->config->config_data['mailnotification']) && 
$this->bo->config->config_data['mailnotification'])
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
+                               $receipt = $this->bo->mail_ticket($id, 
$this->bo->fields_updated, $receipt);
                        }
+               //      
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
+                       return "id ".$id." ".lang('Status has been changed');
+                       }
 
-                       
$GLOBALS['phpgw']->js->set_onload('document.search.query.focus();');
-
-                       if(phpgw::get_var('edit_status', 'bool', 'GET'))
+               function index()
                        {
-                               if(!$this->acl_edit)
+                       if($this->tenant_id)
                                {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=> 4, 'acl_location'=> $this->acl_location));
+//                             
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index2'));
                                }
 
-                               $new_status = phpgw::get_var('new_status', 
'string', 'GET');
-                               $id = phpgw::get_var('id', 'int');
-                               $so2    = CreateObject('property.sotts2');
-                               $receipt = 
$so2->update_status(array('status'=>$new_status),$id);
-                               
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts',
-                                                                               
'nextmatchs'));
+                       $this->save_sessiondata();
 
+                       $dry_run=false;
 
                        $second_display = phpgw::get_var('second_display', 
'bool');
 
                        $default_category = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
-                       $default_status = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status']:'');
+                       //FIXME: differentiate mainsreen and helpdesk if this 
should be used.
+                       $default_status         = 
'';//isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status']:'';
                        $start_date     = urldecode($this->start_date);
                        $end_date       = urldecode($this->end_date);
 
@@ -237,10 +273,11 @@
 
                        if ($default_status && !$second_display)
                        {
-                               $this->bo->filter       = $default_status;
-                               $this->filter   = $default_status;
+                               $this->bo->status_id    = $default_status;
+                               $this->status_id                = 
$default_status;
                        }
 
+/*
                        $bgcolor_array[1]       = '#dadada';
                        $bgcolor_array[2]       = '#dad0d0';
                        $bgcolor_array[3]       = '#dacaca';
@@ -251,14 +288,339 @@
                        $bgcolor_array[8]       = '#da9090';
                        $bgcolor_array[9]       = '#da8a8a';
                        $bgcolor_array[10]      = '#da7a7a';
+*/
+                       $bgcolor_array[1]       = '#da7a7a';
+                       $bgcolor_array[2]       = '#dababa';
+                       $bgcolor_array[3]       = '#dadada';
 
+                       $lookup                 = phpgw::get_var('lookup', 
'bool');
+                       $from                   = phpgw::get_var('from');
+                       $start_date     = 
urldecode(phpgw::get_var('start_date'));
+                       $end_date               = 
urldecode(phpgw::get_var('end_date'));
+                       $allrows                = phpgw::get_var('allrows', 
'bool');
+
+                       $datatable = array();
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                       {
+                               $datatable['menu']                              
        = $this->bocommon->get_menu();
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                               (
+                                               'menuaction'            => 
'property.uitts.index',
+                                               'query'                         
=> $this->query,
+                                               'district_id'           => 
$this->district_id,
+                                               'part_of_town_id'       => 
$this->part_of_town_id,
+                                               'cat_id'                        
=> $this->cat_id,
+                                               'status'                        
=> $this->status
+                                       )
+                               );
+
+                               $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uitts.index',"
+                                                                               
                ."second_display:1,"
+                                                                               
."sort: '{$this->sort}',"
+                                                                               
."order: '{$this->order}',"
+                                                                               
."cat_id:'{$this->cat_id}',"
+                                                                               
        ."status_id: '{$this->status_id}',"
+                                                                               
."user_id: '{$this->user_id}',"
+                                                                               
."query: '{$this->query}',"
+                                                                               
."district_id: '{$this->district_id}',"
+                                                                               
."start_date: '{$start_date}',"
+                                                                               
."end_date: '{$end_date}',"
+                                                                               
."allrows:'{$this->allrows}'";
+
+                               $link_data = array
+                               (
+                                       'menuaction'    => 
'property.uitts.index',
+                                       'second_display'=> true,
+                                       'sort'                  => $this->sort,
+                                       'order'                 => $this->order,
+                                       'cat_id'                => 
$this->cat_id,
+                                       'status_id'             => 
$this->status_id,
+                                       'user_id'               => 
$this->user_id,
+                                       'query'                 => $this->query,
+                                       'district_id'   => $this->district_id,
+                                       'start_date'    => $start_date,
+                                       'end_date'              => $end_date,
+                                       'allrows'               => 
$this->allrows
+                               );
+
+                               $group_filters = 'select';
+
+                               $values_combo_box = array();
 
+                               $values_combo_box[2]  = 
$this->bo->filter(array('format' => $group_filters, 'filter'=> 
$this->status_id,'default' => 'O'));
+                               $default_value = array 
('id'=>'','name'=>lang('Open'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                               if(!$this->_simple)
+                               {
+                                       $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => True));
+                                       $default_value = array 
('cat_id'=>'','name'=> lang('no category'));
+                                       array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
+
+                                       $values_combo_box[1]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                                       $default_value = array 
('id'=>'','name'=>lang('no district'));
+                                       array_unshift 
($values_combo_box[1],$default_value);
+
+                                       $values_combo_box[3]  = 
$this->bocommon->get_user_list_right2('filter',2,$this->user_id,$this->acl_location);
+                                       $default_value = array 
('id'=>'','name'=>lang('no user'));
+                                       array_unshift 
($values_combo_box[3],$default_value);
+
+                                       $datatable['actions']['form'] = array
+                                       (
+                                               array
+                                               (
+                                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                                               
array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uitts.index',
+                                                                               
        'second_display'       => $second_display,
+                                                                               
        'district_id'       => $this->district_id,
+                                                                               
        'part_of_town_id'   => $this->part_of_town_id,
+                                                                               
        'cat_id'                => $this->cat_id,
+                                                                               
        'status'                        => $this->status
+                                                                               
)
+                                                                       ),
+                                                       'fields'        => array
+                                                       (
+                                       'field' => array
+                                       (
+                                                                       array
+                                                                       ( 
//boton       CATEGORY
+                                                                               
'id' => 'btn_cat_id',
+                                                                               
'name' => 'cat_id',
+                                                                               
'value' => lang('Category'),
+                                                                               
'type' => 'button',
+                                                                               
'style' => 'filter',
+                                                                               
'tab_index' => 1
+                                                                       ),
+                                                                       array
+                                                                               
( //boton       STATUS
+                                                                               
'id' => 'btn_district_id',
+                                                                               
'name' => 'district_id',
+                                                                               
'value' => lang('District'),
+                                                                               
'type' => 'button',
+                                                                               
'style' => 'filter',
+                                                                               
        'tab_index' => 2
+                                                                       ),
+                                                                       array
+                                                                       ( 
//boton       HOUR CATEGORY
+                                                                               
'id' => 'btn_status_id',
+                                                                               
'name' => 'status_id',
+                                                                               
'value' => lang('Status'),
+                                                                               
'type' => 'button',
+                                                                               
'style' => 'filter',
+                                                                               
'tab_index' => 3
+                                                                       ),
+                                                                       array
+                                                                       ( 
//boton       USER
+                                                                               
'id' => 'btn_user_id',
+                                                                               
'name' => 'user_id',
+                                                                               
'value' => lang('User'),
+                                                                               
'type' => 'button',
+                                                                               
'style' => 'filter',
+                                                                               
'tab_index' => 4
+                                                                       ),
+                                                                       array
+                                                                       (
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_export',
+                                                                               
'value' => lang('download'),
+                                                                               
'tab_index' => 9
+                                                                       ),
+                                                                       array
+                                                                       (
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 8
+                                                                       ),
+                                                                       array
+                                                                       ( 
//hidden start_date
+                                                                               
'type' => 'hidden',
+                                                                               
'id' => 'start_date',
+                                                                               
'value' => $start_date
+                                                                       ),
+                                                                       array
+                                                                       ( 
//hidden end_date
+                                                                               
'type' => 'hidden',
+                                                                               
'id' => 'end_date',
+                                                                               
'value' => $end_date
+                                                                       ),
+                                                                       array
+                                                                       (//for 
link "None",
+                                                                               
'type'=> 'label_date'
+                                                                       ),
+                                                                       array
+                                                                       (//for 
link "Date search",
+                                                                               
'type'=> 'link',
+                                                                               
'id'  => 'btn_data_search',
+                                                                               
'url' => "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                       array
+                                                                       (
+                                                                               
'menuaction' => 
'property.uiproject.date_search'))."','','width=350,height=250')",
+                                                                               
'value' => lang('Date search'),
+                                                                               
'tab_index' => 7
+                                                                       ),
+                                                                       array
+                                                                       ( 
//boton     SEARCH
+                                                                               
'id' => 'btn_search',
+                                                                               
'name' => 'search',
+                                                                               
'value'    => lang('search'),
+                                                                               
'type' => 'button',
+                                                                               
'tab_index' => 6
+                                                                       ),
+                                                                       array
+                                                                       ( // 
TEXT INPUT
+                                                                               
'name'     => 'query',
+                                                                               
'id'     => 'txt_query',
+                                                                               
'value'    => $this->query,
+                                                                               
'type' => 'text',
+                                                                               
'onkeypress' => 'return pulsar(event)',
+                                                                               
'size'    => 28,
+                                                                               
'tab_index' => 5
+                                                                       )
+                                                               ),
+                                               'hidden_value' => array
+                                               (
+                                                               array
+                                                                       ( //div 
values  combo_box_0
+                                                                               
'id' => 'values_combo_box_0',
+                                                                               
'value' => $this->bocommon->select2String($values_combo_box[0]['cat_list'], 
'cat_id') //i.e.  id,value/id,vale/
+                                                                       ),
+                                                                       array
+                                                                       ( //div 
values  combo_box_1
+                                                                               
'id' => 'values_combo_box_1',
+                                                                               
'value' => $this->bocommon->select2String($values_combo_box[1])
+                                                                       ),
+                                                                       array
+                                                                       ( //div 
values  combo_box_2
+                                                                               
'id' => 'values_combo_box_2',
+                                                                               
'value' => $this->bocommon->select2String($values_combo_box[2])
+                                                                       ),
+                                                                       array
+                                                                       ( //div 
values  combo_box_3
+                                                                               
'id' => 'values_combo_box_3',
+                                                                               
'value' => $this->bocommon->select2String($values_combo_box[3])
+                                                                       )
+                                                               )
+                                                       )
+                                               )
+                                       );
+                               }
+                               else
+                               {
+                                       $datatable['actions']['form'] = array
+                                       (
+                                               array
+                                               (
+                                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                                               
array
+                                                                               
(
+                                                                               
        'menuaction'            => 'property.uitts.index',
+                                                                               
        'second_display'       => $second_display,
+                                                                               
        'status'                        => $this->status
+                                                                               
)
+                                                                       ),
+                                                       'fields'        => array
+                                                       (
+                                       'field' => array
+                                       (
+                                                                       array
+                                                                       ( 
//boton       HOUR CATEGORY
+                                                                               
'id' => 'btn_status_id',
+                                                                               
'name' => 'status_id',
+                                                                               
'value' => lang('Status'),
+                                                                               
'type' => 'button',
+                                                                               
'style' => 'filter',
+                                                                               
'tab_index' => 3
+                                                                       ),
+                                                                       array
+                                                                       (
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 8
+                                                                       ),
+                                                                       array
+                                                                       ( 
//boton     SEARCH
+                                                                               
'id' => 'btn_search',
+                                                                               
'name' => 'search',
+                                                                               
'value'    => lang('search'),
+                                                                               
'type' => 'button',
+                                                                               
'tab_index' => 6
+                                                                       ),
+                                                                       array
+                                                                       ( // 
TEXT INPUT
+                                                                               
'name'     => 'query',
+                                                                               
'id'     => 'txt_query',
+                                                                               
'value'    => '',//$query,
+                                                                               
'type' => 'text',
+                                                                               
'onkeypress' => 'return pulsar(event)',
+                                                                               
'size'    => 28,
+                                                                               
'tab_index' => 5
+                                                                       )
+                                                               ),
+                                               'hidden_value' => array
+                                               (
+                                                                       array
+                                                                       ( //div 
values  combo_box_0
+                                                                               
'id' => 'values_combo_box_0',
+                                                                               
'value' => $this->bocommon->select2String($values_combo_box[2])
+                                                                       )
+                                                               )
+                                                       )
+                                               )
+                                       );                              
+                               }
+
+                               $dry_run = true;
+                       }
+
+                       if($dry_run)
+                       {
+                               $ticket_list = array();
+                       }
+                       else
+                       {
                        $ticket_list = $this->bo->read($start_date,$end_date);
+                       }
+                       $this->bo->get_origin_entity_type();
+                       $uicols_related = $this->bo->uicols_related;
+//_debug_array($uicols_related);
+                       $uicols = array();
+                       $i = 0;
+                       //$uicols['name'][0] = 'color';
+                       $uicols['name'][$i++] = 'priority';
+                       $uicols['name'][$i++] = 'id';
+                       $uicols['name'][$i++] = 'bgcolor';
+                       $uicols['name'][$i++] = 'subject';
+                       $uicols['name'][$i++] = 'loc1_name';
+                       $uicols['name'][$i++] = 'location_code';
+                       $uicols['name'][$i++] = 'address';
+//                     $uicols['name'][$i++] = 'user';
+                       $uicols['name'][$i++] = 'assignedto';
+                       $uicols['name'][$i++] = 'entry_date';
+                       $uicols['name'][$i++] = 'status';
+                       foreach($uicols_related as $related)
+                       {
+                               $uicols['name'][$i++] = $related;               
        
+                       }
+
+                       $uicols['name'][$i++] = 'finnish_date';
+                       $uicols['name'][$i++] = 'delay';
 
-                       $uicols=$this->bo->uicols;
+                       $uicols['name'][$i++] = 'child_date';
+                       $uicols['name'][$i++] = 'link_view';
+                       $uicols['name'][$i++] = 'lang_view_statustext';
+                       $uicols['name'][$i++] = 'text_view';
 
-//_debug_array($uicols);
-//_debug_array($ticket_list);
+                       $count_uicols_name = count($uicols['name']);
+
+                       $j = 0;
+                       $k = 0;
                        if(is_array($ticket_list))
                        {
                                $status['X'] = array
@@ -266,7 +628,7 @@
                                        'bgcolor'                       => 
'#5EFB6E',
                                        'status'                        => 
lang('closed'),
                                        'text_edit_status'      => lang('Open'),
-                                       'new_status'            => 'O',
+                                       'new_status'            => 'O'
                                );
 
                                $custom_status  = 
$this->bo->get_custom_status();
@@ -284,207 +646,104 @@
 
                                foreach($ticket_list as $ticket)
                                {
-                                       switch ($ticket['status'])
+                                       for ($k=0;$k<$count_uicols_name;$k++)
                                        {
-                                               case 'O':
-                                                       $bgcolor = 
$bgcolor_array[$ticket['priority']];
-                                                       $status_text = 
lang('Open');
-                                                       $text_edit_status = 
lang('Close');
-                                                       $new_status = 'X';
-                                               break;
-                                               default :
-                                                       $bgcolor                
        = $status[$ticket['status']]['bgcolor'];
-                                                       $status_text            
= $status[$ticket['status']]['status'];
-                                                       $text_edit_status       
= $status[$ticket['status']]['text_edit_status'];
-                                                       $new_status             
        = $status[$ticket['status']]['new_status'];
-                                               break;
+                                               if($uicols['name'][$k] == 
'status' && $ticket[$uicols['name'][$k]]=='O')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']    = lang('Open');
                                        }
-
-                                       $link_status_data = array
-                                       (
-                                               'menuaction'            => 
'property.uitts.index',
-                                               'id'                            
=> $ticket['id'],
-                                               'edit_status'           => true,
-                                               'new_status'            => 
$new_status,
-                                               'second_display'        => true,
-                                               'sort'                          
=> $this->sort,
-                                               'order'                         
=> $this->order,
-                                               'cat_id'                        
=> $this->cat_id,
-                                               'filter'                        
=> $this->filter,
-                                               'user_filter'           => 
$this->user_filter,
-                                               'query'                         
=> $this->query,
-                                               'district_id'           => 
$this->district_id,
-                                               'allrows'                       
=> $this->allrows
-                                       );
-//_debug_array($ticket['child_date']);
-                                       $content[] = array
-                                       (
-                                               'id'                            
        => $ticket['id'],
-                                               'bgcolor'                       
        => $bgcolor,
-                                               'new_ticket'                    
=> (isset($ticket['new_ticket'])?$ticket['new_ticket']:''),
-                                               'priostr'                       
        => $ticket['priority'],
-                                               'subject'                       
        => $ticket['subject'],
-                                               'location_code'                 
=> $ticket['location_code'],
-                                               'address'                       
        => $ticket['address'],
-                                               'date'                          
        => $ticket['timestampopened'],
-                                               'finnish_date'                  
=> $ticket['finnish_date'],
-                                               'delay'                         
        => (isset($ticket['delay'])?$ticket['delay']:''),
-                                               'user'                          
        => $ticket['user'],
-                                               'assignedto'                    
=> $ticket['assignedto'],
-                                               'child_date'                    
=> $ticket['child_date'],
-                                               'link_view'                     
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.view', 'id'=> $ticket['id'])),
-                                               'lang_view_statustext'  => 
lang('view the ticket'),
-                                               'text_view'                     
        => lang('view'),
-                                               'status'                        
        => $status_text,
-                                               'link_edit_status'              
=> $GLOBALS['phpgw']->link('/index.php',$link_status_data),
-                                               'lang_edit_status'              
=> lang('Edit status'),
-                                               'text_edit_status'              
=> $text_edit_status,
-                                       );
+                                               else if($uicols['name'][$k] == 
'status' && $ticket[$uicols['name'][$k]]=='C')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']    = lang('Closed');
                                }
+                                               else if($uicols['name'][$k] == 
'status' && array_key_exists($ticket[$uicols['name'][$k]],$status))
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$status[$ticket[$uicols['name'][$k]]]['status'];
                        }
-//_debug_array($content);
-                       $table_header[] = array
-                       (
-                               'sort_priority' => 
$this->nextmatchs->show_sort_order(array
+                                               else
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$ticket[$uicols['name'][$k]];
+                                               }
+                                               if($uicols['name'][$k] == 'id' 
|| $uicols['name'][$k] == 'entry_date')
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['format']   = 'link';
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['link']             =       
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'priority',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
+                                                                       
'menuaction'    => 'property.uitts.view',
+                                                                       'id'    
                => $ticket['id']
+                                                               ));
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$ticket[$uicols['name'][$k]] .  $ticket['new_ticket'];
+                                                       
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
+                                               }
 
-                               'lang_priority'         => lang('Priority'),
-                               'lang_priority_statustext'              => 
lang('Sort the tickets by their priority'),
+                                               $n = 0;
+                                               foreach($uicols_related as 
$related)
+                                               {
+                                                       if($uicols['name'][$k] 
== $related)
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['format']   = 'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['link']             = 
$ticket['child_date'][$n]['date_info'][0]['link'];
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$ticket['child_date'][$n]['date_info'][0]['entry_date'];
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['statustext']       = 
$ticket['child_date'][$n]['statustext'];
+                                                               
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
 
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'fm_tts_tickets.id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
+                                                       }
+                                                       $n++;
+                                               }
+                                       }
 
-                               'lang_id'               => lang('ID'),
-                               'lang_id_statustext'    => lang('Sort the 
tickets by their ID'),
+                                       $j++;
+                               }
+                       }
 
-                               'lang_subject'          => lang('Subject'),
-                               'lang_time_created'     => lang('Started'),
-                               'lang_view'             => lang('view'),
-                               'lang_location_code'    => lang('Location'),
-                               'lang_address'          => lang('Address'),
-                               'lang_user'             => lang('user'),
-                               'sort_assigned_to'      => 
$this->nextmatchs->show_sort_order(array
+                       $parameters = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'assignedto',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
-                               'lang_assigned_to'      => lang('Assigned to'),
-                               'sort_opened_by'        => 
$this->nextmatchs->show_sort_order(array
+                               'parameter' => array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'user_lid',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
-                               'sort_date'     => 
$this->nextmatchs->show_sort_order(array
+                                       array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'fm_tts_tickets.entry_date',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
+                                               'name'          => 'id',
+                                               'source'        => 'id'
+                                       ),
                                                                                
                                                        )
-                                                                               
)),
-                               'sort_finnish_date'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'finnish_date',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'filter'        => 
$this->filter,
-                                                                               
                                                        'user_filter'   => 
$this->user_filter,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'second_display'=> true,
-                                                                               
                                                        'allrows'       => 
$this->allrows,
-                                                                               
                                                        'start_date'    => 
$start_date,
-                                                                               
                                                        'end_date'      => 
$end_date
-                                                                               
                                                        )
-                                                                               
)),
-                               'lang_finnish_date'     => lang('finnish date'),
-                               'lang_delay'            => lang('delay'),
-                               'lang_finnish_statustext'=> lang('presumed 
finnish date'),
-                               'lang_opened_by'        => lang('Opened by'),
-                               'lang_status'           => lang('Status')
                        );
 
-                       for ($i=0;$i<count($uicols);$i++)
+                       if($this->acl_read)
                        {
-                               $table_header[0]['extra'][$i]['header'] = 
$uicols[$i];
-                       }
-
-                       $table_add[] = array
+                               $datatable['rowactions']['action'][] = array(
+                                       'my_name'                       => 
'view',
+                                       'statustext'    => lang('view the 
project'),
+                                       'text'                  => lang('view'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_add'              => lang('add'),
-                               'lang_add_statustext'   => lang('add a ticket'),
-                               'add_action'            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 'property.uitts.add'))
+                                                               'menuaction'    
=> 'property.uitts.view'
+                                                       )),
+                               'parameters'    => $parameters
                        );
+                       }
 
-                       $link_data = array
+                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_link'])
+                               && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_link'] == 
'yes'
+                               && $this->acl_edit)
+                       {
+                               
+                               foreach ($status as $status_code => 
$status_info)
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'status',
+                                               'statustext'    => 
$status_info['status'],
+                                               'text'                  => 
lang('change to') . ':  ' .$status_info['status'],
+                                               'confirm_msg'   => lang('do you 
really want to change the status to %1',$status_info['status']),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 'property.uitts.index',
-                               'second_display'=> true,
+                                                                       
'menuaction'            => 'property.uitts.edit_status',
+                                                                       
'edit_status'           => true,
+                                                                       
'new_status'            => $status_code,
+                                                                       
'second_display'        => true,
                                'sort'          => $this->sort,
                                'order'         => $this->order,
                                'cat_id'        => $this->cat_id,
@@ -492,135 +751,179 @@
                                'user_filter'   => $this->user_filter,
                                'query'         => $this->query,
                                'district_id'   => $this->district_id,
-                               'start_date'    => $start_date,
-                               'end_date'      => $end_date,
-                               'allrows'       => $this->allrows
+                                                                       
'allrows'                       => $this->allrows,
+                                                                       
'delete'                        => 'dummy'// FIXME to trigger the json in 
property.js.
+                                                                       )),
+                                               'parameters'    => $parameters
                        );
+                               }
+                       }
 
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
-                       
$GLOBALS['phpgw']->session->appsession('receipt','property','');
+                       if($this->acl_add)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'add',
+                                               'statustext'    => lang('Add 
new ticket'),
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uitts.add'
+                                                                               
))
+                               );
+                       }
 
-                       $GLOBALS['phpgw']->preferences->read_repository();
-                       $autorefresh ='';
-                       if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['refreshinterval']))
+                       unset($parameters);
+                       for ($i=0;$i<$count_uicols_name;$i++)
+                       {
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
lang($uicols['name'][$i]);
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='priority' || 
$uicols['name'][$i]=='id' || $uicols['name'][$i]=='assignedto' || 
$uicols['name'][$i]=='finnish_date'|| $uicols['name'][$i]=='user'|| 
$uicols['name'][$i]=='entry_date')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']   = $uicols['name'][$i];
+                                       }
+                                       if($uicols['name'][$i]=='text_view' || 
$uicols['name'][$i]=='bgcolor' || $uicols['name'][$i]=='child_date' || 
$uicols['name'][$i]== 'link_view' || 
$uicols['name'][$i]=='lang_view_statustext')
                        {
-                               $autorefresh = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['refreshinterval'].'; 
URL='.$GLOBALS['phpgw']->link('/index.php',$link_data);
+                                               
$datatable['headers']['header'][$i]['visible']          = false;
+                                               
$datatable['headers']['header'][$i]['format']           = 'hidden';
+                                       }
+                               }
                        }
 
+                       //path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
 
-                       if(!$this->allrows)
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($ticket_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // Column
+
+                       $appname                                                
= lang('helpdesk');
+                       $function_msg                                   = 
lang('list ticket');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= 'entry_date'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       $link_date_search       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.date_search'));
-
-                       $link_download = array
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 'property.uitts.download',
-                               'second_display'=> true,
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'user_filter'   => $this->user_filter,
-                               'query'         => $this->query,
-                               'district_id'   => $this->district_id,
-                               'allrows'       => $this->allrows,
-                               'start_date'    => $start_date,
-                               'end_date'      => $end_date,
-                               'start'         => $this->start
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $cat_select = '';
-                       $cat_filter = '';
-                       $pref_group_filters = '';
-                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters']))
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
                        {
-                               $pref_group_filters = true;
-                               $group_filters = 'select';
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
-                               $cat_select     = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id));
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               else 
if(isset($column['format']) && $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' title = '{$column['statustext']}'>" 
.$column['value']."</a>";
                        }
                        else
                        {
-                               $group_filters = 'filter';
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
-                               $cat_filter = 
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data));
+                                                 $json_row[$column['name']] = 
$column['value'];
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                                               if($column['name'] == 
'priority')
+                                               {
+                                                       $_value = 
$column['value'];//str_repeat("||", abs(6 - 2*$column['value'])) . 
$column['value'];
+                                                       
$json_row[$column['name']] = $_value;
+                                                               
switch($column['value'])
+                                                               {
+                                                                       case 1:
+                                                                               
$json_row[$column['name']] = "<div 
style='background-color:".$bgcolor_array[1].";'>".$_value."</div>";
+                                                                               
break;
+                                                                               
case 2:
+                                                                               
$json_row[$column['name']] = "<div 
style='background-color:".$bgcolor_array[2].";'>".$_value."</div>";
+                                                                               
break;
+                                                                       case 3:
+                                                                               
$json_row[$column['name']] = "<div 
style='background-color:".$bgcolor_array[3].";'>".$_value."</div>";
+                                                                               
break;
+                                                               }
+                                                               unset($_value);
 
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
+                               // values for control select
+                               $opt_cb_depend =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
+                               $default_value = array ('id'=>'','name'=>'!no 
part of town');
+                               array_unshift ($opt_cb_depend,$default_value);
+                                       $json['hidden']['dependent'][] = array 
( 'id' => $this->part_of_town_id,
+                                                      'value' => 
$this->bocommon->select2String($opt_cb_depend)
+                                                                               
                        );
+                                       // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'group_filters'                                 
=> $pref_group_filters,
-                               'lang_download'                                 
=> 'download',
-                               'link_download'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                            
=> lang('Download table to your browser'),
+// Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'start_date'                                    
=> $start_date,
-                               'end_date'                                      
        => $end_date,
-                               'lang_none'                                     
        => lang('None'),
-                               'lang_date_search'                              
=> lang('Date search'),
-                               'lang_date_search_help'                 => 
lang('Narrow the search by dates'),
-                               'link_date_search'                              
=> $link_date_search,
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
 
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'autorefresh'                                   
=> $autorefresh,
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
        => $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($ticket_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
 
-                               'cat_select'                                    
=> $cat_select,
-                               'cat_filter'                                    
=> $cat_filter,
-
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'filter_name'                                   
=> 'filter',
-                               'filter_list'                                   
=> $this->bo->filter(array('format' => $group_filters, 'filter'=> 
$this->filter,'default' => 'O')),
-                               'lang_show_all'                                 
=> lang('Open'),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
        => (isset($content)?$content:''),
-                               'table_add'                                     
        => $table_add,
-
-                               'district_list'                                 
=> $this->bocommon->select_district_list($group_filters,$this->district_id),
-                               'lang_no_district'                              
=> lang('no district'),
-                               'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
-                               'select_district_name'                  => 
'district_id',
-
-                               'lang_user_statustext'                  => 
lang('Assigned to'),
-                               'select_user_name'                              
=> 'user_filter',
-                               'lang_no_user'                                  
=> lang('No user'),
-                               'user_list'                                     
        => 
$this->bocommon->get_user_list_right2($group_filters,4,$this->user_filter,$this->acl_location,'',$default=''),
-                               'allow_edit_status'                             
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_link'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_link'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_link']:''
-                       );
-
-                       $appname                                        = 
lang('helpdesk');
-                       $function_msg                                   = 
lang('list ticket');
-
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
+       
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
$this->_simple ? 'tts.index.simple' : 'tts.index' , 'property' );
                }
 
                function index2()
@@ -649,26 +952,18 @@
 
                        if ($default_status && !$second_display)
                        {
-                               $this->bo->filter       = $default_status;
-                               $this->filter   = $default_status;
+                               $this->bo->status_id    = $default_status;
+                               $this->status_id        = $default_status;
                        }
 
-                       $bgcolor['1']   = '#dadada';
-                       $bgcolor['2']   = '#dad0d0';
-                       $bgcolor['3']   = '#dacaca';
-                       $bgcolor['4']   = '#dac0c0';
-                       $bgcolor['5']   = '#dababa';
-                       $bgcolor['6']   = '#dab0b0';
-                       $bgcolor['7']   = '#daaaaa';
-                       $bgcolor['8']   = '#da9090';
-                       $bgcolor['9']   = '#da8a8a';
-                       $bgcolor['10']  = '#da7a7a';
+                       $bgcolor_array[1]       = '#da7a7a';
+                       $bgcolor_array[2]       = '#dababa';
+                       $bgcolor_array[3]       = '#dadada';
 
 
-                       $ticket_list = 
$this->bo->read($start_date,$end_date,$external=true);
+                       $ticket_list = $this->bo->read($start_date,$end_date);
+                       $uicols = $this->bo->uicols;
 
-                       $uicols=$this->bo->uicols;
-
 //_debug_array($uicols);
 //_debug_array($ticket_list);
                        while (is_array($ticket_list) && list(,$ticket) = 
each($ticket_list))
@@ -686,12 +981,12 @@
                                (
                                        'id'                                    
=> $ticket['id'],
                                        'bgcolor'                               
=> $bgcolor[$ticket['priority']],
-                                       'new_ticket'                    => 
(isset($ticket['new_ticket'])?$ticket['new_ticket']:''),
+                                       'new_ticket'                    => 
$ticket['new_ticket']?$ticket['new_ticket']:'',
                                        'priostr'                               
=> str_repeat("||", $ticket['priority']),
                                        'subject'                               
=> $ticket['subject'],
                                        'location_code'                 => 
$ticket['location_code'],
                                        'address'                               
=> $ticket['address'],
-                                       'date'                                  
=> $ticket['timestampopened'],
+                                       'date'                                  
=> $ticket['entry_date'],
                                        'finnish_date'                  => 
$ticket['finnish_date'],
                                        'delay'                                 
=> (isset($ticket['delay'])?$ticket['delay']:''),
                                        'user'                                  
=> $ticket['user'],
@@ -713,8 +1008,8 @@
                                                                                
        'order' => $this->order,
                                                                                
        'extra' => array('menuaction' => 'property.uitts.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
+                                                                               
                                                        'filter'        
=>$this->status_id,
+                                                                               
                                                        'user_id'       
=>$this->user_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'second_display'        
=> true,
@@ -734,8 +1029,8 @@
                                                                                
        'order' => $this->order,
                                                                                
        'extra' => array('menuaction' => 'property.uitts.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
+                                                                               
                                                        'filter'        
=>$this->status_id,
+                                                                               
                                                        'user_id'       
=>$this->user_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'second_display'        
=> true,
@@ -761,8 +1056,8 @@
                                                                                
        'order' => $this->order,
                                                                                
        'extra' => array('menuaction' => 'property.uitts.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
+                                                                               
                                                        'filter'        
=>$this->status_id,
+                                                                               
                                                        'user_id'       
=>$this->user_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'second_display'        
=> true,
@@ -779,8 +1074,8 @@
                                                                                
        'order' => $this->order,
                                                                                
        'extra' => array('menuaction'   => 'property.uitts.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
+                                                                               
                                                        'filter'        
=>$this->status_id,
+                                                                               
                                                        'user_id'       
=>$this->user_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'second_display'        
=> true,
@@ -796,8 +1091,8 @@
                                                                                
        'order' => $this->order,
                                                                                
        'extra' => array('menuaction'   => 'property.uitts.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'filter'        
=>$this->filter,
-                                                                               
                                                        'user_filter'   
=>$this->user_filter,
+                                                                               
                                                        'filter'        
=>$this->status_id,
+                                                                               
                                                        'user_id'       
=>$this->user_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'second_display'        
=> true,
@@ -813,8 +1108,8 @@
                                                                                
        'order' => $this->order,
                                                                                
        'extra' => array('menuaction'   => 'property.uitts.index',
                                                                                
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'filter'        => 
$this->filter,
-                                                                               
                                                        'user_filter'   => 
$this->user_filter,
+                                                                               
                                                        'filter'        => 
$this->status_id,
+                                                                               
                                                        'user_id'       => 
$this->user_id,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'query'         => 
$this->query,
                                                                                
                                                        'second_display'=> true,
@@ -849,8 +1144,8 @@
                                'sort'                          => $this->sort,
                                'order'                         => $this->order,
                                'cat_id'                        => 
$this->cat_id,
-                               'filter'                        => 
$this->filter,
-                               'user_filter'           => $this->user_filter,
+                               'filter'                        => 
$this->status_id,
+                               'user_id'               => $this->user_id,
                                'query'                         => $this->query,
                                'district_id'           => $this->district_id,
                                'start_date'            => $start_date,
@@ -861,7 +1156,7 @@
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
                        
$GLOBALS['phpgw']->session->appsession('receipt','property','');
 
-                       $GLOBALS['phpgw']->preferences->read_repository();
+                       $GLOBALS['phpgw']->preferences->read();
                        $autorefresh ='';
                        if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['refreshinterval']))
                        {
@@ -888,8 +1183,8 @@
                                'sort'                          => $this->sort,
                                'order'                         => $this->order,
                                'cat_id'                        => 
$this->cat_id,
-                               'filter'                        => 
$this->filter,
-                               'user_filter'           => $this->user_filter,
+                               'filter'                        => 
$this->status_id,
+                               'user_id'               => $this->user_id,
                                'query'                         => $this->query,
                                'district_id'           => $this->district_id,
                                'allrows'                       => 
$this->allrows,
@@ -928,7 +1223,7 @@
 
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'filter_name'                                   
=> 'filter',
-                               'filter_list'                                   
=> $this->bo->filter(array('format' => 'filter', 'filter'=> 
$this->filter,'default' => 'open')),
+                               'filter_list'                                   
=> $this->bo->filter(array('format' => 'filter', 'filter'=> 
$this->status_id,'default' => 'open')),
                                'lang_show_all'                                 
=> lang('Open'),
                                'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
                                'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
@@ -955,10 +1250,19 @@
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
                        }
+                       if($this->tenant_id)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.add2'));
+                       }
 
                        $bolocation             = 
CreateObject('property.bolocation');
 
                        $values         = phpgw::get_var('values');
+                       $values['contact_id']           = 
phpgw::get_var('contact', 'int', 'POST');
+                       if ((isset($values['cancel']) && $values['cancel']))
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
+                       }
 
 //------------------- start ticket from other location
                        $bypass                 = phpgw::get_var('bypass', 
'bool');
@@ -984,7 +1288,7 @@
 
                                if($location_code)
                                {
-                                       $values['location_data'] = 
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+                                       $values['location_data'] = 
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num,
 'view' => true));
                                }
                        }
 
@@ -1008,7 +1312,7 @@
                                        );
                        }
 //_debug_array($insert_record);
-                       if (isset($values['save']))
+                       if ((isset($values['save']) && $values['save']) || 
(isset($values['apply']) && $values['apply']))
                        {
                                $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
                                $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
@@ -1023,6 +1327,12 @@
 
                                $values = 
$this->bocommon->collect_locationdata($values,$insert_record);
 
+
+                               if(!$values['subject'] && 
isset($this->bo->config->config_data['tts_mandatory_title']) && 
$this->bo->config->config_data['tts_mandatory_title'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please enter a title !'));
+                               }
+
                                if(!$values['cat_id'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
@@ -1040,13 +1350,32 @@
 
                                if(!$values['assignedto'] && 
!$values['group_id'])
                                {
-                                       $boresponsible = 
CreateObject('property.boresponsible');
-                                       if(!$values['assignedto']=      
$boresponsible->get_responsible($values))
+                                       $_responsible = 
execMethod('property.boresponsible.get_responsible', $values);
+                                       if(!$_responsible)
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to 
handle the ticket !'));
                                        }
+                                       else
+                                       {
+                                               if( 
$GLOBALS['phpgw']->accounts->get($_responsible)->type == 
phpgwapi_account::TYPE_USER )
+                                               {
+                                                       $values['assignedto'] = 
$_responsible;
+                                               }
+                                               else
+                                               {
+                                                       $values['group_id'] = 
$_responsible;
+                                               }
+                                       }
+                                       unset($_responsible);
                                }
 
+                               if(!isset($values['priority']) || 
!$values['priority'])
+                               {
+                                       $_priority = 
$this->bo->get_priority_list();
+                                       $values['priority'] = count($_priority);
+                                       unset($_priority);
+                               }
+
                                if(!isset($receipt['error']))
                                {
                                        $receipt = $this->bo->add($values);
@@ -1054,7 +1383,7 @@
 //------------ files
                                        $values['file_name'] = @str_replace(' 
','_',$_FILES['file']['name']);
 
-                                       if($values['file_name'])
+                                       if($values['file_name'] && 
$receipt['id'])
                                        {
                                                $bofiles        = 
CreateObject('property.bofiles');
                                                $to_file = $bofiles->fakebase . 
'/fmticket/' . $receipt['id'] . '/' . $values['file_name'];
@@ -1084,10 +1413,18 @@
 //--------------end files
                                        
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
                                        
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
+
+                                       if ((isset($values['save']) && 
$values['save']))
+                                       {
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
                                }
                                else
                                {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.view', 'id' => $receipt['id'], 'tab' =>'general'));             
                     
+                                       }
+                               }
+                               else
+                               {
                                        if(isset($values['location']) && 
$values['location'])
                                        {
                                                $location_code=implode("-", 
$values['location']);
@@ -1115,6 +1452,11 @@
                                                ));
 
 
+                       
$contact_data=$this->bocommon->initiate_ui_contact_lookup(array(
+                                               'contact_id'            => 
$ticket['contact_id'],
+                                               'field'                         
=> 'contact',
+                                               'type'                          
=> 'form'));
+
                        $link_data = array
                        (
                                'menuaction'    => 'property.uitts.add'
@@ -1140,11 +1482,18 @@
 
                        $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
 
+
+                       if(!$this->_simple && $this->_show_finnish_date)
+                       {
                        $jscal = CreateObject('phpgwapi.jscalendar');
                        $jscal->add_listener('values_finnish_date');
+                       }
 
                        $data = array
                        (
+                               'contact_data'                                  
=> $contact_data,
+                               'simple'                                        
        => $this->_simple,
+                               'show_finnish_date'                             
=> $this->_show_finnish_date,
                                'value_origin'                                  
=> isset($values['origin']) ? $values['origin'] : '',
                                'value_origin_type'                             
=> (isset($origin)?$origin:''),
                                'value_origin_id'                               
=> (isset($origin_id)?$origin_id:''),
@@ -1168,7 +1517,6 @@
                                'priority_list'                         => 
$this->bo->get_priority_list((isset($values['priority'])?$values['priority']:'')),
 
                                'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.index')),
                                'lang_subject'                          => 
lang('Subject'),
                                'lang_subject_statustext'               => 
lang('Enter the subject of this ticket'),
 
@@ -1176,7 +1524,8 @@
                                'lang_details_statustext'               => 
lang('Enter the details of this ticket'),
                                'lang_category'                         => 
lang('category'),
                                'lang_save'                             => 
lang('save'),
-                               'lang_done'                             => 
lang('done'),
+                               'lang_cancel'                           => 
lang('cancel'),
+                               'lang_send'                                     
=> lang('send'),
                                'value_details'                         => 
(isset($values['details'])?$values['details']:''),
                                'value_subject'                         => 
(isset($values['subject'])?$values['subject']:''),
 
@@ -1186,7 +1535,8 @@
                                'lang_datetitle'                        => 
lang('Select date'),
                                'lang_finnish_date_statustext'          => 
lang('Select the estimated date for closing the task'),
 
-                               'lang_done_statustext'                  => 
lang('Back to the ticket list'),
+                               'lang_cancel_statustext'                        
=> lang('Back to the ticket list'),
+                               'lang_send_statustext'                  => 
lang('Save the entry and return to list'),
                                'lang_save_statustext'                  => 
lang('Save the ticket'),
                                'lang_no_cat'                           => 
lang('no category'),
                                'lang_town_statustext'                  => 
lang('Select the part of town the building belongs to. To do not use a part of 
town -  select NO PART OF TOWN'),
@@ -1255,7 +1605,7 @@
                                }
                        }
 
-                       $values['location_data'] = 
$bolocation->read_single($values['location_code'],array('extra'=>array('tenant_id'=>$this->tenant_id)));
+                       $values['location_data'] = 
$bolocation->read_single($values['location_code'],array('tenant_id'=>$this->tenant_id,
 'view' => true));
 
                        $values['street_name'] = 
$values['location_data']['street_name'];
                        $values['street_number'] = 
$values['location_data']['street_number'];
@@ -1278,26 +1628,6 @@
 
                        if (isset($values['save']))
                        {
-
-// FIX this : relevant?
-/*                             $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
-
-                               if(isset($insert_record_entity) && 
is_array($insert_record_entity))
-                               {
-                                       for 
($j=0;$j<count($insert_record_entity);$j++)
-                                       {
-                                               
$insert_record['extra'][$insert_record_entity[$j]]      = 
$insert_record_entity[$j];
-                                       }
-                               }
-
-                               while (is_array($insert_record['extra']) && 
list($key,$column) = each($insert_record['extra']))
-                               {
-                                       if(isset($_POST[$key]) && $_POST[$key])
-                                       {
-                                               $values['extra'][$column]       
= phpgw::get_var($key, 'string', 'POST');
-                                       }
-                               }
-*/
                                if(!$values['subject'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket 
!'));
@@ -1313,7 +1643,7 @@
                                        $receipt = $this->bo->add($values);
                                        
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
                                        
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index2'));
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
                                }
                                else
                                {
@@ -1342,100 +1672,39 @@
                                'menuaction'    => 'property.uitts.add2'
                        );
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
-
                        $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
 
                        
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
 
                        $data = array
                        (
-                               'lang_dateformat'                               
        => strtolower($dateformat),
-                               'dateformat_validate'                           
=> $dateformat_validate,
-                               'onKeyUp'                                       
                => $onKeyUp,
-                               'onBlur'                                        
                => $onBlur,
                                'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'location_data'                                 
        => $location_data,
-                               'lang_assign_to'                                
        => lang('Assign to'),
-                               'lang_no_user'                                  
        => lang('Select user'),
-                               'lang_user_statustext'                          
=> lang('Select the user the selection belongs to. To do not use a user select 
NO USER'),
-                               'select_user_name'                              
        => 'values[assignedto]',
-                               'user_list'                                     
                => 
$this->bocommon->get_user_list_right2('select',4,$values['assignedto'],$this->acl_location),
 
-                               'lang_group'                                    
        => lang('Group'),
-                               'lang_no_group'                                 
        => lang('No group'),
-                               'group_list'                                    
        => 
$this->bocommon->get_group_list('select',$values['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
-                               'select_group_name'                             
        => 'values[group_id]',
-
-                               'lang_priority'                                 
        => lang('Priority'),
-                               'lang_priority_statustext'                      
=> lang('Select the priority the selection belongs to.'),
-                               'select_priority_name'                          
=> 'values[priority]',
-                               'priority_list'                                 
        => 
$this->bo->get_priority_list((isset($values['priority'])?$values['priority']:'')),
-
                                'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.index2')),
+                               'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.index')),
                                'lang_subject'                                  
        => lang('Subject'),
                                'lang_subject_statustext'                       
=> lang('Enter the subject of this ticket'),
 
                                'lang_details'                                  
        => lang('Details'),
                                'lang_details_statustext'                       
=> lang('Enter the details of this ticket'),
-                               'lang_category'                                 
        => lang('category'),
+
                                'lang_save'                                     
                => lang('save'),
                                'lang_done'                                     
                => lang('done'),
                                'value_details'                                 
        => (isset($values['details'])?$values['details']:''),
                                'value_subject'                                 
        => (isset($values['subject'])?$values['subject']:''),
 
-                               'lang_finnish_date'                             
        => lang('finnish date'),
-                               'value_finnish_date'                            
=> (isset($values['finnish_date'])?$values['finnish_date']:''),
-
                                'lang_done_statustext'                          
=> lang('Back to the ticket list'),
                                'lang_save_statustext'                          
=> lang('Save the ticket'),
-                               'lang_no_cat'                                   
        => lang('no category'),
-                               'lang_town_statustext'                          
=> lang('Select the part of town the building belongs to. To do not use a part 
of town -  select NO PART OF TOWN'),
-                               'lang_part_of_town'                             
        => lang('Part of town'),
-                               'lang_no_part_of_town'                          
=> lang('No part of town'),
-                               'cat_select'                                    
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
-                               'mailnotification'                              
        => 
(isset($this->bo->config->config_data['mailnotification'])?$this->bo->config->config_data['mailnotification']:''),
-                               'lang_mailnotification'                         
=> lang('Send e-mail'),
-                               'lang_mailnotification_statustext'      => 
lang('Choose to send mailnotification'),
-                               'pref_send_mail'                                
        => 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']:''),
                                'lang_contact_phone'                            
=> lang('contact phone'),
                                'lang_contact_phone_statustext'         => 
lang('contact phone'),
-                               'value_contact_phone'                           
=> (isset($values['contact_phone'])?$values['contact_phone']:''),
+                               'value_contact_phone'                           
=> isset($values['contact_phone'])?$values['contact_phone']:'',
 
                                'lang_contact_email'                            
=> lang('contact email'),
                                'lang_contact_email_statustext'         => 
lang('contact email'),
-                               'value_contact_email'                           
=> (isset($values['contact_email'])?$values['contact_email']:''),
+                               'value_contact_email'                           
=> isset($values['contact_email'])?$values['contact_email']:'',
                        );
 
-//_debug_array($data);
                        $appname                                        = 
lang('helpdesk');
                        $function_msg                                   = 
lang('add ticket');
 
@@ -1444,7 +1713,6 @@
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
-
                function view()
                {
                        if(!$this->acl_read)
@@ -1452,12 +1720,26 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
+                       $id = phpgw::get_var('id', 'int', 'GET');
+
+                       if($this->tenant_id)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.view2', 'id' => $id ));
+                       }
+
                        $bolocation     = CreateObject('property.bolocation');
 
-                       $id = phpgw::get_var('id', 'int', 'GET');
                        $values = phpgw::get_var('values');
-                       $receipt = '';
+                       $values['contact_id']           = 
phpgw::get_var('contact', 'int', 'POST');
+                       $values['ecodimb']                      = 
phpgw::get_var('ecodimb');
+                       $values['vendor_id']            = 
phpgw::get_var('vendor_id', 'int', 'POST');
+                       $values['vendor_name']          = 
phpgw::get_var('vendor_name', 'string', 'POST');
+                       $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int', 'POST');
+                       $values['b_account_name']       = 
phpgw::get_var('b_account_name', 'string', 'POST');
 
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
+                       
$GLOBALS['phpgw']->session->appsession('receipt','property','');
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files'));
 
                        if(isset($values['save']))
@@ -1467,10 +1749,35 @@
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>4, 'acl_location'=> $this->acl_location));
                                }
 
-                               $so2    = CreateObject('property.sotts2');
-                               $so2->acl_location      = $this->acl_location;
-                               $receipt = $so2->update_ticket($values,$id);
+                               $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+                               $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
+
+                               if(isset($insert_record_entity) && 
is_array($insert_record_entity))
+                               {
+                                       for 
($j=0;$j<count($insert_record_entity);$j++)
+                                       {
+                                               
$insert_record['extra'][$insert_record_entity[$j]]      = 
$insert_record_entity[$j];
+                                       }
+                               }
+
+                               $values = 
$this->bocommon->collect_locationdata($values,$insert_record);
 
+                               if(isset($values['budget']) && 
$values['budget'] && !ctype_digit($values['budget']))
+                               {
+                                       $values['budget'] = 
(int)$values['budget'];
+                                       
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
+                               }
+
+                               if(isset($values['takeover']) && 
$values['takeover'])
+                               {
+                                       $values['assignedto'] = $this->account;
+                               }
+                               $receipt = 
$this->bo->update_ticket($values,$id);
+                               if 
(isset($this->bo->config->config_data['mailnotification']) && 
$this->bo->config->config_data['mailnotification'])
+                               {
+                                       $receipt = $this->bo->mail_ticket($id, 
$this->bo->fields_updated, $receipt);
+                               }
+
 //--------- files
                                $bofiles        = 
CreateObject('property.bofiles');
                                if(isset($values['file_action']) && 
is_array($values['file_action']))
@@ -1506,13 +1813,17 @@
                                                $bofiles->vfs->override_acl = 0;
                                        }
                                }
+       //                      
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
                        }
 //---------end files
                        $ticket = $this->bo->read_single($id);
 
-                       $additional_notes = 
$this->bo->read_additional_notes($id);
-                       $record_history = $this->bo->read_record_history($id);
+                       $order_link                             = '';
+                       $add_to_project_link    = '';
+                       $request_link                   ='';
 
+                       if($GLOBALS['phpgw']->acl->check('.project.request', 
PHPGW_ACL_ADD, 'property'))
+                       {
                        $request_link_data = array
                        (
                                'menuaction'            => 
'property.uirequest.edit',
@@ -1526,7 +1837,11 @@
                                'origin_id'             => $id
                        );
 
+                               $request_link                   = 
$GLOBALS['phpgw']->link('/index.php',$request_link_data);
+                       }
 
+                       if($GLOBALS['phpgw']->acl->check('.project', 
PHPGW_ACL_ADD, 'property'))
+                       {
                        $order_link_data = array
                        (
                                'menuaction'            => 
'property.uiproject.edit',
@@ -1540,41 +1855,60 @@
                                'origin_id'             => $id
                        );
 
+                               $add_to_project_link_data = array
+                               (
+                                       'menuaction'            => 
'property.uiproject.index',
+                                       'from'                          => 
'workorder',
+                                       'lookup'                        => true,
+                                       'query'                         => 
isset($ticket['location_data']['loc1']) ? $ticket['location_data']['loc1'] : '',
+               //                      'p_num'                         => 
$ticket['p_num'],
+               //                      'p_entity_id'           => 
$ticket['p_entity_id'],
+               //                      'p_cat_id'                      => 
$ticket['p_cat_id'],
+                                       'tenant_id'                     => 
$ticket['tenant_id'],
+                                       'origin'                        => 
'.ticket',
+                                       'origin_id'                     => $id
+                               );
+
+                               $order_link                             = 
$GLOBALS['phpgw']->link('/index.php',$order_link_data);
+                               $add_to_project_link    = 
$GLOBALS['phpgw']->link('/index.php',$add_to_project_link_data);
+
+                       }
+
                        $form_link = array
                        (
                                'menuaction'    => 'property.uitts.view',
                                'id'            => $id
                        );
 
-                       $table_header_history[] = array
-                       (
-                               'lang_date'             => lang('Date'),
-                               'lang_user'             => lang('User'),
-                               'lang_action'           => lang('Action'),
-                               'lang_new_value'        => lang('New value')
-                       );
 
-                       $table_header_additional_notes[] = array
-                       (
-                               'lang_count'            => '#',
-                               'lang_date'             => lang('Date'),
-                               'lang_user'             => lang('User'),
-                               'lang_note'             => lang('Note'),
-                       );
+                       if($ticket['origin'] || $ticket['target'])
+                       {
+                               $lookup_type    = 'view';
+                               $type_id                = 
count(explode('-',$ticket['location_data']['location_code']));
+                       }
+                       else
+                       {
+                               $lookup_type    = 'form';
+                               $type_id                = -1;
+                       }
 
-//_debug_array($ticket['location_data']);
-
                        $location_data=$bolocation->initiate_ui_location(array(
                                                'values'        => 
$ticket['location_data'],
-                                               'type_id'       => 
count(explode('-',$ticket['location_data']['location_code'])),
+                                               'type_id'       => $type_id,
                                                'no_link'       => false, // 
disable lookup links for location type less than type_id
                                                'tenant'        => 
(isset($ticket['location_data']['tenant_id'])?$ticket['location_data']['tenant_id']:''),
-                                               'lookup_type'   => 'view',
+                                               'lookup_type'   => $lookup_type,
                                                'lookup_entity' => 
$this->bocommon->get_lookup_entity('ticket'),
                                                'entity_data'   => 
(isset($ticket['p'])?$ticket['p']:'')
                                                ));
+                       unset($type_id);
 
+                       
$contact_data=$this->bocommon->initiate_ui_contact_lookup(array(
+                                               'contact_id'            => 
$ticket['contact_id'],
+                                               'field'                         
=> 'contact',
+                                               'type'                          
=> 'form'));
 
+
                        if($ticket['contact_phone'])
                        {
                                for 
($i=0;$i<count($location_data['location']);$i++)
@@ -1592,14 +1926,15 @@
                        }
 
                        $start_entity   = 
$this->bocommon->get_start_entity('ticket');
-//_debug_array($start_entity);
 
-                       $link_entity = '';
+                       $link_entity = array();
                        if (isset($start_entity) AND is_array($start_entity))
                        {
                                $i=0;
                                foreach($start_entity as $entry)
                                {
+                                       
if($GLOBALS['phpgw']->acl->check(".entity.{$entry['id']}", PHPGW_ACL_ADD, 
'property'))
+                                       {
                                        $link_entity[$i]['link'] = 
$GLOBALS['phpgw']->link('/index.php',array
                                        (
                                                'menuaction'            => 
'property.uientity.edit',
@@ -1617,6 +1952,7 @@
                                $i++;
                                }
                        }
+                       }
 
 //_debug_array($link_entity);
 
@@ -1628,100 +1964,483 @@
                                'id'            => $id
                        );
 
+                       if(!$this->_simple && $this->_show_finnish_date)
+                       {
                        $jscal = CreateObject('phpgwapi.jscalendar');
                        $jscal->add_listener('values_finnish_date');
+                       }
 
+                       // -------- start order section
+                       $order_read                     = 
$this->acl->check('.ticket.order', PHPGW_ACL_READ, 'property');
+                       $order_add                              = 
$this->acl->check('.ticket.order', PHPGW_ACL_ADD, 'property');
+                       $order_edit                     = 
$this->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
+                       
+                       $access_order = false;
+                       if($order_read || $order_add || $order_edit)
+                       {
+                               $access_order = true;
+                       }
+
+                       if($order_read)
+                       {
+                               
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+                                               'vendor_id'                     
=> $ticket['vendor_id'],
+                                               'vendor_name'           => 
$ticket['vendor_name']));
+
+                               $vendor_email = 
execMethod('property.sowo_hour.get_email', $ticket['vendor_id']);
+
+                               
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+                                               'b_account_id'          => 
$ticket['b_account_id'] ? $ticket['b_account_id'] : $ticket['b_account_id'],
+                                               'b_account_name'        => 
$ticket['b_account_name'],
+                                               'disabled'                      
=> !!$ticket['b_account_id']));
+
+                               
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array
+                                       (
+                                               'ecodimb'                       
=> $ticket['ecodimb'] ? $ticket['ecodimb'] : $ticket['ecodimb'],
+                                               'ecodimb_descr'         => 
$ticket['ecodimb_descr'],
+                                               'disabled'                      
=> !!$ticket['ecodimb']
+                                       )
+                               );
+                       
+                               // approval
+                               $supervisor_id = 0;
+
+                               if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
+                                       && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'] )
+                               {
+                                       $supervisor_id = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'];
+                               }
+
+                               $need_approval = 
isset($this->bo->config->config_data['workorder_approval']) ? 
$this->bo->config->config_data['workorder_approval'] : '';
+
+                               $supervisor_email = array();
+                               if ($supervisor_id && $need_approval)
+                               {
+                                       $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
+                                       $supervisor_email[] = array
+                                       (
+                                               'id'      => $supervisor_id,
+                                               'address' => $prefs['email'],
+                                       );
+                                       if ( isset($prefs['approval_from']) )
+                                       {
+                                               $prefs2 = 
$this->bocommon->create_preferences('property', $prefs['approval_from']);
+
+                                               if(isset($prefs2['email']))
+                                               {
+                                                       $supervisor_email[] = 
array
+                                                       (
+                                                               'id'      => 
$prefs['approval_from'],
+                                                               'address' => 
$prefs2['email'],
+                                                       );
+                                                       $supervisor_email = 
array_reverse($supervisor_email);
+                                               }
+                                               unset($prefs2);
+                                       }
+                                       unset($prefs);
+                               }
+                               // approval                                     
+                       }
+
+
+                       if(isset($values['send_order']) && 
$values['send_order'])
+                       {
+
+
+                               if(isset($values['vendor_email']) && 
$values['vendor_email'])
+                               {
+                                       $subject = lang(workorder).": 
{$ticket['order_id']}";
+
+                                       $organisation = '';
+                                       $contact_name = '';
+                                       $contact_email = '';
+                                       $contact_phone = '';
+
+                                       
if(isset($this->bo->config->config_data['org_name']))
+                                       {
+                                               $organisation = 
$this->bo->config->config_data['org_name'];
+                                       }
+
+                                       $user_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
+                                       $ressursnr = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'];
+                                       $location = lang('Address'). ": 
{$ticket['address']}<br>";
+
+                                       $address_element = 
$this->bo->get_address_element($ticket['location_code']);
+
+                                       foreach($address_element as 
$address_entry)
+                                       {
+                                               $location .= 
"{$address_entry['text']}: {$address_entry['value']} <br>";
+                                       }
+
+                                       $location = rtrim($location, '<br>');
+
+                                       $order_description = 
$ticket['order_descr'];
+
+                                       
if(isset($contact_data['value_contact_name']) && 
$contact_data['value_contact_name'])
+                                       {
+                                               $contact_name = 
$contact_data['value_contact_name'];
+                                       }
+                                       
if(isset($contact_data['value_contact_email']) && 
$contact_data['value_contact_email'])
+                                       {
+                                               $contact_email = "<a 
href='mailto:{$contact_data['value_contact_email']}'>{$contact_data['value_contact_email']}</a>";
+                                       }
+                                       
if(isset($contact_data['value_contact_tel']) && 
$contact_data['value_contact_tel'])
+                                       {
+                                               $contact_phone = 
$contact_data['value_contact_tel'];
+                                       }
+
+                                       $order_id = $ticket['order_id'];
+
+                                       $user_phone = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['cellphone'];
+                                       $user_email = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+                                       $order_email_template = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['order_email_template'];
+
+                                       $body = nl2br(str_replace(array
+                                                               (
+                                                                       
'__organisation__',
+                                                                       
'__user_name__',
+                                                                       
'__user_phone__',
+                                                                       
'__user_email__',
+                                                                       
'__ressursnr__',
+                                                                       
'__location__',
+                                                                       
'__order_description__',
+                                                                       
'__contact_name__',
+                                                                       
'__contact_email__',
+                                                                       
'__contact_phone__',
+                                                                       
'__order_id__',
+                                                                       '[b]',
+                                                                       '[/b]'
+                                                               ),array
+                                                               (
+                                                                       
$organisation,
+                                                                       
$user_name,
+                                                                       
$user_phone,
+                                                                       
$user_email,
+                                                                       
$ressursnr,
+                                                                       
$location,
+                                                                       
$order_description,
+                                                                       
$contact_name,
+                                                                       
$contact_email,
+                                                                       
$contact_phone,
+                                                                       
$order_id,
+                                                                       '<b>',
+                                                                       '</b>'
+                                                               
),$order_email_template));
+
+                                       if(isset($values['file_attach']) && 
is_array($values['file_attach']))
+                                       {
+                                               $bofiles        = 
CreateObject('property.bofiles');
+                                               $attachments = 
$bofiles->get_attachments("/fmticket/{$id}/", $values['file_attach']);
+                                               $attachment_log = ' ' . 
lang('attachments') . ' : ' . implode(', ',$values['file_attach']);
+                                       }
+                                       if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
+                                       {
+                                               if 
(!is_object($GLOBALS['phpgw']->send))
+                                               {
+                                                       $GLOBALS['phpgw']->send 
= CreateObject('phpgwapi.send');
+                                               }
+
+                                               $coordinator_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
+                                               $coordinator_email = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+
+                                               $bcc = $coordinator_email;
+                                               
if(isset($contact_data['value_contact_email']) && 
$contact_data['value_contact_email'])
+                                               {
+                                                       $bcc .= 
";{$contact_data['value_contact_email']}";
+                                               }
+
+                                               $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $values['vendor_email'], $subject, 
stripslashes($body), '', $cc, $bcc, $coordinator_email, $coordinator_name, 
'html', '', $attachments , true);
+                                               if($rcpt)
+                                               {
+                                                       
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
+                                                       $historylog     = 
CreateObject('property.historylog','tts');
+                                                       
$historylog->add('M',$id,"{$values['vendor_email']}{$attachment_log}");
+                                                       
$receipt['message'][]=array('msg'=>lang('Workorder is sent by email!'));
+                                                       $action_params = array
+                                                       (
+                                                               'appname'       
                => 'property',
+                                                               'location'      
                => '.ticket',
+                                                               'id'            
                => $id,
+                                                               'responsible'   
        => $values['vendor_id'],
+                                                               
'responsible_type'  => 'vendor',
+                                                               'action'        
                => 'remind',
+                                                               'remark'        
                => '',
+                                                               'deadline'      
                => ''
+                                                       );
+                               
+                                                       $reminds = 
execMethod('property.sopending_action.set_pending_action', $action_params);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('SMTP server is not set! (admin 
section)'));
+                                       }
+                               }
+                       }
+                       // start approval
+                       if ($values['approval'] && $values['mail_address'] && 
$this->bo->config->config_data['workorder_approval'])
+                       {
+                               
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
+                               
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+
+                               $subject = lang(Approval).": 
".$ticket['order_id'];
+                               $message = '<a href ="http://' . 
$GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.view', 'id'=> $id)).'">' . lang('Workorder %1 needs 
approval',$ticket['order_id']) .'</a>';
+
+                               if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
+                               {
+                                       if (!is_object($GLOBALS['phpgw']->send))
+                                       {
+                                               $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
+                                       }
+
+                                       $action_params = array
+                                       (
+                                               'appname'                       
=> 'property',
+                                               'location'                      
=> '.ticket',
+                                               'id'                            
=> $id,
+                                               'responsible'           => '',
+                                               'responsible_type'  => 'user',
+                                               'action'                        
=> 'approval',
+                                               'remark'                        
=> '',
+                                               'deadline'                      
=> ''
+                                       );
+                                       $bcc = '';//$coordinator_email;
+                                       foreach ($values['mail_address'] as 
$_account_id => $_address)
+                                       {
+                                               
if(isset($values['approval'][$_account_id]) && 
$values['approval'][$_account_id])
+                                               {
+                                                       
$action_params['responsible'] = $_account_id;
+                                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_address, $subject, 
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name, 
'html');
+                                                       if($rcpt)
+                                                       {
+                                                               
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
+                                                       }
+
+                                                        
execMethod('property.sopending_action.set_pending_action', $action_params);
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('SMTP server is not set! (admin 
section)'));
+                               }
+                       }
+       
+                       // end approval
+
+                       // -------- end order section
+
+
+
+                       $additional_notes = 
$this->bo->read_additional_notes($id);
+                       $record_history = $this->bo->read_record_history($id);
+
+                       $notes = array
+                       (
+                               array
+                               (
+                                       'value_count' => 1,
+                                       'value_date' => 
$GLOBALS['phpgw']->common->show_date($ticket['timestamp']),
+                                       'value_user' => $ticket['user_name'],
+                       'value_note' => $ticket['details']
+                               )
+                       );
+
+                       $additional_notes = 
array_merge($notes,$additional_notes);
+                       
+                       if(isset($values['order_text']) && $ticket['order_id'])
+                       {
+                               foreach($values['order_text'] as $_text)
+                               {
+                                       $ticket['order_descr'] .= "\n$_text";
+                               }
+                       }
+
+                       $note_def = array
+                       (
+                               array('key' => 'value_count',   'label'=>'#',   
        'sortable'=>true,'resizeable'=>true),
+                               array('key' => 'value_date',    
'label'=>lang('Date'),'sortable'=>true,'resizeable'=>true),
+                       array('key' => 'value_user',    
'label'=>lang('User'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 'value_note',    
'label'=>lang('Note'),'sortable'=>true,'resizeable'=>true)
+                       );
+
+                       if($access_order)
+                       {
+                               $note_def[] = array('key' => 
'order_text','label'=>lang('order 
text'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter');
+                               foreach($additional_notes as &$note)
+                               {
+                                       $note['order_text'] = '<input 
type="checkbox" name="values[order_text][]" value="'.$note['value_note'].'" 
title="'.lang('Check to add text to order').'">';
+                               }
+                       }
+
+//_debug_Array($additional_notes);die();
+                       //---datatable 
settings---------------------------------------------------      
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($additional_notes),
+                                       'total_records'                 => 
count($additional_notes),
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );                                      
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode($note_def)
+                       );              
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($record_history),
+                                       'total_records'                 => 
count($record_history),
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );                                      
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      json_encode(array(      
array('key' => 'value_date',    'label'=>lang('Date'),  
'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'value_user',    'label'=>lang('User'),  
'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'value_action',  'label'=>lang('Action'),        
'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'value_old_value','label'=>lang('old value'),    
'sortable'=>true,'resizeable'=>true),
+                                                                               
        array('key' => 'value_new_value','label'=>lang('New 
value'),'sortable'=>true,'resizeable'=>true)))
+                       );      
+                       
+                       
+                       $link_to_files = 
(isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:'');
+                       
+                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+                       
+                       for($z=0; $z<count($ticket['files']); $z++)
+                       {                               
+                               if ($link_to_files != '')
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$ticket['files'][$z]['directory'].'/'.$ticket['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$ticket['files'][$z]['name'].'</a>';
+                               }
+                               else
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$ticket['files'][$z]['file_name'].'" 
target="_blank" title="'.lang('click to view 
file').'">'.$ticket['files'][$z]['name'].'</a>';
+                               }                               
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$ticket['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'">';
+                               $content_files[$z]['attach_file'] = '<input 
type="checkbox" name="values[file_attach][]" 
value="'.$ticket['files'][$z]['name'].'" title="'.lang('Check to attach 
file').'">';
+                       }                                                       
+
+                       $datavalues[2] = array
+                       (
+                                       'name'                                  
=> "2",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'permission'                    => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $attach_file_def = array
+                       (
+                               array('key' => 
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter'),
+                       );
+
+                       if(isset($ticket['order_id']) && $ticket['order_id'])
+                       {
+                               $attach_file_def[] = array('key' => 
'attach_file','label'=>lang('attach 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter');
+                       }
+
+                       $myColumnDefs[2] = array
+                       (
+                               'name'          => "2",
+                               'values'        =>      
json_encode($attach_file_def)
+                       );
+                       
+                       
//----------------------------------------------datatable settings--------      
                
+
                        $data = array
                        (
+                               'access_order'                                  
=> $access_order,
+                               'currency'                                      
        => $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+                               'value_order_id'                                
=> $ticket['order_id'],
+                               'value_order_descr'                             
=> $ticket['order_descr'],
+                               'vendor_data'                                   
=> $vendor_data,
+                               'b_account_data'                                
=> $b_account_data,
+                               'ecodimb_data'                                  
=> $ecodimb_data,
+                               'value_budget'                                  
=> $ticket['budget'],
+                               'value_actual_cost'                             
=> $ticket['actual_cost'],
+                               'need_approval'                                 
=> $need_approval,
+                               'value_approval_mail_address'   => 
$supervisor_email,
+                               'vendor_email'                                  
=> $vendor_email,
+
+                               'contact_data'                                  
=> $contact_data,
+                               'lookup_type'                                   
=> $lookup_type,
+                               'simple'                                        
        => $this->_simple,
+                               'show_finnish_date'                             
=> $this->_show_finnish_date,
+                               'tabs'                                          
        => self::_generate_tabs(true),
+                               'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
        => $datavalues,
+                               'myColumnDefs'                                  
=> $myColumnDefs,
+                       
                                'value_origin'                          => 
$ticket['origin'],
                                'value_target'                          => 
$ticket['target'],
-                               'lang_finnish_date'                     => 
lang('finnish date'),
                                'value_finnish_date'            => 
$ticket['finnish_date'],
                                'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
                                'lang_datetitle'                        => 
lang('Select date'),
-                               'lang_finnish_date_statustext'          => 
lang('Select the estimated date for closing the task'),
 
                                'link_entity'                           => 
$link_entity,
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
 
                                'location_data'                         => 
$location_data,
-                               'lang_location_code'                    => 
lang('Location Code'),
 
-                               'lang_ticket'                           => 
lang('Ticket'),
-                               'table_header_additional_notes'         => 
$table_header_additional_notes,
-                               'table_header_history'                  => 
$table_header_history,
-                               'lang_status'                           => 
lang('Status'),
                                'status_name'                           => 
'values[status]',
+                               'value_status'                                  
=> $ticket['status'],
                                'status_list'                           => 
$this->bo->get_status_list($ticket['status']),
-                               'lang_status_statustext'                => 
lang('Set the status of the ticket'),
 
                                'lang_no_user'                          => 
lang('Select user'),
                                'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
                                'select_user_name'                      => 
'values[assignedto]',
+                               'value_assignedto_id'                   => 
$ticket['assignedto'],
                                'user_list'                                     
=> 
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl_location),
 
-                               'lang_group'                            => 
lang('Group'),
                                'lang_no_group'                         => 
lang('No group'),
                                'group_list'                            => 
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
                                'select_group_name'                     => 
'values[group_id]',
+                               'value_group_id'                                
=> $ticket['group_id'],
 
-                               'lang_priority'                         => 
lang('Priority'),
+                               'lang_takeover'                                 
=> (isset($values['assignedto']) && $values['assignedto'] != $this->account)  
|| (!isset($values['assignedto']) || !$values['assignedto']) ? lang('take 
over') : '',
+
                                'value_priority'                        => 
$ticket['priority'],
                                'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
                                'select_priority_name'                  => 
'values[priority]',
                                'priority_list'                         => 
$this->bo->get_priority_list($ticket['priority']),
 
                                'lang_no_cat'                           => 
lang('no category'),
+                               'value_cat_id'                                  
=> $this->cat_id,
                                'cat_select'                            => 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
-                               'lang_category'                         => 
lang('category'),
                                'value_category_name'                   => 
$ticket['category_name'],
 
                                'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$form_link),
                                'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uitts.index')),
                                'value_subject'                         => 
$ticket['subject'],
-                               'lang_subject_statustext'               => 
lang('update subject'),
+
                                'value_id'                              => '[ 
#'. $id . ' ] - ',
 
-                               'lang_details'                          => 
lang('Details'),
                                'value_details'                         => 
$ticket['details'],
-                               'lang_details_statustext'               => 
lang('Add new comments'),
 
-                               'lang_additional_notes'                 => 
lang('Additional notes'),
-
-                               'lang_new_note'                         => 
lang('New Note'),
-                               'lang_opendate'                         => 
lang('Open Date'),
-                               'value_opendate'                        => 
$ticket['timestampopened'],
-
-                               'lang_assignedfrom'                     => 
lang('Assigned from'),
+                               'value_opendate'                                
=> $ticket['entry_date'],
                                'value_assignedfrom'                    => 
$ticket['user_name'],
-                               'lang_assignedto'                       => 
lang('Assigned to'),
-                               'value_assignedto'                      => 
isset($ticket['assignedto_name'])?$ticket['assignedto_name']:'',
+                               'value_assignedto_name'                 => 
isset($ticket['assignedto_name'])?$ticket['assignedto_name']:'',
 
-                               'lang_no_additional_notes'              => 
lang('No additional notes'),
-                               'lang_history'                          => 
lang('History'),
-                               'lang_no_history'                       => 
lang('No history for this record'),
                                'additional_notes'                      => 
$additional_notes,
                                'record_history'                        => 
$record_history,
-                               'request_link'                          => 
$GLOBALS['phpgw']->link('/index.php',$request_link_data),
-                               'order_link'                            => 
$GLOBALS['phpgw']->link('/index.php',$order_link_data),
-
-                               'lang_generate_request'                 => 
lang('Generate Request'),
-                               'lang_generate_request_statustext'      => 
lang('click this to generate a request with this information'),
-                               'lang_generate_order'                   => 
lang('Generate order'),
-                               'lang_generate_order_statustext'        => 
lang('click this to generate an order with this information'),
-
-                               'lang_save'                             => 
lang('save'),
+                               'request_link'                                  
=> $request_link,
+                               'order_link'                                    
=> $order_link,
+                               'add_to_project_link'                   => 
$add_to_project_link,
+
                                'lang_name'                             => 
lang('name'),
-                               'lang_done'                             => 
lang('done'),
-                               'lang_contact_phone'                    => 
lang('Contact phone'),
                                'contact_phone'                         => 
$ticket['contact_phone'],
-                               'mailnotification'                      => 
(isset($this->bo->config->config_data['mailnotification'])?true:''),
-                               'lang_mailnotification'                 => 
lang('Send e-mail'),
-                               'lang_mailnotification_statustext'      => 
lang('Choose to send mailnotification'),
-                               'pref_send_mail'                        => 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']:''),
-                               'fileupload'                            => 
(isset($this->bo->config->config_data['fmttsfileupload'])?$this->bo->config->config_data['fmttsfileupload']:''),
+                               'mailnotification'                              
=> isset($this->bo->config->config_data['mailnotification'])?true:'',
+                               'pref_send_mail'                                
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']:'',
+                               'fileupload'                                    
=> 
isset($this->bo->config->config_data['fmttsfileupload'])?$this->bo->config->config_data['fmttsfileupload']:'',
                                'link_view_file'                                
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
-                               'link_to_files'                                 
=> 
(isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:''),
+                               'link_to_files'                                 
=> 
isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:'',
                                'files'                                         
        => isset($ticket['files'])?$ticket['files']:'',
                                'lang_files'                                    
=> lang('files'),
                                'lang_filename'                                 
=> lang('Filename'),
@@ -1730,12 +2449,33 @@
                                'lang_file_action_statustext'   => lang('Check 
to delete file'),
                                'lang_upload_file'                              
=> lang('Upload file'),
                                'lang_file_statustext'                  => 
lang('Select file to upload'),
-
+                               'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
                        );
-//_debug_array($data);
+
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'tts.view', 'property' );
+                       //-----------------------datatable settings---
+                       
+                       
+                       
                        $appname                                        = 
lang('helpdesk');
                        $function_msg                                   = 
lang('view ticket detail');
-
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                //      $GLOBALS['phpgw']->xslttpl->pp();
@@ -1767,9 +2507,13 @@
                                $values['group_id'] = 'ignore';
                                $values['cat_id'] = 'ignore';
 
-                               $so2    = CreateObject('property.sotts2');
-                               $so2->acl_location      = '.ticket.external';
-                               $receipt = $so2->update_ticket($values,$id);
+                               $so     = CreateObject('property.sotts');
+                               $so->acl_location       = '.ticket.external';
+                               $receipt = $so->update_ticket($values,$id);
+                               if 
(isset($this->bo->config->config_data['mailnotification']) && 
$this->bo->config->config_data['mailnotification'])
+                               {
+                                       $receipt = $this->bo->mail_ticket($id, 
$so->fields_updated, $receipt);
+                               }
                        }
 
                        $ticket = $this->bo->read_single($id);
@@ -1932,7 +2676,7 @@
                                'value_category_name'                   => 
$ticket['category_name'],
 
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$form_link),
-                               'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uitts.index2')),
+                               'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uitts.index')),
                                'value_subject'                                 
=> $ticket['subject'],
                                'lang_subject_statustext'               => 
lang('update subject'),
                                'value_id'                                      
        => '[ #'. $id . ' ] - ',
@@ -1945,12 +2689,12 @@
 
                                'lang_new_note'                                 
=> lang('New Note'),
                                'lang_opendate'                                 
=> lang('Open Date'),
-                               'value_opendate'                                
=> $ticket['timestampopened'],
+                               'value_opendate'                                
=> $ticket['entry_date'],
 
                                'lang_assignedfrom'                             
=> lang('Assigned from'),
                                'value_assignedfrom'                    => 
$ticket['user_name'],
                                'lang_assignedto'                               
=> lang('Assigned to'),
-                               'value_assignedto'                              
=> (isset($ticket['assignedto_name'])?$ticket['assignedto_name']:''),
+                               'value_assignedto_name'                         
=> (isset($ticket['assignedto_name'])?$ticket['assignedto_name']:''),
 
                                'lang_no_additional_notes'              => 
lang('No additional notes'),
                                'lang_history'                                  
=> lang('History'),
@@ -1982,5 +2726,27 @@
                        $bofiles        = CreateObject('property.bofiles');
                        $bofiles->view_file('fmticket');
                }
+
+               protected function _generate_tabs($history='')
+               {
+                       if(!$tab = phpgw::get_var('tab'))
+                       {
+                               $tab = 'general';
+                       }
+
+                       $tabs = array
+                       (
+                               'general'               => array('label' => 
lang('general'), 'link' => '#general')
+                       );
+
+                       if($history)
+                       {
+                               $tabs['history']        = array('label' => 
lang('history'), 'link' => '#history');
+                       }
+
+                       phpgwapi_yui::tabview_setup('ticket_tabview');
+
+                       return  phpgwapi_yui::tabview_generate($tabs, $tab);
        }
 
+       }

Modified: people/sigurdne/modules/property/trunk/inc/class.uiwo_hour.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiwo_hour.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiwo_hour.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -31,6 +31,7 @@
         * Description
         * @package property
         */
+       phpgw::import_class('phpgwapi.yui');
 
        class property_uiwo_hour
        {
@@ -72,9 +73,9 @@
                        $this->bopricebook                      = 
CreateObject('property.bopricebook');
 
                        $this->bocommon                         = 
CreateObject('property.bocommon');
-                       $this->config                           = 
CreateObject('phpgwapi.config');
+                       $this->config                           = 
CreateObject('phpgwapi.config','property');
 
-                       $this->config->read_repository();
+                       $this->config->read();
 
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location                     = '.project';
@@ -111,7 +112,7 @@
 
                function deviation()
                {
-                       $workorder_id   = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id   = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $hour_id                = phpgw::get_var('hour_id', 
'int');
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
@@ -138,8 +139,8 @@
                                                'lang_edit_statustext'          
=> lang('edit the deviation'),
                                                'text_edit'                     
=> lang('edit'),
                                                'link_delete'                   
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.delete', 'workorder_id'=> $workorder_id, 'hour_id'=> 
$hour_id, 'deviation_id'=> $entry['id'])),
-                                               'lang_delete_statustext'        
=> lang('delete the deviation'),
-                                               'text_delete'                   
=> lang('delete'),
+                                               'lang_delete_statustext'=> 
lang('delete the deviation'),
+                                               'text_delete'                   
=> lang('delete')
                                        );
                                }
                        }
@@ -163,9 +164,56 @@
                                                'hour_id'       => $hour_id
                        );
 
+//---datatable0 settings---------------------------------------------------    
 
+                       $parameters['edit'] = array('parameter' => array(
+                                       array('name'  => 
'workorder_id','source' => $workorder_id,      'ready'  => 1),
+                                       array('name'  => 'hour_id',             
'source' => $hour_id,           'ready'  => 1),
+                                       array('name'  => 'id',                  
'source' => 'id')));                            
+                       
+                       $parameters['delete'] = array('parameter' => array(
+                                       array('name'  => 
'workorder_id','source' => $workorder_id,      'ready'  => 1),
+                                       array('name'  => 'hour_id',             
'source' => $hour_id,           'ready'  => 1),
+                                       array('name'  => 
'deviation_id','source' => 'id')));
+
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => lang('edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiwo_hour.edit_deviation')),
+                                       'parameters'    => $parameters['edit']);
+
+                       $permissions['rowactions'][] = array(
+                                       'text'                  => 
lang('delete'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uiwo_hour.delete' )),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'parameters'    => 
$parameters['delete']);
+                       
+                       
+                       $datavalues[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                => 
json_encode($content),
+                               'total_records' => count($content),
+                               'permission'    => 
json_encode($permissions['rowactions']),
+                               'is_paginator'  => 0,
+                               'footer'                => 0
+                       );                                      
+                       $myColumnDefs[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                =>      
json_encode(array(      array('key' => 'id',            'label' => 
$table_header[0]['lang_id'],         'sortable' => true,'resizeable' => true),
+                                                                               
                        array('key' => 'amount',        'label' => 
$table_header[0]['lang_amount'],     'sortable' => true,'resizeable' => true, 
'formatter' => 'FormatterRight'),
+                                                                               
                        array('key' => 'descr',         'label' => 
$table_header[0]['lang_descr'],      'sortable' => true,'resizeable' => true),
+                                                                               
                array('key' => 'entry_date','label' => 
$table_header[0]['lang_date'],   'sortable' => true,'resizeable' => true)))
+                       );      
+
+//------------------------------------datatable0 settings------------------    
                        
                        $data = array
                        (
+                               'property_js'                           => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                         => 
json_encode(array(menuaction => "property.uiwo_hour.deviation")),
+                               'datatable'                                     
=> $datavalues,
+                               'myColumnDefs'                          => 
$myColumnDefs,
+                               
                                'sum_deviation'                         => 
$sum_deviation,
                                'table_header_deviation'                => 
$table_header,
                                'values_deviation'                      => 
$content,
@@ -176,6 +224,25 @@
                                'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.index', 'workorder_id'=> $workorder_id))
                        );
 
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'wo_hour.deviation', 'property' );
+                       //-----------------------datatable settings---          
                        
+
                        $appname                        = lang('Workorder');
                        $function_msg                   = lang('list 
deviation');
 
@@ -186,7 +253,7 @@
 
                function edit_deviation()
                {
-                       $workorder_id   = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id   = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $hour_id        = phpgw::get_var('hour_id', 'int');
                        $id             = phpgw::get_var('id', 'int');
                        $values         = phpgw::get_var('values');
@@ -399,7 +466,7 @@
                        $sum_tax        = ($sum_result + $addition_percentage + 
$workorder['addition_rs'])*$tax/100;
                        $total_sum      = $sum_result + $addition_percentage + 
$workorder['addition_rs'] + $sum_tax;
 
-                       
$this->bo->update_calculation(array('workorder_id'=>$workorder_id,'calculation'=>($sum_result+$addition_percentage)));
+                       
$this->bo->update_calculation(array('workorder_id'=>$workorder_id,'calculation'=>($sum_result+$addition_percentage+
 $workorder['addition_rs'])));
 
                        $table_sum[] = array
                        (
@@ -455,7 +522,7 @@
                        $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
 
                        $values                 = phpgw::get_var('values');
-                       $workorder_id   = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id   = phpgw::get_var('workorder_id'); // in 
case of bigint
 
                        if($values['name'])
                        {
@@ -472,15 +539,75 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
+//------JSON code-------------------
+                       //join columns hours_descr and remark
+                       for($i=0;$i<count($common_data['content']);$i++ ) 
+                       {
+                               
+                               if($common_data['content'][$i]['remark']!="")
+                               {
+                                       
if(trim($common_data['content'][$i]["hours_descr"]) == "")
+                                       {
+                                               $conector = "";
+                                       }
+                                       else
+                                       {
+                                               $conector = "<br>";
+                                       }
+                                       $extra = 
$common_data['content'][$i]["hours_descr"].$conector.$common_data['content'][$i]["remark"];
+                               }
+                               else
+                               {
+                                       $extra = 
$common_data['content'][$i]["hours_descr"];
+                               }
+                               
$common_data['content'][$i]['extra_hours_descr'] = $extra;
+                       }       
+
+
+//---datatable1 settings---------------------------------------------------
+
+                       
+                       $datavalues[0] = array
+                       (
+                               'name'                  => "0",
+                               'values'                => 
json_encode($common_data['content']),
+                               'total_records' => 
count($common_data['content']),
+                               'is_paginator'  => 1,
+                               'footer'                => 0
+                       );              
+                       
+//_debug_array($common_data['table_header'][0]['lang_post']);die;
+                                               
+              $myColumnDefs[0] = array
+              (
+              'name'                   => "0",
+              'values'         =>      json_encode(array(      array('key' => 
'post',                          'label' => 
$common_data['table_header'][0]['lang_post'],        'sortable' => 
true,'resizeable' => true),
+                                                                               
        array('key' => 'code',                          'label' => 
$common_data['table_header'][0]['lang_code'],        'sortable' => 
true,'resizeable' => true),
+                                                                               
        array('key' => 'extra_hours_descr',     'label' => 
$common_data['table_header'][0]['lang_descr'],       'sortable' => 
true,'resizeable' => true),
+                                                                               
        array('key' => 'unit',                          'label' => 
$common_data['table_header'][0]['lang_unit'],        'sortable' => 
true,'resizeable' => true),
+                                                                               
        array('key' => 'quantity',                      'label' => 
$common_data['table_header'][0]['lang_quantity'],'sortable' => 
true,'resizeable' => true, 'formatter' => 'FormatterRight'),
+                                                                               
        array('key' => 'billperae',                     'label' => 
$common_data['table_header'][0]['lang_billperae'],'sortable' => 
true,'resizeable' => true, 'formatter' => 'FormatterRight'),
+                                                                               
        array('key' => 'cost',                          'label' => 
$common_data['table_header'][0]['lang_cost'],        'sortable' => 
true,'resizeable' => true, 'formatter' => 'FormatterRight'),
+                                                                               
        array('key' => 'result',                        'label' => 
$common_data['table_header'][0]['lang_result'],      'sortable' => 
true,'resizeable' => true, 'formatter' => 'FormatterRight'),
+                                                                               
        array('key' => 'wo_hour_category',      'label' => 
$common_data['table_header'][0]['lang_category'],'sortable' => 
true,'resizeable' => true),
+                                                                               
        array('key' => 'cat_per_cent',          'label' => 
$common_data['table_header'][0]['lang_per_cent'],'sortable' => 
true,'resizeable' => true, 'formatter' => 'FormatterCenter')
+             )));      
+//----------------------------------------------datatable settings--------     
                
+
                        $data = array
                        (
+                               'property_js'                   => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'base_java_url'                 => 
json_encode(array(menuaction => 
"property.uiwo_hour.index",workorder_id=>$workorder_id)),
+                               'datatable'                             => 
$datavalues,
+                               'myColumnDefs'                  => 
$myColumnDefs,
+                               
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'add_action'                            => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.save_template', 'workorder_id'=> $workorder_id)),
 
                                'lang_done_statustext'                  => 
lang('Back to the workorder list'),
                                'lang_add_statustext'                   => 
lang('Adds this workorders calculation as a template for later use'),
-                               'lang_search_statustext'                => 
lang('Adds a new workorder to an existing project'),
+                               'lang_search_statustext'=> lang('Adds a new 
workorder to an existing project'),
 
                                'lang_done'                             => 
lang('Done'),
                                'lang_add'                              => 
lang('Add'),
@@ -498,7 +625,26 @@
                                'values_hour'                           => 
$common_data['content'],
                                'workorder_data'                        => 
$common_data['workorder_data']
                        );
+                       //---datatable settings--------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
 
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'wo_hour.save_template', 'property' );
+                       //-----------------------datatable settings---  
+//_debug_array($data);die;
+
                        $appname        = lang('Workorder');
                        $function_msg   = lang('Add template');
 
@@ -507,6 +653,7 @@
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
+               
                function index()
                {
                        if(!$this->acl_read)
@@ -514,81 +661,469 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
-
                        $delete = phpgw::get_var('delete', 'bool');
                        $hour_id = phpgw::get_var('hour_id', 'int');
-                       $workorder_id = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id = phpgw::get_var('workorder_id'); // in 
case of bigint
 
                        if($delete && $hour_id)
                        {
                                $receipt = 
$this->bo->delete($hour_id,$workorder_id);
+                               return "hour_id ".$hour_id." ".lang("has been 
deleted");
                        }
 
                        $common_data=$this->common_data($workorder_id);
 
-                       $table_add[] = array
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uiwo_hour.index',
+                                                               'workorder_id'  
=> $workorder_id
+                                                       
+                                       ));
+
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiwo_hour.index',"
+                                                                               
                ."workorder_id:'{$workorder_id}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uiwo_hour.index',
+                                                                       
'workorder_id'  => $workorder_id
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                                               
                        array( // mensaje
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'msg_header',
+                                                                               
                                'value' => '',
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),      
+                                                               array( 
+                                                                   'id' => 
'btn_save_template',
+                                                                   'value'    
=> lang('Save as template'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 4
+                                                               ),      
+                                                               array( 
+                                                                   'id' => 
'btn_add_custom',
+                                                                   'name' => 
'custom',
+                                                                   'value'    
=> lang('Add custom'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                                               
                        array( 
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_add_template',
+                                                                               
                                'tab_index' => 2,
+                                                                               
                                'value' => lang('Add from template')
+                                                                               
                        ),                                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                        
+                                                                               
                        array( 
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_add_prizebook',
+                                                                               
                                'tab_index' => 1,
+                                                                               
                                'value' => lang('Add from prizebook')
+                                                                               
                        )                                                       
                                                                                
                                                                                
                                                                                
                                                                                
                                                
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                               
+                               $datatable['actions']['down-toolbar'] = 
array('fields'  => array('field' => array (
+                                         array(
+                                            'id' => 'btn_print_preview',
+                                            'value'    => lang('Print view'),
+                                            'type' => 'button',
+                                            'tab_index' => 5,
+                                            'style' => 'filter'
+                                        ),
+                                        array( // check label
+                                                       'type' => 'label',
+                                                       'id' => 
'lbl_check_details',
+                                                                               
        'value' => lang('Show details'),
+                                                                               
        'style' => 'filter'                                                     
                                        
+                                                                               
),
+                                                                               
array( 
+                                            'id'     => 'check_show_details',
+                                            'value'    => 0,
+                                            'type' => 'checkbox',
+                                            'tab_index' => 6,
+                                            'style' => 'filter'                
                                                    
+                                        ),
+                                        array( // check label
+                                                       'type' => 'label',
+                                                       'id' => 
'lbl_check_cost',
+                                                                               
        'value' => lang('Show calculated cost'),
+                                                                               
        'style' => 'filter'                                                     
                                                
+                                                                               
),
+                                                                               
array( 
+                                            'id'     => 
'check_calculated_cost',
+                                            'value'    => 0,
+                                            'type' => 'checkbox',
+                                            'tab_index' => 7,
+                                            'style' => 'filter'                
                                                    
+                                        ),
+                                        array(                                 
                       
+                                            'id'     => 'check_mark_draft',
+                                            'value'    => 0,
+                                            'type' => 'checkbox',
+                                            'tab_index' => 10                  
                                            
+                                        ),                                     
                                                                        
+                                               array( // check label
+                                                       'type' => 'label',
+                                                       'id' => 
'lbl_check_mark',
+                                                                               
        'value' => lang('Mark as DRAFT')                                        
                                                                        
+                                                                               
),                                                                              
+                                                                               
array( 
+                                            'id'     => 
'check_calculated_cost_tender',
+                                            'value'    => 0,
+                                            'type' => 'checkbox',
+                                            'tab_index' => 9                   
                                        
+                                        ),                                     
                                                                
+                                               array( // check label
+                                                       'type' => 'label',
+                                                       'id' => 
'lbl_check_cost_tender',
+                                                                               
        'value' => lang('Show calculated cost')                                 
                                                                
+                                                                               
),                                                                              
+                                         array( 
+                                            'id' => 'btn_view_tender',
+                                            'value'    => lang('View tender'),
+                                            'type' => 'button',
+                                            'tab_index' => 8
+                                        ))));                          
+                               
+                       }
+
+                       $uicols = array (
+                               'name'  =>      
array('hour_id','post','code','hours_descr','unit','billperae','quantity','cost','deviation','result','wo_hour_category','cat_per_cent'),
+                               'input_type'    =>      
array('hidden','text','text','text','text','text','text','text','text','text','text','text'),
+                               'descr' =>      
array('',lang('Post'),lang('Code'),lang('Descr'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),lang('Cost'),lang('deviation'),lang('result'),lang('Category'),lang('Per
 Cent')),
+                               'className'             =>      
array('','','','','','rightClasss','rightClasss','rightClasss','rightClasss','rightClasss','','rightClasss')
+                       );
+                                               
+                       $wo_hour_list = array();
+                       $wo_hour_list = $common_data['content'];
+
+                       $j=0;
+                       if (isset($wo_hour_list) && is_array($wo_hour_list))
+                       {
+                               foreach($wo_hour_list as $wo_hour)
+                               {                                               
                                        
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {                                       
                                                
+                                               if ($uicols['name'][$i] == 
'deviation') 
+                                               {
+                                                       if 
(is_numeric($wo_hour[$uicols['name'][$i]])) 
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$wo_hour[$uicols['name'][$i]];
+                                                       } else {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = '';
+                                                       }
+                                               } else {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$wo_hour[$uicols['name'][$i]];
+                                               }                               
                                                                        
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                       }
+
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();           
                                
+                       $parameters = array
                        (
-                               'lang_add_prizebook'                    => 
lang('Add from prizebook'),
-                               'lang_add_prizebook_statustext'         => 
lang('add items from this vendors prizebook'),
-                               'add_prizebook_action'                  => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.prizebook', 'workorder_id'=> $workorder_id)),
+                               'parameter' => array
+                               (
+                                       array
+                                       (
+                                               'name'          => 'hour_id',
+                                               'source'        => 'hour_id'
+                                       )
+                               )
+                       );
 
-                               'lang_add_template'                     => 
lang('Add from template'),
-                               'lang_add_template_statustext'          => 
lang('add items from a predefined template'),
-                               'add_template_action'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitemplate.index','lookup'=> true, 'workorder_id'=> $workorder_id)),
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'deviation',
+                                       'text'                  => 
lang('Deviation'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiwo_hour.deviation',
+                                                                               
'workorder_id'  => $workorder_id
+                                       
+                                                                       )),
+                                       'parameters'    => $parameters
+                       );
 
-                               'lang_add_custom'                       => 
lang('Add custom'),
-                               'lang_add_custom_statustext'            => 
lang('Add single custom line'),
-                               'add_custom_action'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.edit', 'from'=> 'index', 'workorder_id'=> $workorder_id)),
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'                       => 
'deviation',
+                                       'text'                          => 
lang('open deviation in new window'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
+                       (
+                                                               'menuaction'    
=> 'property.uiwo_hour.deviation',
+                                                               'workorder_id'  
=> $workorder_id,
+                                                               'target'        
        => '_blank'
+       
+                                                       )),
+                                       'parameters'    => $parameters
+                       );
 
-                               'lang_save_template'                    => 
lang('Save as template'),
-                               'lang_save_template_statustext'         => 
lang('Save this workorder as a template for later use'),
-                               'save_template_action'                  => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.save_template', 'from'=> 'index', 'workorder_id'=> 
$workorder_id)),
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'edit',
+                                       'text'                  => lang('Edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiwo_hour.edit',
+                                                                               
'workorder_id'  => $workorder_id,
+                                                                               
'from'                  => 'index'
+                                                                       )),
+                                       'parameters'    => $parameters
+                       );
 
-                               'lang_print_view'                       => 
lang('Print view'),
-                               'lang_print_view_statustext'            => 
lang('View the complete workorder'),
-                               'print_view_action'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.view', 'from'=> 'index', 'workorder_id'=> $workorder_id)),
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'                       => 
'edit',
+                                       'text'                          => 
lang('open edit in new window'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                       (
+                                                               'menuaction'    
=> 'property.uiwo_hour.edit',
+                                                               'workorder_id'  
=> $workorder_id,
+                                                               'from'          
        => 'index',                                                             
+                                                               'target'        
        => '_blank'
 
-                               'lang_view_tender'                      => 
lang('View tender'),
-                               'lang_view_tender_statustext'           => 
lang('View the complete workorder as a tender for bidding'),
-                               'view_tender_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.tender', 'from'=>'index', 'workorder_id'=> $workorder_id)),
+                                                       )),
+                                       'parameters'    => $parameters
+                       );
 
-                               'lang_show_cost'                        => 
lang('Show calculated cost'),
-                               'lang_show_cost_statustext'             => 
lang('Show calculated cost on the printview'),
+                       $datatable['rowactions']['action'][] = array(
+                                       'my_name'               => 'delete',
+                                       'text'                  => 
lang('Delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this entry'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiwo_hour.index',
+                                                                               
'workorder_id'  => $workorder_id,
+                                                                               
'delete'        => true
+                                                                       )),
+                                       'parameters'    => $parameters
+                       );
 
-                               'lang_show_details'                     => 
lang('Show details'),
-                               'lang_show_details_statustext'          => 
lang('Show details'),
+                       unset($parameters);
 
-                               'lang_mark_draft'                       => 
lang('Mark as DRAFT'),
-                               'lang_mark_draft_statustext'            => 
lang('Mark the tender as DRAFT')
+                       $datatable['rowactions']['action_form'][] = array(
+                                       'my_name'               => 
'add_prizebook',
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiwo_hour.prizebook',
+                                                                               
'workorder_id'  => $workorder_id
+                                                                       ))
+                       );
 
+                       $datatable['rowactions']['action_form'][] = array(
+                                       'my_name'               => 
'add_template',
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uitemplate.index',
+                                                                               
'lookup'=> true,
+                                                                               
'workorder_id'  => $workorder_id
+                                                                       ))
+                       );      
+
+                       $datatable['rowactions']['action_form'][] = array(
+                                       'my_name'               => 'add_custom',
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiwo_hour.edit',
+                                                                               
'from'=> 'index',
+                                                                               
'workorder_id'  => $workorder_id
+                                                                       ))
                        );
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       $datatable['rowactions']['action_form'][] = array(
+                                       'my_name'               => 
'save_template',
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiwo_hour.save_template',
+                                                                               
'from'=> 'index',
+                                                                               
'workorder_id'  => $workorder_id
+                                                                       ))
+                       );
 
-                       $data = array
+                       $datatable['rowactions']['action_form'][] = array(
+                                       'my_name'               => 'print_view',
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                       (
+                                                                               
'menuaction'    => 'property.uiwo_hour.view',
+                                                                               
'from'=> 'index',
+                                                                               
'workorder_id'  => $workorder_id
+                                                                       ))
+                       );
+
+                       $datatable['rowactions']['action_form'][] = array(
+                                       'my_name'               => 
'view_tender',
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'link_delete'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.index', 'delete'=>true, 'workorder_id'=> $workorder_id)),
-                               'function'                              => 
'index',
-                               'num_records'                           => 
count($hours_list),
-                               'total_hours_records'                   => 
$common_data['total_hours_records'],
-                               'lang_total_records'                    => 
lang('Total records'),
-                               'table_header_hour'                     => 
$common_data['table_header'],
-                               'values_hour'                           => 
$common_data['content'],
-                               'workorder_data'                        => 
$common_data['workorder_data'],
-                               'table_add'                             => 
$table_add,
-                               'table_sum'                             => 
$common_data['table_sum']
+                                                                               
'menuaction'    => 'property.uiwo_hour.tender',
+                                                                               
'from'=> 'index',
+                                                                               
'workorder_id'  => $workorder_id
+                                                                       ))
                        );
 
-//_debug_array($common_data['content']);
+                       $uicols_count   = count($uicols['descr']);
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
 
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['className']                = 
$uicols['className'][$i];
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
+
+                       $datatable['exchange_values'] = '';
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($wo_hour_list);
+                       $datatable['pagination']['records_total']       = 
$this->bopricebook->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']                  
= 'hour_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
                        $appname        = lang('Workorder');
                        $function_msg   = lang('list hours');
 
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation'); 
+                       
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'table_sum'                     => 
$common_data['table_sum'][0],
+                                       'workorder_data'        => 
$common_data['workorder_data'],
+                                       'total_hours_records'   => 
$common_data['total_hours_records'],
+                                       'lang_total_records'    => lang('Total 
records')
+                       );
+
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+
+                               
if(isset($datatable['rowactions']['action_form']) && 
is_array($datatable['rowactions']['action_form']))
+                               {
+                                       $json ['rights_form'] = 
$datatable['rowactions']['action_form'];
+                               }
+                                                               
+                               // message when editting & deleting records
+                               if(isset($receipt) && is_array($receipt))
+                               {
+                                       $json ['message'][] = $receipt;
+                               }
+                               
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_hour' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'wo_hour.index', 'property' );
+                       
                        $this->save_sessiondata();
                }
 
@@ -603,19 +1138,22 @@
 
                        $show_cost              = phpgw::get_var('show_cost', 
'bool');
                        $show_details   = phpgw::get_var('show_details', 
'bool');
-                       $workorder_id   = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id   = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $to_email               = phpgw::get_var('to_email', 
'email');
                        $update_email   = phpgw::get_var('update_email', 
'bool');
                        $send_order             = phpgw::get_var('send_order', 
'bool');
                        $no_email               = phpgw::get_var('no_email', 
'bool');
                        $values                 = phpgw::get_var('values');
                        $print                  = phpgw::get_var('print', 
'bool');
+                       $sent_ok                = phpgw::get_var('print', 
'bool');
 
                        if($update_email)
                        {
                                
$this->bo->update_email($to_email,$workorder_id);
                        }
+
                        $workorder = 
$this->boworkorder->read_single($workorder_id);
+                       $workorder_history = 
$this->boworkorder->read_record_history($workorder_id);
 
                        $table_header_history[] = array
                        (
@@ -719,12 +1257,52 @@
                                }
                        }
                        
+                       $action_params = array
+                       (
+                               'appname'                       => 'property',
+                               'location'                      => 
'.project.workorder',
+                               'id'                            => 
$workorder_id,
+                               'responsible'           => 
$workorder['vendor_id'],
+                               'responsible_type'  => 'vendor',
+                               'action'                        => 'remind',
+                               'deadline'                      => '',
+                               'created_by'            => '',
+                       );
+
+
+                       $lang_reminder = '';
+/*
+                       $pending_action = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+                       $lang_reminder = '';
+                       if( $pending_action )
+                       {
+                               $reminder = (int)$pending_action[0]['reminder'] 
+1;
+                               $lang_reminder = lang('reminder') . " # 
{$reminder}";
+                       }
+                       else if ($this->boworkorder->order_sent_adress)
+                       {
+                               $lang_reminder = lang('reminder') . " # 1";     
                
+                       }
+*/                     
+                       if ($this->boworkorder->order_sent_adress || $sent_ok)
+                       {
+                               $lang_reminder = lang('reminder');              
        
+                       }
+
+                       $contact_data = 
$this->bocommon->initiate_ui_contact_lookup(array(
+                                               'contact_id'            => 
$project['contact_id'],
+                                               'field'                         
=> 'contact',
+                                               'type'                          
=> 'view'));
+
+
                        $email_data = array
                        (
                                'org_name'                                      
        => isset($this->config->config_data['org_name']) ? 
"{$this->config->config_data['org_name']}::" : '',
                                'location_data'                                 
=> $location_data,
                                'lang_workorder'                                
=> lang('Workorder ID'),
                                'workorder_id'                                  
=> $workorder_id,
+                               'lang_reminder'                                 
=> $lang_reminder,
 
                                'lang_date'                                     
=> lang('Date'),
                                'date'                                          
=> $date,
@@ -783,10 +1361,11 @@
 
                                'table_header_view_order'                       
=> $table_header,
                                'values_view_order'                             
=> $values_hour,
-                               'sms_data'                                      
=> $sms_data
+                               'sms_data'                                      
=> $sms_data,
+                               'use_yui_table'                         => true,
+                               'contact_data'                          => 
$contact_data
                        );
 
-
                        if($send_order && !$to_email)
                        {
                                        
$receipt['error'][]=array('msg'=>lang('No mailaddress is selected'));
@@ -794,11 +1373,15 @@
 
                        if($to_email || $print)
                        {
+                               $email_data['use_yui_table'] = false;
+                               
                                
$this->create_html->add_file(array(PHPGW_SERVER_ROOT . 
'/property/templates/base/wo_hour'));
                                
$this->create_html->add_file(array(PHPGW_SERVER_ROOT . 
'/property/templates/base/location_view'));
 
                                
$this->create_html->set_var('phpgw',array('email_data' => $email_data));
 
+                               $email_data['use_yui_table'] = true;
+
                                $this->create_html->xsl_parse();
                                $this->create_html->xml_parse();
 
@@ -812,10 +1395,23 @@
                                $proc = new XSLTProcessor;
                                $proc->importStyleSheet($xsl); // attach the 
xsl rules
 
+                                       $header =  <<<HTML
+<html>
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; 
charset=utf-8">
+               <body>
+HTML;
+
+                                       $footer =  <<<HTML
+       </body>
+</html>
+HTML;
+
                                $html =  $proc->transformToXML($xml);
 
                                if($print)
                                {
+                                       echo $header;
                                        echo <<<HTML
                                                <script 
language="Javascript1.2">
                                                <!--
@@ -824,7 +1420,9 @@
                                                //-->
                                                </script>
 HTML;
+
                                        echo $html;
+                                       echo $footer;
                                        exit;
                                }
 
@@ -835,7 +1433,7 @@
                                        $headers .= "Bcc: " . $from_name . "<" 
. $from_email .">\r\n";
                                        $bcc = $from_email;
                                }
-                               $headers .= "Content-type: text/html; 
charset=iso-8859-1\r\n";
+                               $headers .= "Content-type: text/html; 
charset=utf-8\r\n";
                                $headers .= "MIME-Version: 1.0\r\n";
                                $subject = lang('Workorder').": ".$workorder_id;
 
@@ -845,7 +1443,7 @@
                                        if(isset($values['file_action']) && 
is_array($values['file_action']))
                                        {
                                                $bofiles        = 
CreateObject('property.bofiles');
-                                               $attachments = 
$bofiles->get_attachments("/workorder/{$workorder_id}/", $values);
+                                               $attachments = 
$bofiles->get_attachments("/workorder/{$workorder_id}/", 
$values['file_action']);
                                                $attachment_log = 
lang('attachments') . ': ' . implode(', ',$values['file_action']);
                                        }
 
@@ -853,7 +1451,7 @@
                                        {
                                                $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
                                        }
-                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $to_email, $subject, $html, '', $cc, 
$bcc, $from_email, $from_name, 'html', '', $attachments);
+                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $to_email, $subject, $header . $html . 
$footer, '', $cc, $bcc, $from_email, $from_name, 'html', '', $attachments);
                                }
                                else
                                {
@@ -869,6 +1467,23 @@
                                        {
                                                
$receipt['message'][]=array('msg' => $attachment_log);
                                        }
+
+                                       if( 
$this->boworkorder->order_sent_adress )
+                                       {
+                                               $action_params = array
+                                               (
+                                                       'appname'               
        => 'property',
+                                                       'location'              
        => '.project.workorder',
+                                                       'id'                    
        => $workorder_id,
+                                                       'responsible'           
=> $workorder['vendor_id'],
+                                                       'responsible_type'  => 
'vendor',
+                                                       'action'                
        => 'remind',
+                                                       'remark'                
        => '',
+                                                       'deadline'              
        => ''
+                                               );
+                               
+                                                $reminds = 
execMethod('property.sopending_action.set_pending_action', $action_params);
+                                       }
                                }
                                else
                                {
@@ -878,25 +1493,96 @@
                                }
                        }
 
-                       $workorder_history = 
$this->boworkorder->read_record_history($workorder_id);
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
+                       if( $this->boworkorder->order_sent_adress )
+                       {
+                               $to_email= 
$this->boworkorder->order_sent_adress;
+                       }
+                       else
+                       {
                        $email_list     = 
$this->bo->get_email($to_email,$workorder['vendor_id']);
                        if(count($email_list)==1)
                        {
                                $to_email= $email_list[0]['email'];
                                unset($email_list);
                        }
+                       }
 
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+
                        $link_file_data = array
                        (
                                'menuaction'    => 
'property.uiworkorder.view_file',
                                'id'                    => $workorder_id
                        );
 
+                       //---datatable 
settings---------------------------------------------------                     
 
+
+                       $table_view_order = array();
+                       if(count($email_data['values_view_order']))
+                       {
+                               
+                               for($i = 
0;$i<count($email_data['values_view_order']);$i++)
+                               {
+                                       $table_view_order[$i]['post']           
= $email_data['values_view_order'][$i]['post'];
+                                       $table_view_order[$i]['code']           
= $email_data['values_view_order'][$i]['code'];
+                                       $table_view_order[$i]['descr']          
= 
$email_data['values_view_order'][$i]['hours_descr']."<br>".$email_data['values_view_order']['remark'];
+                                       $table_view_order[$i]['unit']           
= $email_data['values_view_order'][$i]['unit'];
+                                       $table_view_order[$i]['quantity']       
= $email_data['values_view_order'][$i]['quantity'];
+                                       $table_view_order[$i]['billperae']      
= $email_data['values_view_order'][$i]['billperae'];
+                                       $table_view_order[$i]['cost']           
= $email_data['values_view_order'][$i]['cost'];
+                               }
+                       }
+       
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($table_view_order),
+                                       'total_records'                 => 
count($table_view_order),
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );      
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array('key' => 'post',          'label' => lang('Post'),                
'sortable' => true,'resizeable' => true),
+                                                                               
                array('key' => 'code',          'label' => lang('Code'),        
        'sortable' => true,'resizeable' => true),
+                                                                               
                array('key' => 'descr',         'label' => lang('descr'),       
        'sortable' => true,'resizeable' => true),
+                                                                               
        array('key' => 'unit',          'label' => lang('Unit'),                
'sortable' => true,'resizeable' => true),
+                                                                               
        array('key' => 'quantity',      'label' => lang('Quantity'),    
'sortable' => true,'resizeable' => true),
+                                                                               
        array('key' => 'billperae',     'label' => lang('Bill per 
unit'),'sortable' => true,'resizeable' => true),
+                                                                               
        array('key' => 'cost',          'label' => lang('cost'),                
'sortable' => true,'resizeable' => true)))
+                       );      
+                       
+                       $workorder_history = 
$this->boworkorder->read_record_history($workorder_id); // second time...(after 
the order is sendt)
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($workorder_history),
+                                       'total_records'                 => 
count($workorder_history),
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );      
+
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      json_encode(array(      
array('key' => 'value_date',    'label' => lang('Date'),        'sortable' => 
true,'resizeable' => true),
+                                                                               
                array('key' => 'value_user',    'label' => lang('User'),        
'sortable' => true,'resizeable' => true),
+                                                                               
                array('key' => 'value_action',  'label' => lang('Action'),      
'sortable' => true,'resizeable' => true),
+                                                                               
        array('key' => 'value_new_value','label' => lang('New 
value'),'sortable' => true,'resizeable' => true)))
+                       );      
+                       
+                       
+                       
//----------------------------------------------datatable settings--------      
                        $data = array
                        (
+                               'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
        => $datavalues,
+                               'myColumnDefs'                                  
=> $myColumnDefs,
+                       
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'lang_mail'                                     
=> lang('E-Mail'),
                                'lang_update_email'                             
=> lang('Update email'),
@@ -905,7 +1591,12 @@
                                'to_email'                                      
=> $to_email,
                                'email_list'                                    
=> $email_list,
                                'lang_select_email'                             
=> lang('Select email'),
-                               'send_order_action'                             
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.view', 'send'=>true, 'workorder_id'=> $workorder_id, 
'show_details'=> $show_details)),
+                               'send_order_action'                             
=> $GLOBALS['phpgw']->link('/index.php',array(
+                                                                               
                                                'menuaction'    => 
'property.uiwo_hour.view',
+                                                                               
                                                'send'                  => true,
+                                                                               
                                                'workorder_id'  => 
$workorder_id,
+                                                                               
                                                'show_details'  => 
$show_details,
+                                                                               
                                                'sent_ok'               => 
$rcpt)),
 
                                'lang_no_history'                               
=> lang('No history'),
                                'lang_history'                                  
=> lang('History'),
@@ -933,20 +1624,36 @@
                                                                                
                        'show_cost'             => $show_cost,
                                                                                
                        'show_details'  => $show_details,
                                                                                
                        'print'                 => true
-                                                                               
                 )) . "','700','600')"
+                                                                               
                 )) . "','1000','1200')"
                        );
 
-//_debug_array($data);
 
+                       //---datatable settings-----------------------------
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'wo_hour.view', 'property' );
+                       //------------------------------datatable settings--
+
                        $appname                = lang('Workorder');
-                       $function_msg           = lang('Send order');
-
+                       $function_msg   = $this->boworkorder->order_sent_adress 
? lang('ReSend order') :lang('Send order');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       //$GLOBALS['phpgw']->xslttpl->pp();
+                       //$this->save_sessiondata();
 
-                       $this->save_sessiondata();
                }
 
 
@@ -963,7 +1670,7 @@
                        }
                        $show_cost = phpgw::get_var('show_cost', 'bool');
                        $mark_draft = phpgw::get_var('mark_draft', 'bool');
-                       $workorder_id = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id = phpgw::get_var('workorder_id'); // in 
case of bigint
 
                        $common_data            = 
$this->common_data($workorder_id);
                        $values_hour            = $common_data['content'];
@@ -1025,7 +1732,7 @@
                        //error_reporting(E_ALL);
                        set_time_limit(1800);
                        $pdf -> ezSetMargins(50,70,50,50);
-                       $pdf->selectFont(PHPGW_APP_INC . 
'/pdf/fonts/Helvetica.afm');
+                       $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica.afm');
 
                        // put a line top and bottom on all the pages
                        $all = $pdf->openObject();
@@ -1085,20 +1792,20 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
-
                        $delete = phpgw::get_var('delete', 'bool');
                        $hour_id = phpgw::get_var('hour_id', 'int');
 
-                       $workorder_id = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $values = phpgw::get_var('values');
-//_debug_array($values);
 
+
                        if($delete && $hour_id)
                        {
                                $receipt = 
$this->bo->delete($hour_id,$workorder_id);
+                               if( phpgw::get_var('phpgw_return_as') == 'json' 
)
+                               {
+                                       return "hour ".$hour_id." ".lang("has 
been deleted");
+                               }
                        }
 
 
@@ -1111,6 +1818,91 @@
 
                        $workorder      = $common_data['workorder'];
 
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uiwo_hour.prizebook',
+                                                               'workorder_id'  
=> $workorder_id,
+                                                               'query'         
                => $this->query
+                                       ));
+
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiwo_hour.prizebook',"
+                                                                               
                ."workorder_id:'{$workorder_id}',"
+                                                                               
."query:'{$this->query}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uiwo_hour.prizebook',
+                                                                       
'workorder_id'  => $workorder_id,
+                                                                       'query' 
                        => $this->query
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                                               
                        array( // mensaje
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'msg_header',
+                                                                               
                                'value' => '',
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),                                                      
                                        
+                                                                               
                        array( // boton done
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_done',
+                                                                               
                                'tab_index' => 4,
+                                                                               
                                'value' => lang('done')
+                                                                               
                        ),                                                      
                                        
+                                                                               
                        array( // boton SAVE
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_save',
+                                                                               
                                'tab_index' => 3,
+                                                                               
                                'value' => lang('save')
+                                                                               
                        ),                                                      
        
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                         array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               ),
+                                                                               
                        array(
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'lbl_template',
+                                                                               
                                'value' => ''
+                                                                               
                                
+                                                                               
                        )                                                       
                
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+                               
+                       $uicols = array (
+                               'input_type'    =>      
array('hidden','text','hidden','hidden','text','text','text','text','text','text','hidden','varchar','select','varchar'),
+                               'type'                  =>      
array('','','','','','','','','','','','text','',''),                           
+                               'name'                  =>      
array('activity_id','num','branch','vendor_id','descr','base_descr','unit','w_cost','m_cost','total_cost','this_index','quantity','wo_hour_cat','cat_per_cent'),
+                               'formatter'             =>      
array('','','','','','','','','','','','','',''),
+                               'descr'                 =>      
array('',lang('Activity 
Num'),lang('Branch'),lang('Vendor'),lang('Description'),lang('Base'),lang('Unit'),lang('Labour
 cost'),lang('Material cost'),lang('Total 
Cost'),'',lang('Quantity'),lang('category'),lang('Per Cent')),
+                               'className'             =>      
array('','','','','','','','rightClasss','rightClasss','rightClasss','','','','')
+                       );
+               
+                       
                        if($workorder['vendor_id'])
                        {
                                $this->bopricebook->cat_id = 
$workorder['vendor_id'];
@@ -1119,161 +1911,327 @@
                                $pricebook_list = $this->bopricebook->read();
                        }
 
-//_debug_array($pricebook_list);
-                       $i=0;
-                       while (is_array($pricebook_list) && list(,$pricebook) = 
each($pricebook_list))
+                       $values_combo_box       = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
+                       $default_value = array ('id'=>'','name'=>lang('no 
category'));
+                       array_unshift ($values_combo_box,$default_value);       
                
+
+                       $content = array();
+                       $j=0;
+                       if (isset($pricebook_list) && is_array($pricebook_list))
                        {
-                               $content_prizebook[] = array
-                               (
-                                       'counter'                       => $i,
-                                       'activity_id'                   => 
$pricebook['activity_id'],
-                                       'num'                           => 
$pricebook['num'],
-                                       'branch'                        => 
$pricebook['branch'],
-                                       'vendor_id'                     => 
$pricebook['vendor_id'],
-                                       'm_cost'                        => 
$pricebook['m_cost'],
-                                       'w_cost'                        => 
$pricebook['w_cost'],
-                                       'total_cost'                    => 
$pricebook['total_cost'],
-                                       'this_index'                    => 
$pricebook['this_index'],
-                                       'unit'                          => 
$pricebook['unit'],
-                                       'descr'                         => 
$pricebook['descr'],
-                                       'base_descr'                    => 
$pricebook['base_descr']
-                               );
+                               foreach($pricebook_list as $pricebook)
+                               {
+                                       $hidden = '';
+                                       $hidden .= " <input 
name='values[activity_id][".$j."]' id='values[activity_id][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$pricebook['activity_id']."'/>";
+                                       $hidden .= " <input 
name='values[activity_num][".$j."]' id='values[activity_num][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$pricebook['num']."'/>";
+                                       $hidden .= " <input 
name='values[unit][".$j."]' id='values[unit][".$j."]'  class='myValuesForPHP'  
type='hidden' value='".$pricebook['unit']."'/>";
+                                       $hidden .= " <input 
name='values[dim_d][".$j."]' id='values[dim_d][".$j."]'  class='myValuesForPHP' 
 type='hidden' value='".$pricebook['dim_d']."'/>";
+                                       $hidden .= " <input 
name='values[ns3420_id][".$j."]' id='values[ns3420_id][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$pricebook['ns3420_id']."'/>";
+                                       $hidden .= " <input 
name='values[descr][".$j."]' id='values[descr][".$j."]'  class='myValuesForPHP' 
 type='hidden' value='".$pricebook['descr']."'/>";
+                                       $hidden .= " <input 
name='values[total_cost][".$j."]' id='values[total_cost][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$pricebook['total_cost']."'/>";
 
-                               $i++;
+                                       if ($j==0) 
+                                       {
+                                               $hidden .= " <input 
name='values[add]' id='values[add]'  class='myValuesForPHP'  type='hidden' 
value='add'/>";
+                                       }
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
+                                       {                               
+                                               if ($i==0) {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$pricebook[$uicols['name'][$i]].$hidden;
+                                               } else {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$pricebook[$uicols['name'][$i]];
                        }
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
 
-                       $table_header_prizebook[] = array
+                                               
if($uicols['input_type'][$i]=='varchar') 
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input 
name='values[".$uicols['name'][$i]."][".$j."]' 
id='values[".$uicols['name'][$i]."][".$j."]' size='4' class='myValuesForPHP'/>";
+                                               }
+                                               $select = '';
+                                               
if($uicols['input_type'][$i]=='select') 
+                                               {
+                                                       $select  .= "<select 
name='values[".$uicols['name'][$i]."_list][".$j."]' 
id='values[".$uicols['name'][$i]."_list][".$j."]' class='select_tmp'>";
+                                                       for($k = 0; $k < 
count($values_combo_box); $k++)
+                                                       {
+                                                               $select  .= 
"<option 
value='".$values_combo_box[$k]['id']."'>".$values_combo_box[$k]['name']."</option>";
+                                                       }
+                                                       $select  .= 
"</select>";        
+                                                       $select  .= " <input 
name='values[".$uicols['name'][$i]."][".$j."]' 
id='values[".$uicols['name'][$i]."][".$j."]'  class='myValuesForPHP select'  
type='hidden' value=''/>";                                             
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = $select;
+                                               }                               
                                                                
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $uicols_count   = count($uicols['descr']);
+                       $datatable['rowactions']['action'] = array();
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['className']                = 
$uicols['className'][$i];
+                                       
+                                       if ($uicols['name'][$i] == 'num' || 
$uicols['name'][$i] == 'total_cost')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                                       }
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
+                       
+               //*************************************************/
+
+                       $uicols_details = array (
+                               'name'  =>      
array('hour_id','post','code','hours_descr','unit','billperae','quantity','cost','deviation','result','wo_hour_category','cat_per_cent'),
+                               'input_type'    =>      
array('hidden','text','text','text','text','text','text','text','text','text','text','text'),
+                               'descr' =>      
array('',lang('Post'),lang('Code'),lang('Descr'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),lang('Cost'),lang('deviation'),lang('result'),lang('Category'),lang('Per
 Cent')),
+                               'className'             =>      
array('','','','','','rightClasss','rightClasss','rightClasss','rightClasss','rightClasss','','rightClasss')
+                       );
+                               
+                       $j=0;
+                       if (isset($common_data['content']) && 
is_array($common_data['content']))
+                       {
+                               foreach($common_data['content'] as $content)
+                               {
+                                       for ($i=0; 
$i<count($uicols_details['name']); $i++)
+                                       {
+                                               if ($uicols_details['name'][$i] 
== 'deviation') 
+                                               {
+                                                       if 
(is_numeric($content[$uicols_details['name'][$i]])) {
+                                                               
$details['rows'][$j][$uicols_details['name'][$i]]       = 
$content[$uicols_details['name'][$i]];
+                                                       } else {
+                                                               
$details['rows'][$j][$uicols_details['name'][$i]]       = '';
+                                                       }
+                                               } else {
+                                                       
$details['rows'][$j][$uicols_details['name'][$i]]       = 
$content[$uicols_details['name'][$i]];
+                                               }
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $details['rowactions'] = array();
+
+                       $parameters = array
                        (
-                               'sort_num'      => 
$this->nextmatchs->show_sort_order(array
+                               'parameter' => array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'num',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uiwo_hour.prizebook',
-                                                                               
                                                        'workorder_id'  
=>$workorder_id,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'lang_num'              => lang('Activity Num'),
-                               'lang_branch'           => lang('Branch'),
-                               'lang_vendor'           => lang('Vendor'),
-                               'lang_select'           => lang('Select'),
-                               'lang_total_cost'       => lang('Total Cost'),
-                               'lang_descr'            => lang('Description'),
-                               'lang_base_descr'       => lang('Base'),
-                               'lang_m_cost'           => lang('Material 
cost'),
-                               'lang_w_cost'           => lang('Labour cost'),
-                               'lang_unit'             => lang('Unit'),
-                               'lang_quantity'         => lang('Quantity'),
+                                       array
+                                       (
+                                               'name'          => 'hour_id',
+                                               'source'        => 'hour_id'
+                                       )
+                               )
+                       );
 
-                               'lang_view'             => lang('view'),
-                               'lang_edit'             => lang('edit'),
-                               'sort_total_cost'       => 
$this->nextmatchs->show_sort_order(array
+                       $details['rowactions'][] = array(
+                               'my_name'                       => 'deviation',
+                               'text'                  => lang('Deviation'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'total_cost',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
'property.uiwo_hour.prizebook',
-                                                                               
                                                        'workorder_id'  
=>$workorder_id,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                                                       
'menuaction'    => 'property.uiwo_hour.deviation',
+                                                                       
'workorder_id'  => $workorder_id
+                               
                                                                                
)),
-                               'lang_category'                         => 
lang('category'),
-                               'lang_per_cent'                         => 
lang('Per Cent'),
+                               'parameters'    => $parameters
                        );
 
-
-                       $table_done[] = array
+                       $details['rowactions'][] = array(
+                                       'my_name'                       => 
'deviation',
+                                       'text'                          => 
lang('open deviation in new window'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_done'                             => 
lang('Done'),
-                               'lang_done_statustext'  => lang('Back to list'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.index', 'workorder_id'=> $workorder_id))
+                                                               'menuaction'    
=> 'property.uiwo_hour.deviation',
+                                                               'workorder_id'  
=> $workorder_id,
+                                                               'target'        
        => '_blank'
+       
+                                                       )),
+                                       'parameters'    => $parameters
                        );
 
-                       $link_data = array
+                       $details['rowactions'][] = array(
+                                       'my_name'                       => 
'edit',
+                                       'text'                  => lang('Edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 
'property.uiwo_hour.prizebook',
-                                               'sort'          =>$this->sort,
-                                               'order'         =>$this->order,
-                                               'workorder_id'  =>$workorder_id,
-                                               'allrows'       
=>$this->allrows,
-                                               'query'         =>$this->query
+                                                                               
'menuaction'    => 'property.uiwo_hour.edit',
+                                                                               
'workorder_id'  => $workorder_id,
+                                                                               
'from'                  => 'prizebook'
+                                                                       )),
+                                       'parameters'    => $parameters
                        );
 
-                       $link_data_nextmatch = array
+                       $details['rowactions'][] = array(
+                                       'my_name'                       => 
'edit',
+                                       'text'                          => 
lang('open edit in new window'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 
'property.uiwo_hour.prizebook',
-                                               'sort'          =>$this->sort,
-                                               'order'         =>$this->order,
-                                               'workorder_id'  =>$workorder_id,
-                                               'query'         =>$this->query
+                                                               'menuaction'    
=> 'property.uiwo_hour.edit',
+                                                               'workorder_id'  
=> $workorder_id,
+                                                               'from'          
        => 'prizebook',                                                         
+                                                               'target'        
        => '_blank'
+       
+                                                       )),
+                                       'parameters'    => $parameters
                        );
 
-                       $link_data_delete = array
+                       $details['rowactions'][] = array(
+                               'my_name'                       => 'delete',
+                               'text'                  => lang('Delete'),
+                               'confirm_msg'   => lang('do you really want to 
delete this entry'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
                                'menuaction'    => 
'property.uiwo_hour.prizebook',
-                                               'sort'          =>$this->sort,
-                                               'order'         =>$this->order,
-                                               'workorder_id'  =>$workorder_id,
-                                               'allrows'       
=>$this->allrows,
-                                               'delete'        =>true,
-                                               'query'         =>$this->query
+                                                                       
'workorder_id'  => $workorder_id,
+                                                                       
'delete'        => true
+                                                               )),
+                               'parameters'    => $parameters
                        );
 
+                       unset($parameters);
+                       
+                       
+               //************************************************/
 
-                       if(!$this->allrows)
+                       $datatable['exchange_values'] = '';
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($pricebook_list);
+                       $datatable['pagination']['records_total']       = 
$this->bopricebook->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= 'num'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = 
$this->bopricebook->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
+                       $appname        = lang('pricebook');
+                       $function_msg   = lang('list pricebook');
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation'); 
+                       
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       $data = array
-                       (
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_add_statustext'                   => 
lang('Add the selected items'),
-                               'lang_add'                              => 
lang('Add'),
-                               'link_delete'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data_delete),
-                               'function'                              => 
'prizebook',
-                               'allrows'                               => 
$this->allrows,
-                               'allow_allrows'                         => true,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($pricebook_list),
-                               'all_records'                           => 
$this->bopricebook->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                 => 
$this->query,
-                               'lang_search'                           => 
lang('search'),
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'details'                       => 
$details,
+                                       'uicols_details'        => 
$uicols_details,
+                                       'table_sum'                     => 
$common_data['table_sum'][0],
                                'workorder_data'                        => 
$common_data['workorder_data'],
-                               'table_header_prizebook'                => 
$table_header_prizebook,
-                               'values_prizebook'                      => 
$content_prizebook,
                                'total_hours_records'                   => 
$common_data['total_hours_records'],
-                               'lang_total_records'                    => 
lang('Total records'),
-                               'table_header_hour'                     => 
$common_data['table_header'],
-                               'values_hour'                           => 
$common_data['content'],
-                               'table_sum'                             => 
$common_data['table_sum'],
-                               'table_done'                            => 
$table_done,
-                               'lang_no_wo_hour_cat'                   => 
lang('no category'),
-                               'wo_hour_cat_list'                      => 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id')),
-
+                                       'lang_total_records'    => lang('Total 
records')
                        );
-//_debug_array($data);
 
-                       $appname        = lang('pricebook');
-                       $function_msg   = lang('list pricebook');
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
+                               
+                               // message when editting & deleting records
+                               if(isset($receipt) && is_array($receipt))
+                               {
+                                       $json ['message'][] = $receipt;
+                               }
+                               
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
+
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('prizebook' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'wo_hour.prizebook', 'property' );
+                                                                               
                                                                                
                                                                                
                                                
                        $this->save_sessiondata();
                }
 
@@ -1285,25 +2243,24 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
-                                                                       
'nextmatchs',
-                                                                       
'search_field'));
-
                        $delete = phpgw::get_var('delete', 'bool');
                        $hour_id = phpgw::get_var('hour_id', 'int');
 
-                       $workorder_id = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $template_id = phpgw::get_var('template_id', 'int');
 
                        $values = phpgw::get_var('values');
-//_debug_array($values);
 
                        if($delete && $hour_id)
                        {
                                $receipt = 
$this->bo->delete($hour_id,$workorder_id);
+
+                               if( phpgw::get_var('phpgw_return_as') == 'json' 
)
+                               {
+                                       return "hour ".$hour_id." ".lang("has 
been deleted");
+                               }                               
                        }
 
-
                        if($values['add'])
                        {
                                
$receipt=$this->bo->add_hour_from_template($values,$workorder_id);
@@ -1314,15 +2271,110 @@
                        $workorder      = $common_data['workorder'];
 
                        $botemplate             = 
CreateObject('property.botemplate');
+
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+                        {
+
+                       $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uiwo_hour.template',
+                                                               'workorder_id'  
        => $workorder_id,
+                                                               'template_id'   
        => $template_id,
+                                                               'query'         
                => $this->query
+                                       ));
+                       
+                       $datatable['config']['allow_allrows'] = true;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiwo_hour.template',"
+                                                                               
                ."workorder_id:'{$workorder_id}',"
+                                                                               
                ."template_id:'{$template_id}',"
+                                                                               
."query:'{$this->query}'";
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uiwo_hour.template',
+                                                                       
'workorder_id'  => $workorder_id,
+                                                                       
'template_id'   => $template_id,
+                                                                       'query' 
                => $this->query
+                                                                       )
+                                               ),
+                                               'fields'        => array(
+                                    'field' => array(
+                                                                               
                        array( // mensaje
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'msg_header',
+                                                                               
                                'value' => '',
+                                                                               
                                'style' => 'filter'
+                                                                               
                        ),                                                      
                                        
+                                                                               
                        array( // boton done
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_done',
+                                                                               
                                'tab_index' => 4,
+                                                                               
                                'value' => lang('done')
+                                                                               
                        ),                                                      
                                        
+                                                                               
                        array( // boton SAVE
+                                                                               
                                'type'  => 'button',
+                                                                               
                                'id'    => 'btn_save',
+                                                                               
                                'tab_index' => 3,
+                                                                               
                                'value' => lang('save')
+                                                                               
                        ),                                                      
        
+                                                               array( //boton  
SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',
+                                                                   'type' => 
'text',
+                                                                   'size'    
=> 28,
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                       
'tab_index' => 1
+                                                               ),
+                                                                               
                        array(
+                                                                               
                                'type'  => 'label',
+                                                                               
                                'id'    => 'lbl_template',
+                                                                               
                                'value' => ''
+                                                                               
                                
+                                                                               
                        )                                                       
        
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+                       }
+                                                                               
                                                                                
+                       $uicols = array (
+                               'input_type'    =>      
array(text,'text','text','text','text','varchar','select','combo','varchar','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden'),
+                               'type'                  =>      
array('','','','','','text','','','','text','','','',''),                       
        
+                               'name'                  =>      
array('building_part','code,hours_descr','unit','billperae','quantity','select','wo_hour_cat','cat_per_cent','chapter_id','grouping_descr','new_grouping','activity_id','activity_num','remark','ns3420_id','tolerance','cost','dim_d'),
+                               'formatter'             =>      
array('','','','','','','','','','','','','','','','','','',''),
+                               'descr'                 =>      
array(lang('Building 
part'),lang('Code'),lang('Description'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),lang('Select'),'','','','','','','','','','','',''),
+                               'className'             =>      
array('','','','','rightClasss','','centerClasss','','','','','','','','','','','','')
+                       );
+                       
+                       $values_combo_box       = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
+                       $default_value = array ('id'=>'','name'=>lang('no 
category'));
+                       array_unshift ($values_combo_box,$default_value);       
+                       
                        $template_list  = 
$botemplate->read_template_hour($template_id);
 
-                       $i=0;
                        $grouping_descr_old='';
-
-                       while (is_array($template_list) && list(,$template) = 
each($template_list))
+                       $content = array();
+                       $j=0;
+                       if (isset($template_list) && is_array($template_list))
                        {
+                               foreach($template_list as $template)
+                       {
 
-                               
if($template['grouping_descr']!=$grouping_descr_old)
+                                       if($template['grouping_descr'] != 
$grouping_descr_old)
                                {
                                        $new_grouping   = true;
                                }
@@ -1342,173 +2394,344 @@
                                        $code   = 
str_replace("-",$template['tolerance'],$template['ns3420_id']);
                                }
 
+                                       $hidden = '';
+                                       $hidden .= " <input 
name='values[chapter_id][".$j."]' id='values[chapter_id][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$template['chapter_id']."'/>";
+                                       $hidden .= " <input 
name='values[grouping_descr][".$j."]' id='values[grouping_descr][".$j."]'  
class='myValuesForPHP'  type='hidden' 
value='".$template['grouping_descr']."'/>";
+                                       $hidden .= " <input 
name='values[activity_id][".$j."]' id='values[activity_id][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$template['activity_id']."'/>";
+                                       $hidden .= " <input 
name='values[activity_num][".$j."]' id='values[activity_num][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$template['activity_num']."'/>";
+                                       $hidden .= " <input 
name='values[unit][".$j."]' id='values[unit][".$j."]'  class='myValuesForPHP'  
type='hidden' value='".$template['unit']."'/>";
+                                       $hidden .= " <input 
name='values[dim_d][".$j."]' id='values[dim_d][".$j."]'  class='myValuesForPHP' 
 type='hidden' value='".$template['dim_d']."'/>";
+                                       $hidden .= " <input 
name='values[ns3420_id][".$j."]' id='values[ns3420_id][".$j."]' 
class='myValuesForPHP'  type='hidden' value='".$template['ns3420_id']."'/>";
+                                       $hidden .= " <input 
name='values[tolerance][".$j."]' id='values[tolerance][".$j."]' 
class='myValuesForPHP'  type='hidden' value='".$template['tolerance']."'/>";
+                                       $hidden .= " <input 
name='values[building_part][".$j."]' id='values[building_part][".$j."]' 
class='myValuesForPHP'  type='hidden' value='".$template['building_part']."'/>";
+                                       $hidden .= " <input 
name='values[hours_descr][".$j."]' id='values[hours_descr][".$j."]' 
class='myValuesForPHP'  type='hidden' value='".$template['hours_descr']."'/>";
+                                       $hidden .= " <input 
name='values[remark][".$j."]' id='values[remark][".$j."]' 
class='myValuesForPHP'  type='hidden' value='".$template['remark']."'/>";
+                                       $hidden .= " <input 
name='values[billperae][".$j."]' id='values[billperae][".$j."]' 
class='myValuesForPHP'  type='hidden' value='".$template['billperae']."'/>";
+                                       
+                                       if ($j==0) 
+                                       {
+                                               $hidden .= " <input 
name='values[add]' id='values[add]'  class='myValuesForPHP'  type='hidden' 
value='add'/>";
+                                       }
 
-                               $content_template_hour[] = array
-                               (
-                                       'counter'                       => $i,
-                                       'chapter_id'                    => 
$template['chapter_id'],
-                                       'grouping_descr'                => 
$template['grouping_descr'],
-                                       'building_part'                 => 
$template['building_part'],
-                                       'new_grouping'                  => 
$new_grouping,
-                                       'code'                          => 
$code,
-                                       'activity_id'                   => 
$template['activity_id'],
-                                       'activity_num'                  => 
$template['activity_num'],
-                                       'hours_descr'                   => 
$template['hours_descr'],
-                                       'remark'                        => 
$template['remark'],
-                                       'ns3420_id'                     => 
$template['ns3420_id'],
-                                       'tolerance'                     => 
$template['tolerance'],
-                                       'cost'                          => 
$template['cost'],
-                                       'unit'                          => 
$template['unit'],
-                                       'billperae'                     => 
$template['billperae'],
-                                       'building_part'                 => 
$template['building_part'],
-                                       'dim_d'                         => 
$template['dim_d']
+                                       for ($i=0; $i<count($uicols['name']); 
$i++)
+                                       {                                       
                
+                                               if ($i==0) {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$template[$uicols['name'][$i]].$hidden;
+                                               } 
+                                               else 
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']    = 
$template[$uicols['name'][$i]];
+                                                       if ($uicols['name'][$i] 
== 'code') 
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $code;
+                                                       }
+                                                       if($uicols['name'][$i] 
== 'activity_num')
+                                                       {
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $new_grouping;
+                                                       }
+                                               }
+                                               
+                                               
$datatable['rows']['row'][$j]['column'][$i]['name']     = $uicols['name'][$i];
+                                               
+                                               if 
($uicols['input_type'][$i]=='varchar') 
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input 
name='values[".$uicols['name'][$i]."][".$j."]' 
id='values[".$uicols['name'][$i]."][".$j."]' size='4' class='myValuesForPHP'/>";
+                                               }
+                                                                               
        
+                                               if 
($uicols['input_type'][$i]=='select') 
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input 
name='values[".$uicols['name'][$i]."][".$j."]' 
id='values[".$uicols['name'][$i]."][".$j."]' class='myValuesForPHP CheckClass' 
type='hidden' value=''/> <input type='checkbox' 
name='values[".$uicols['name'][$i]."_tmp][".$j."]' 
id='values[".$uicols['name'][$i]."_tmp][".$j."]' class='CheckClass_tmp' 
value='".$j."' />";
+                                               }
+                                                                               
                
+                                               $select = '';
+                                               
if($uicols['input_type'][$i]=='combo') 
+                                               {
+                                                       $select  .= "<select 
name='values[".$uicols['name'][$i]."_list][".$j."]' 
id='values[".$uicols['name'][$i]."_list][".$j."]' class='combo_tmp'>";
+                                                       for($k = 0; 
$k<count($values_combo_box); $k++)
+                                                       {
+                                                               $select  .= 
"<option 
value='".$values_combo_box[$k]['id']."'>".$values_combo_box[$k]['name']."</option>";
+                                                       }
+                                                       $select  .= 
"</select>";        
+                                                       $select  .= " <input 
name='values[".$uicols['name'][$i]."][".$j."]' 
id='values[".$uicols['name'][$i]."][".$j."]'  class='myValuesForPHP combo'  
type='hidden' value=''/>";                                              
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = $select;
+                                               }                               
                                                                
+                                       }
+                                       $j++;
+                               }
+                       }
+
+                       $datatable['rowactions']['action'] = array();
+                       $uicols_count   = count($uicols['name']);
+                       
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['className']                = 
$uicols['className'][$i];
+                                       
+                                       if ($uicols['name'][$i] == 
'building_part' || $uicols['name'][$i] == 'billperae')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
+                                       }
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
+
+               
+
+                       $uicols_details = array (
+                               'name'  =>      
array('hour_id','post','code','hours_descr','unit','billperae','quantity','cost','deviation','result','wo_hour_category','cat_per_cent'),
+                               'input_type'    =>      
array('hidden','text','text','text','text','text','text','text','text','text','text','text'),
+                               'descr' =>      
array('',lang('Post'),lang('Code'),lang('Descr'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),lang('Cost'),lang('deviation'),lang('result'),lang('Category'),lang('Per
 Cent')),
+                               'className'             =>      
array('','','','','','rightClasss','rightClasss','rightClasss','rightClasss','rightClasss','','rightClasss')
                                );
 
-                               $i++;
+                       $j=0;
+                       if (isset($common_data['content']) && 
is_array($common_data['content']))
+                       {
+                               foreach($common_data['content'] as $content)
+                               {
+                                       for ($i=0; 
$i<count($uicols_details['name']); $i++)
+                                       {
+                                               if ($uicols_details['name'][$i] 
== 'deviation') 
+                                               {
+                                                       if 
(is_numeric($content[$uicols_details['name'][$i]])) {
+                                                               
$details['rows'][$j][$uicols_details['name'][$i]]       = 
$content[$uicols_details['name'][$i]];
+                                                       } else {
+                                                               
$details['rows'][$j][$uicols_details['name'][$i]]       = '';
+                                                       }
+                                               } else {
+                                                       
$details['rows'][$j][$uicols_details['name'][$i]]       = 
$content[$uicols_details['name'][$i]];
+                                               }
+                                       }
+                                       $j++;
+                               }
                        }
 
-                       $table_header_template_hour[] = array
-                       (
-                               'lang_code'             => lang('Code'),
-                               'lang_descr'            => lang('Description'),
-                               'lang_unit'             => lang('Unit'),
-                               'lang_quantity'         => lang('Quantity'),
-                               'lang_billperae'        => lang('Bill per 
unit'),
-                               'lang_cost'             => lang('Cost'),
 
-                               'sort_billperae'        => 
$this->nextmatchs->show_sort_order(array
+                       $details['rowactions'] = array();
+
+                       $parameters = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'billperae',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uiwo_hour.template',
-                                                                               
                                                        'workorder_id'  
=>$workorder_id,
-                                                                               
                                                        'template_id'   
=>$template_id,
-                                                                               
                                                        'query'                 
=>$this->query,
-                                                                               
                                                        'allrows'               
=>$this->allrows)
-                                                                               
)),
-                               'lang_select'           => lang('Select'),
-                               'sort_building_part'    => 
$this->nextmatchs->show_sort_order(array
+                               'parameter' => array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'building_part',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uiwo_hour.template',
-                                                                               
                                                        'workorder_id'  
=>$workorder_id,
-                                                                               
                                                        'template_id'   
=>$template_id,
-                                                                               
                                                        'query'                 
=>$this->query,
-                                                                               
                                                        'allrows'               
=>$this->allrows)
-                                                                               
)),
-                               'lang_building_part'    => lang('Building part')
+                                       array
+                                       (
+                                               'name'          => 'hour_id',
+                                               'source'        => 'hour_id'
+                                       )
+                               )
                        );
 
+                       $details['rowactions'][] = array(
+                               'my_name'                       => 'deviation',
+                               'text'                  => lang('Deviation'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                               (
+                                                                       
'menuaction'    => 'property.uiwo_hour.deviation',
+                                                                       
'workorder_id'  => $workorder_id,
+                                                                       'from'  
                => 'template'
+                                                               )),
+                               'parameters'    => $parameters
+                       );
 
-                       $table_done[] = array
+                       $details['rowactions'][] = array(
+                                       'my_name'                       => 
'deviation',
+                                       'text'                          => 
lang('open deviation in new window'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'lang_done'             => lang('Done'),
-                               'lang_done_statustext'  => lang('Back to list'),
-                               'done_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.index', 'workorder_id'=> $workorder_id))
+                                                               'menuaction'    
=> 'property.uiwo_hour.deviation',
+                                                               'workorder_id'  
=> $workorder_id,
+                                                               'from'          
        => 'template',
+                                                               'target'        
        => '_blank'
+                                                       )),
+                                       'parameters'    => $parameters
                        );
 
-                       $link_data = array
+                       $details['rowactions'][] = array(
+                                       'my_name'                       => 
'edit',
+                                       'text'                  => lang('Edit'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 
'property.uiwo_hour.template',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
+                                                                               
'menuaction'    => 'property.uiwo_hour.edit',
                                'workorder_id'  => $workorder_id,
                                'template_id'   => $template_id,
-                               'allrows'       => $this->allrows,
-                               'query'         => $this->query
+                                                                               
'from'                  => 'template'
+                                                                       )),
+                                       'parameters'    => $parameters
                        );
 
-                       $link_data_nextmatch = array
+                       $details['rowactions'][] = array(
+                                       'my_name'                       => 
'edit',
+                                       'text'                          => 
lang('open edit in new window'),
+                                       'action'                        => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
-                               'menuaction'    => 
'property.uiwo_hour.template',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
+                                                               'menuaction'    
=> 'property.uiwo_hour.edit',
                                'workorder_id'  => $workorder_id,
                                'template_id'   => $template_id,
-                               'query'         => $this->query
+                                                               'from'          
        => 'template',                                                          
+                                                               'target'        
        => '_blank'
+       
+                                                       )),
+                                       'parameters'    => $parameters
                        );
 
-                       $link_data_delete = array
+                       $details['rowactions'][] = array(
+                               'my_name'                       => 'delete',
+                               'text'                  => lang('Delete'),
+                               'confirm_msg'   => lang('do you really want to 
delete this entry'),
+                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                        (
                                'menuaction'    => 
'property.uiwo_hour.template',
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
                                'workorder_id'  => $workorder_id,
-                               'allrows'       => $this->allrows,
-                               'delete'        => true,
-                               'query'         => $this->query
+                                                                       
'template_id'   => $template_id,
+                                                                       
'delete'        => true
+                                                               )),
+                               'parameters'    => $parameters
                        );
 
+                       unset($parameters);
+                       
 
-                       if(!$this->allrows)
+                       $datatable['exchange_values'] = '';
+                       $datatable['valida'] = '';
+
+                       // path for property.js
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($template_list);
+                       $datatable['pagination']['records_total']       = 
$this->bopricebook->total_records;
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                               $datatable['sorting']['order']                  
= 'building_part'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
                        }
                        else
                        {
-                               $record_limit   = $this->bo->total_records;
+                               $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
+                       $appname                = lang('Template');
+                       $function_msg           = lang('list template');
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       //// cramirez: necesary for include a partucular js
+                       phpgwapi_yui::load_widget('loader');
+                       //cramirez: necesary for use opener . Avoid error JS
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       //FIXME this one is only needed when $lookup==true - so 
there is probably an error
+                       phpgwapi_yui::load_widget('animation'); 
+                       
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
 
-                       
$GLOBALS['phpgw']->js->validate_file('core','check','property');
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
+                       (
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'details'                       => 
$details,
+                                       'uicols_details'        => 
$uicols_details,
+                                       'table_sum'                     => 
$common_data['table_sum'][0],
+                                       'workorder_data'        => 
$common_data['workorder_data'],
+                                       'total_hours_records'   => 
$common_data['total_hours_records'],
+                                       'lang_total_records'    => lang('Total 
records')
+                       );
 
-                       $data = array
-                       (
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'lang_select_all'                       => 
lang('Select All'),
-                               'img_check'                             => 
$GLOBALS['phpgw']->common->get_image_path('property').'/check.png',
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
+                       {
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."' target='_blank'>" .$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
 
-                               'template_id'                           => 
$template_id,
-                               'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_add_statustext'                   => 
lang('Add the selected items'),
-                               'lang_add'                              => 
lang('Add'),
-                               'link_delete'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data_delete),
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                               'function'                              => 
'template',
-                               'allrows'                               => 
$this->allrows,
-                               'allow_allrows'                         => true,
-                               'start_record'                          => 
$this->start,
-                               'record_limit'                          => 
$record_limit,
-                               'num_records'                           => 
count($template_list),
-                               'all_records'                           => 
$this->bo->total_records,
-                               'link_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
-                               'img_path'                              => 
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'select_action'                         => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               // message when editting & deleting records
+                               if(isset($receipt) && is_array($receipt))
+                               {
+                                       $json ['message'][] = $receipt;
+                               }
 
-                               'lang_searchfield_statustext'           => 
lang('Enter the search string. To show all entries, empty this field and press 
the SUBMIT button again'),
-                               'lang_searchbutton_statustext'          => 
lang('Submit the search string'),
-                               'query'                                 => 
$this->query,
-                               'lang_search'                           => 
lang('search'),
-                               'workorder_data'                        => 
$common_data['workorder_data'],
-                               'table_header_template_hour'            => 
$table_header_template_hour,
-                               'values_template_hour'                  => 
$content_template_hour,
-                               'total_hours_records'                   => 
$common_data['total_hours_records'],
-                               'lang_total_records'                    => 
lang('Total records'),
-                               'table_header_hour'                     => 
$common_data['table_header'],
-                               'values_hour'                           => 
$common_data['content'],
-                               'table_sum'                             => 
$common_data['table_sum'],
-                               'table_done'                            => 
$table_done,
-                               'lang_wo_hour_category'                 => 
lang('category'),
-                               'lang_select_wo_hour_category'          => 
lang('no category'),
-                               'wo_hour_cat_list'                      => 
$this->bocommon->select_category_list(array('format'=>'select','selected' => 
$values['wo_hour_cat'],'type' =>'wo_hours','order'=>'id')),
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
 
-                               'lang_cat_per_cent_statustext'          => 
lang('the percentage of the category'),
-                               'value_cat_per_cent'                    => 
$values['cat_per_cent'],
-                               'lang_per_cent'                         => 
lang('Per Cent')
-                       );
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-//_debug_array($data);
-                       $appname                = lang('Template');
-                       $function_msg           = lang('list template');
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
 
+                       // Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' => 
$data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'wo_hour.template', 'property' );
+                       
                        $this->save_sessiondata();
                }
 
@@ -1520,7 +2743,7 @@
                        }
                        $from                   = phpgw::get_var('from');
                        $template_id            = phpgw::get_var('template_id', 
'int');
-                       $workorder_id           = 
phpgw::get_var('workorder_id', 'int');
+                       $workorder_id           = 
phpgw::get_var('workorder_id'); // in case of bigint
                        $activity_id            = phpgw::get_var('activity_id', 
'int');
                        $hour_id                = phpgw::get_var('hour_id', 
'int');
                        $values                 = phpgw::get_var('values');
@@ -1581,6 +2804,14 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
+                       
+                       
+                       
+                       
+                       
+                       
+               
+                       
                        $data = array
                        (
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -1681,7 +2912,7 @@
                                'value_cat_per_cent'                    => 
$values['cat_per_cent'],
                                'lang_per_cent'                         => 
lang('Per Cent')
                        );
-
+//_debug_array($data);
                        $appname = lang('Workorder');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
@@ -1696,12 +2927,19 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
                        }
                        $id             = phpgw::get_var('id', 'int');
-                       $workorder_id   = phpgw::get_var('workorder_id', 'int');
+                       $workorder_id   = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $hour_id        = phpgw::get_var('hour_id', 'int');
                        $deviation_id   = phpgw::get_var('deviation_id', 'int');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
 
+                       //delete for JSON proerty2
+                       if( phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               
$this->bo->delete_deviation($workorder_id,$hour_id,$deviation_id);      
+                               return "";      
+                       }
+
                        if($deviation_id)
                        {
                                $link_data = array

Modified: people/sigurdne/modules/property/trunk/inc/class.uiworkorder.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiworkorder.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/class.uiworkorder.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage project
-       * @version $Id$
+       * @version $Id$
        */
 
        phpgw::import_class('phpgwapi.yui');
@@ -46,6 +46,7 @@
                var $part_of_town_id;
                var $sub;
                var $currentapp;
+               var $criteria_id;
 
                var $public_functions = array
                (
@@ -60,18 +61,17 @@
 
                function property_uiworkorder()
                {
+                       $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; // 
menus added where needed via bocommon::get_menu
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::project::workorder';
 
-               //      $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->bo                               = 
CreateObject('property.boworkorder',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
                        $this->cats                                     = & 
$this->bo->cats;
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location                     = '.project';
+                       $this->acl_location                     = 
'.project.workorder';
                        $this->acl_read                         = 
$this->acl->check('.project', PHPGW_ACL_READ, 'property');
                        $this->acl_add                          = 
$this->acl->check('.project', PHPGW_ACL_ADD, 'property');
                        $this->acl_edit                         = 
$this->acl->check('.project', PHPGW_ACL_EDIT, 'property');
@@ -84,13 +84,14 @@
                        $this->filter                           = 
$this->bo->filter;
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->status_id                        = 
$this->bo->status_id;
-                       $this->search_vendor                    = 
$this->bo->search_vendor;
                        $this->wo_hour_cat_id                   = 
$this->bo->wo_hour_cat_id;
                        $this->start_date                       = 
$this->bo->start_date;
                        $this->end_date                         = 
$this->bo->end_date;
                        $this->b_group                          = 
$this->bo->b_group;
                        $this->paid                             = 
$this->bo->paid;
-
+                       $this->b_account                        = 
$this->bo->b_account;
+                       $this->district_id                      = 
$this->bo->district_id;
+                       $this->criteria_id                      = 
$this->bo->criteria_id;
                }
 
                function save_sessiondata()
@@ -103,13 +104,15 @@
                                'order'                         => $this->order,
                                'filter'                        => 
$this->filter,
                                'cat_id'                        => 
$this->cat_id,
-                               'search_vendor'                 => 
$this->search_vendor,
                                'status_id'                     => 
$this->status_id,
                                'wo_hour_cat_id'                => 
$this->wo_hour_cat_id,
                                'start_date'                    => 
$this->start_date,
                                'end_date'                      => 
$this->end_date,
                                'b_group'                       => 
$this->b_group,
                                'paid'                          => $this->paid,
+                               'b_account'                     => 
$this->b_account,
+                               'district_id'           => $this->district_id,
+                               'criteria_id'           => $this->criteria_id
                        );
                        $this->bo->save_sessiondata($data);
                }
@@ -118,7 +121,7 @@
                {
                        $start_date     = urldecode($this->start_date);
                        $end_date               = urldecode($this->end_date);
-                       $list                   = 
$this->bo->read($start_date,$end_date,$allrows=true);
+                       $list                   = 
$this->bo->read(array('start_date' => $start_date, 'end_date' => $end_date, 
'allrows' => true));
                        $uicols                 = $this->bo->uicols;
                        
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
                }
@@ -135,396 +138,688 @@
 
                function index()
                {
+
                        if(!$this->acl_read)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder','values','table_header',
-                                                                               
'nextmatchs'));
+                       /*
+                       * FIXME:
+                       * Temporary fix to avoid doubled get of first page in 
table all the way from the database - saves about 0.15 second
+                       * Should be fixed in the js if possible.
+                       */
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $json_get = 
phpgwapi_cache::session_get('property', 'workorder_index_json_get');
+                               if($json_get == 1)
+                               {
+                                       $json = 
phpgwapi_cache::session_get('property', 'workorder_index_json');
+                                       if($json && is_array($json))
+                                       {
+                                               
phpgwapi_cache::session_clear('property', 'workorder_index_json');
+                                               
phpgwapi_cache::session_set('property', 'workorder_index_json_get', 2);
+                                               return $json;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               phpgwapi_cache::session_clear('property', 
'workorder_index_json_get');
+                       }
+
+                       $allrows  = phpgw::get_var('allrows', 'bool');
+
                        $lookup = ''; //Fix this
+                       $dry_run = false;
+
+                       $datatable = array();
+                       $values_combo_box = array();
 
                        $start_date     = urldecode($this->start_date);
                        $end_date       = urldecode($this->end_date);
-                       $workorder_list = 
$this->bo->read($start_date,$end_date);
 
-                       $uicols = $this->bo->uicols;
-                       $count_uicols_name=count($uicols['name']);
+                       $second_display = phpgw::get_var('second_display', 
'bool');
+                       $default_district       = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
 
-                       $content = array();
-                       $j=0;
-                       if (isSet($workorder_list) AND 
is_array($workorder_list))
-                       {
-                               foreach($workorder_list as $workorder_entry)
-                               {
-                                       for ($k=0;$k<$count_uicols_name;$k++)
-                                       {
-                                               
if($uicols['input_type'][$k]!='hidden')
-                                               {
-                                                       
if(isset($workorder_entry['query_location'][$uicols['name'][$k]]) && 
$workorder_entry['query_location'][$uicols['name'][$k]])
+                       if ($default_district && !$second_display && 
!$this->district_id)
                                                        {
-                                                               
$content[$j]['row'][$k]['statustext']                   = lang('search');
-                                                               
$content[$j]['row'][$k]['text']                         = 
$workorder_entry[$uicols['name'][$k]];
-                                                               
$content[$j]['row'][$k]['link']                         = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.index','query'=> 
$workorder_entry['query_location'][$uicols['name'][$k]],'lookup'=> $lookup, 
'filter'=> $this->filter));
+                               $this->bo->district_id  = $default_district;
+                               $this->district_id              = 
$default_district;
                                                        }
-                                                       else
+
+
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                                                        {
-                                                               
$content[$j]['row'][$k]['value']                        = 
$workorder_entry[$uicols['name'][$k]];
-                                                               
$content[$j]['row'][$k]['name']                         = $uicols['name'][$k];
-                                                               
if($uicols['name'][$k]=='vendor_id')
+
+                               if(!$lookup)
                                                                {
-                                                                       
$content[$j]['row'][$k]['statustext']           = $workorder_entry['org_name'];
-                                                                       
$content[$j]['row'][$k]['overlib']              = true;
-                                                                       
$content[$j]['row'][$k]['text']                 = 
$workorder_entry[$uicols['name'][$k]];
-                                                               }
+                                       $datatable['menu']                      
        = $this->bocommon->get_menu();
                                                        }
+
+                       $datatable['config']['base_url'] = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'                    
=> 'property.uiworkorder.index',
+                                                                       
//'sort'                        => $this->sort,
+                                                                       
//'order'                       => $this->order,
+                                                                       
'lookup'                => $lookup,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       
'status_id'                     => $this->status_id,
+                                                                       
'filter'                        => $this->filter,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'start_date'            => $start_date,
+                                                                       
'end_date'                      => $end_date,
+                                                                       
'wo_hour_cat_id'        => $this->wo_hour_cat_id,
+                                                                       
'b_group'                       => $this->b_group,
+                                                                       'paid'  
                        => $this->paid,
+                                                       'district_id'           
=> $this->district_id,
+                                                                       
'criteria_id'           => $this->criteria_id
+
+                                       ));
+                       $datatable['config']['allow_allrows'] = false;
+
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uiworkorder.index',"
+
+                                                                               
                ."query:'{$this->query}',"
+                                                                               
."lookup:'{$lookup}',"
+                                                                               
."district_id: '{$this->district_id}',"
+                                                                               
."start_date:'{$start_date}',"
+                                                                               
."end_date:'{$end_date}',"
+                                                                               
."wo_hour_cat_id:'{$this->wo_hour_cat_id}',"
+                                                                               
."filter:'{$this->filter}',"
+                                                                               
."status_id:'{$this->status_id}',"
+                                                                               
."second_display:1,"
+                                                                               
."criteria_id:'{$this->criteria_id}',"
+                                                                               
."cat_id:'{$this->cat_id}'";
+
+                               $values_combo_box[0]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no district'));
+                               array_unshift 
($values_combo_box[0],$default_value);
+
+                               $values_combo_box[1] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => True));
+                               $default_value = array ('cat_id'=>'','name'=> 
lang('no category'));
+                               array_unshift 
($values_combo_box[1]['cat_list'],$default_value);
+
+                               $values_combo_box[2]  = 
$this->bo->select_status_list('filter',$this->status_id);
+                               $default_value = array ('id'=>'','name'=> 
lang('no status'));
+                               array_unshift 
($values_combo_box[2],$default_value);
+
+                       $values_combo_box[3] =  
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
+                               $default_value = array ('id'=>'','name'=> 
lang('no hour category'));
+                               array_unshift 
($values_combo_box[3],$default_value);
+
+                               $values_combo_box[4]  = 
$this->bocommon->get_user_list_right2('filter',2,$this->filter,$this->acl_location);
+                               $default_value = array 
('id'=>'','name'=>lang('no user'));
+                               array_unshift 
($values_combo_box[4],$default_value);
+
+                               $values_combo_box[5]  = 
$this->bo->get_criteria_list($this->criteria_id);
+                               $default_value = array 
('id'=>'','name'=>lang('no criteria'));
+                               array_unshift 
($values_combo_box[5],$default_value);
+
+                               $datatable['actions']['form'] = array(
+                                       array(
+                                               'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                               array(
+                                                                       
'menuaction'            => 'property.uiworkorder.index',
+                                                                       
'lookup'                => $lookup,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       
'status_id'                     => $this->status_id,
+                                                                       
'filter'                        => $this->filter,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'start_date'            => $start_date,
+                                                                       
'end_date'                      => $end_date,
+                                                                       
'wo_hour_cat_id'        => $this->wo_hour_cat_id,
+                                                                       'paid'  
                        => $this->paid,
+                                                       'district_id'       => 
$this->district_id,
+                                                               )
+                                                       ),
+                                               'fields'        => array(
+                                       'field' => array(
+                                                                       array( 
//boton  DISTRICT
+                                                                           
'id' => 'btn_district_id',
+                                                                           
'name' => 'district_id',
+                                                                           
'value'     => lang('district'),
+                                                                           
'type' => 'button',
+                                                                           
'style' => 'filter',
+                                                                           
'tab_index' => 1
+                                                                       ),
+                                                               array( //boton  
CATEGORY
+                                                                   'id' => 
'btn_cat_id',
+                                                                   'name' => 
'cat_id',
+                                                                   'value'     
=> lang('Category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 2
+                                                               ),
+                                                               array( //boton  
STATUS
+                                                                   'id' => 
'btn_status_id',
+                                                                   'name' => 
'status_id',
+                                                                   'value'     
=> lang('Status'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 3
+                                                               ),
+                                                               array( //boton  
HOUR CATEGORY
+                                                                   'id' => 
'btn_wo_hour_cat_id',
+                                                                   'name' => 
'wo_hour_cat_id',
+                                                                   'value'     
=> lang('Hour category'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 4
+                                                               ),
+                                                               array( //boton  
USER
+                                                                   'id' => 
'btn_user_id',
+                                                                   'name' => 
'filter',
+                                                                   'value'     
=> lang('User'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 5
+                                                               ),
+                                                               array( //boton  
search criteria
+                                                                   'id' => 
'btn_criteria_id',
+                                                                   'name' => 
'criteria_id',
+                                                                   'value'     
=> lang('search criteria'),
+                                                                   'type' => 
'button',
+                                                                   'style' => 
'filter',
+                                                                   'tab_index' 
=> 6
+                                                               ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_export',
+                                                                               
'value' => lang('download'),
+                                                                               
'tab_index' => 11
+                                                                           ),
+                                                                               
                        array(
+                                                                               
'type'  => 'button',
+                                                                               
'id'    => 'btn_new',
+                                                                               
'value' => lang('add'),
+                                                                               
'tab_index' => 10
+                                                                           ),
+                                                               array(
+                                                                               
'type'  => 'hidden',
+                                                                               
'id'    => 'start_date',
+                                                                               
'value' => $start_date
+                                                                           ),
+                                                               array(
+                                                                               
'type'  => 'hidden',
+                                                                               
'id'    => 'end_date',
+                                                                               
'value' => $end_date
+                                                                           ),
+                                                       array(
+                                                               'type'=> 
'label_date'
+                                                       ),
+                                                               array(
+                                                           'type'=> 'link',
+                                                           'id'  => 
'btn_data_search',
+                                                           'url' => 
"Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+                                                                  array(
+                                                                      
'menuaction' => 
'property.uiproject.date_search'))."','','width=350,height=250')",
+                                                            'value' => 
lang('Date search'),
+                                                            'tab_index' => 9
+                                                    ),
+                                                               array( //boton  
   SEARCH
+                                                                   'id' => 
'btn_search',
+                                                                   'name' => 
'search',
+                                                                   'value'    
=> lang('search'),
+                                                                   'type' => 
'button',
+                                                                   'tab_index' 
=> 8
+                                                               ),
+                                                                               
                        array( // TEXT IMPUT
+                                                                   'name'     
=> 'query',
+                                                                   'id'     => 
'txt_query',
+                                                                   'value'    
=> '',//$query,
+                                                                   'type' => 
'text',
+                                                                   
'onkeypress' => 'return pulsar(event)',
+                                                                   'size'    
=> 18,
+                                                                   'tab_index' 
=> 7
+                                                               ),
+                                                                       ),
+                                               'hidden_value' => array(
+                                                                               
        array( //div values  combo_box_0
+                                                                               
                                                        'id' => 
'values_combo_box_0',
+                                                                               
                                                        'value' => 
$this->bocommon->select2String($values_combo_box[0])
+                                                                               
      ),
+                                                                               
array( //div values  combo_box_1
+                                                                               
                    'id' => 'values_combo_box_1',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[1]['cat_list'], 'cat_id') 
//i.e.  id,value/id,vale/
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_2
+                                                                               
                    'id' => 'values_combo_box_2',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[2])
+                                                                               
              ),
+                                                                               
                                         array( //div values  combo_box_3
+                                                                               
                    'id' => 'values_combo_box_3',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[3])
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_4
+                                                                               
                    'id' => 'values_combo_box_4',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[4])
+                                                                               
              ),
+                                                                               
        array( //div values  combo_box_5
+                                                                               
                    'id' => 'values_combo_box_5',
+                                                                               
                    'value'     => 
$this->bocommon->select2String($values_combo_box[5])
+                                                                               
              )
+
+                                                                               
                )
+                                                                               
                )
+                                                                               
  )
+                               );
+
+                               $dry_run = true;
+
                                                }
-                                               if($lookup && 
$k==($count_uicols_name - 2))
-                                               
$content[$j]['row'][$k]['lookup_action']                                = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit', 'workorder_id'=> 
$workorder_entry['workorder_id']));
-                                       }
-                                       if(!$lookup)
+
+                       $workorder_list = array();
+
+                       $workorder_list = $this->bo->read(array('start_date' => 
$start_date, 'end_date' => $end_date, 'allrows' =>$allrows, 'dry_run' => 
$dry_run));
+                       $uicols = $this->bo->uicols;
+
+                       $content = array();
+                       $j=0;
+                       if (isset($workorder_list) && is_array($workorder_list))
                                        {
-                                               if ($this->acl_read && 
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_READ))
-                                               if($this->acl_read)
+                               foreach($workorder_list as $workorder)
                                                {
-                                                       
$content[$j]['row'][$k]['statustext']                           = lang('view 
the workorder');
-                                                       
$content[$j]['row'][$k]['text']                                 = lang('view');
-                                                       
$content[$j]['row'][$k]['link']                                 = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.view','id'=> $workorder_entry['workorder_id']));
-                                                       $k++;
-                                               }
-                                               else
+                                       for 
($i=0;$i<count($uicols['name']);$i++)
                                                {
-                                                       
$content[$j]['row'][$k++]['link']='dummy';
-                                               }
-
-                                               if ($this->acl_edit && 
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_EDIT))
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
+                                                       
if(isset($workorder['query_location'][$uicols['name'][$i]]))
                                                {
-                                                       
$content[$j]['row'][$k]['statustext']                           = lang('edit 
the workorder');
-                                                       
$content[$j]['row'][$k]['text']                                 = lang('edit');
-                                                       
$content[$j]['row'][$k]['link']                                 = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit', 'id' => $workorder_entry['workorder_id']));
-                                                       $k++;
 
-                                                       
$content[$j]['row'][$k]['statustext']                           = 
lang('calculate the workorder');
-                                                       
$content[$j]['row'][$k]['text']                                 = 
lang('calculate');
-                                                       
$content[$j]['row'][$k]['link']                                 = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uiwo_hour.index',
 'workorder_id'=> $workorder_entry['workorder_id']));
-                                                       $k++;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['statustext']               = 
lang('search');
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$workorder[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']                   = 
'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['java_link']                = true;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']                             
= $workorder['query_location'][$uicols['name'][$i]];
+
                                                }
                                                else
                                                {
-                                                       
$content[$j]['row'][$k++]['link']='dummy';
-                                                       
$content[$j]['row'][$k++]['link']='dummy';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$workorder[$uicols['name'][$i]];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['lookup']                   = 
$lookup;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
(isset($uicols['align'][$i])?$uicols['align'][$i]:'center');
+
+/*
+                                                               
if($uicols['name'][$i]=='vendor_id')
+                                                               {
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['statustext']               = 
$workorder['org_name'];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['overlib']          = true;
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['text']                     = 
$workorder[$uicols['name'][$i]];
                                                }
-
-                                               if ($this->acl_delete && 
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_DELETE))
+*/
+                                                               
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) && 
$uicols['datatype'][$i]=='link' && $workorder[$uicols['name'][$i]])
                                                {
-                                                       
$content[$j]['row'][$k]['statustext']                           = lang('delete 
the workorder');
-                                                       
$content[$j]['row'][$k]['text']                                 = 
lang('delete');
-                                                       
$content[$j]['row'][$k]['link']                                 = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.delete', 'id'=> $workorder_entry['workorder_id']));
-                                                       $k++;
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']            = lang('link');
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['link']             = 
$workorder[$uicols['name'][$i]];
+                                                                       
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
+                                                               }
+                                                       }
                                                }
                                                else
                                                {
-                                                       
$content[$j]['row'][$k++]['link']='dummy';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$workorder[$uicols['name'][$i]];
                                                }
+
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                    = 
$workorder[$uicols['name'][$i]];
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                     = 
$uicols['name'][$i];
                                        }
+
                                        $j++;
                                }
                        }
 
-                       $count_uicols_descr=count($uicols['descr']);
-                       for ($i=0;$i<$count_uicols_descr;$i++)
-                       {
-                               if($uicols['input_type'][$i]!='hidden')
-                               {
-                                       $table_header[$i]['header']     = 
$uicols['descr'][$i];
-                                       $table_header[$i]['width']              
= '5%';
-                                       $table_header[$i]['align']              
= 'center';
-                                       if($uicols['name'][$i]=='loc1')
+                       // NO pop-up
+                       if(!$lookup)
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                               $parameters = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'fm_location1.loc1',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uiworkorder.index',
-                                                                               
                                                //      'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                                //      'district_id'   => 
$this->district_id,
-                                                                               
                                                        'search_vendor' 
=>$this->search_vendor,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date,
-                                                                               
                                                        
'wo_hour_cat_id'=>$this->wo_hour_cat_id,
-                                                                               
                                                        'b_group'       => 
$this->b_group,
-                                                                               
                                                        'paid'          => 
$this->paid
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 'id',
+                                                       'source'        => 
'workorder_id'
+                                               ),
                                                                                
                                                )
-                                                                               
));
-                                       }
-                                       if($uicols['name'][$i]=='project_id')
-                                       {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                               );
+
+                               $parameters2 = array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'project_id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uiworkorder.index',
-                                                                               
                                        //              'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                        //              'district_id'   => 
$this->district_id,
-                                                                               
                                                        'search_vendor' 
=>$this->search_vendor,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date,
-                                                                               
                                                        
'wo_hour_cat_id'=>$this->wo_hour_cat_id,
-                                                                               
                                                        'b_group'       => 
$this->b_group,
-                                                                               
                                                        'paid'          => 
$this->paid
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'workorder_id',
+                                                       'source'        => 
'workorder_id'
+                                               ),
                                                                                
                                                )
-                                                                               
));
+                               );
+                               if($this->acl_read && 
$this->bocommon->check_perms($workorder['grants'],PHPGW_ACL_READ))
+                               {
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiworkorder.view'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'view',
+                                               'text'                  => 
lang('open view in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiworkorder.view',
+                                                                               
        'target'                => '_blank'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
-                                       if($uicols['name'][$i]=='workorder_id')
+                               if($this->acl_edit && 
$this->bocommon->check_perms($workorder['grants'],PHPGW_ACL_EDIT))
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('edit'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiworkorder.edit'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('open edit in new window'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                                                
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'workorder_id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uiworkorder.index',
-                                                                               
                                        //              'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                        //              'district_id'   => 
$this->district_id,
-                                                                               
                                                        'search_vendor' 
=>$this->search_vendor,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date,
-                                                                               
                                                        'wo_hour_cat_id'        
=>$this->wo_hour_cat_id,
-                                                                               
                                                        'b_group'       => 
$this->b_group,
-                                                                               
                                                        'paid'          => 
$this->paid
-                                                                               
                                                )
-                                                                               
));
+                                                                               
        'menuaction'    => 'property.uiworkorder.edit',
+                                                                               
        'target'                => '_blank'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
+
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'calculate',
+                                               'text'                  => 
lang('calculate'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiwo_hour.index'
+                                                                               
)),
+                                               'parameters'    => $parameters2
+                                       );
                                        }
-                                       if($uicols['name'][$i]=='address')
+                               if($this->acl_delete && 
$this->bocommon->check_perms($workorder['grants'],PHPGW_ACL_DELETE))
                                        {
-                                               $table_header[$i]['sort_link']  
=true;
-                                               $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'address',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 'property.uiworkorder.index',
-                                                                               
                                        //              'type_id'       
=>$type_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'lookup'        
=>$lookup,
-                                                                               
                                        //              'district_id'   => 
$this->district_id,
-                                                                               
                                                        'search_vendor' 
=>$this->search_vendor,
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date,
-                                                                               
                                                        
'wo_hour_cat_id'=>$this->wo_hour_cat_id,
-                                                                               
                                                        'b_group'       => 
$this->b_group,
-                                                                               
                                                        'paid'          => 
$this->paid
-                                                                               
                                                )
-                                                                               
));
+                                       $datatable['rowactions']['action'][] = 
array(
+                                               'my_name'                       
=> 'delete',
+                                               'text'                  => 
lang('delete'),
+                                               'confirm_msg'   => lang('do you 
really want to delete this entry'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiworkorder.delete'
+                                                                               
)),
+                                               'parameters'    => $parameters
+                                       );
                                        }
 
+                               $datatable['rowactions']['action'][] = array(
+                                               'my_name'                       
=> 'add',
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uiworkorder.add'
+                                                                               
))
+                               );
+                               unset($parameters);
                                }
-                       }
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
+                       $uicols_count   = count($uicols['descr']);
 
-                       if(!$lookup)
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+
+                               //all colums should have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
                        {
-                               if($this->acl_read)
+                                       
$datatable['headers']['header'][$i]['className']                = 
$uicols['classname'][$i] ? $uicols['classname'][$i] : '';
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['format']                   = 
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='project_id' || 
$uicols['name'][$i]=='workorder_id' ||  $uicols['name'][$i]=='address')
                                {
-                                       $table_header[$i]['width']      = '5%';
-                                       $table_header[$i]['align']      = 
'center';
-                                       $table_header[$i]['header']     = 
lang('view');
-                                       $i++;
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                                }
-                               if($this->acl_edit)
-                               {
-                                       $table_header[$i]['width']      = '5%';
-                                       $table_header[$i]['align']      = 
'center';
-                                       $table_header[$i]['header']     = 
lang('edit');
-                                       $i++;
-
-                                       $table_header[$i]['width']      = '5%';
-                                       $table_header[$i]['align']      = 
'center';
-                                       $table_header[$i]['header']     = 
lang('calculate');
-                                       $i++;
-                               }
-                               if($this->acl_delete)
-                               {
-                                       $table_header[$i]['width']      = '5%';
-                                       $table_header[$i]['align']      = 
'center';
-                                       $table_header[$i]['header']     = 
lang('delete');
-                                       $i++;
-                               }
+                                       if($uicols['name'][$i]=='loc1')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = "fm_location1.loc1";
+                                       }
+
                        }
                        else
                        {
-                               $table_header[$i]['width']              = '5%';
-                               $table_header[$i]['align']              = 
'center';
-                               $table_header[$i]['header']             = 
lang('select');
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
                        }
+                       }
+
+                       // path for property.js
+                       $datatable['property_js'] =  
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned'] = 
count($workorder_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
 
-//_debug_array($content);
-                       if($this->acl_add)
+
+                       $appname                        = lang('Workorder');
+                       $function_msg           = lang('list workorder');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $table_add[] = array
-                               (
-                                       'lang_add'                      => 
lang('add'),
-                                       'lang_add_statustext'           => 
lang('add a workorder'),
-                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.add'))
-                               );
+                           $datatable['sorting']['order']      = 'entry_date'; 
// name key Column in myColumnDef
+                           $datatable['sorting']['sort']       = 'desc'; // 
ASC / DESC
+                       }
+                       else
+                       {
+                           $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // name of column of Database
+                           $datatable['sorting']['sort']       = 
phpgw::get_var('sort', 'string'); // ASC / DESC
                        }
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uiworkorder.index',
-                                               'sort'                  => 
$this->sort,
-                                               'order'                 => 
$this->order,
-                                               'cat_id'                => 
$this->cat_id,
-                                       //      'district_id'           => 
$this->district_id,
-                                               'status_id'             => 
$this->status_id,
-                                               'filter'                => 
$this->filter,
-                                               'query'                 => 
$this->query,
-                                               'search_vendor'         => 
$this->search_vendor,
-                                               'start_date'            => 
$start_date,
-                                               'end_date'              => 
$end_date,
-                                               'wo_hour_cat_id'        => 
$this->wo_hour_cat_id,
-                                               'b_group'               => 
$this->b_group,
-                                               'paid'                  => 
$this->paid
-                       );
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('tabview');
 
-                       $link_date_search                               = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.date_search'));
 
-                       $link_download = array
+//-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+               //values for Pagination
+                       $json = array
                        (
-                               'menuaction'    => 
'property.uiworkorder.download',
-                                               'sort'                  => 
$this->sort,
-                                               'order'                 => 
$this->order,
-                                               'cat_id'                => 
$this->cat_id,
-                                       //      'district_id'           => 
$this->district_id,
-                                               'status_id'             => 
$this->status_id,
-                                               'filter'                => 
$this->filter,
-                                               'query'                 => 
$this->query,
-                                               'search_vendor'         => 
$this->search_vendor,
-                                               'start_date'            => 
$start_date,
-                                               'end_date'              => 
$end_date,
-                                               'start'                 => 
$this->start,
-                                               'wo_hour_cat_id'        => 
$this->wo_hour_cat_id,
-                                               'b_group'               => 
$this->b_group,
-                                               'paid'                  => 
$this->paid
+                               'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                               'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                               'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                               'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array()
                        );
 
-                       $cat_select = '';
-                       $cat_filter = '';
-                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])
+                               // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
                        {
-                               $group_filters = 'select';
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour_cat_select'));
-                               $cat_select     = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id));
+                                               if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
                        }
-                       else
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                 $json_row[$column['name']] = 
"<a href='".$column['link']."'>" .$column['value']."</a>";
+                                               }else
                        {
-                               $group_filters = 'filter';
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour_cat_filter'));
-                               $cat_filter = 
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data));
+                                                 $json_row[$column['name']] = 
$column['value'];
+                                               }
+                                       }
+                                        $json['records'][] = $json_row;
+                               }
                        }
 
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+                               // right in datatable
+                               if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                               {
+                                       $json ['rights'] = 
$datatable['rowactions']['action'];
+                               }
 
-                       $data = array
-                       (
-                               'menu'                                          
        => $this->bocommon->get_menu(),
-                               'group_filters'                                 
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters']:'',
-                               'lang_download'                                 
=> 'download',
-                               'link_download'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                            
=> lang('Download table to your browser'),
+                               /*
+                               * FIXME:
+                               * Temporary fix to avoid doubled get of first 
page in table all the way from the database - saves about 0.15 second
+                               * Should be fixed in the js if possible.
+                               */
+                               $json_get = 
phpgwapi_cache::session_get('property', 'workorder_index_json_get');
+                               if(!$json_get)
+                               {
+                                               
phpgwapi_cache::session_set('property', 'workorder_index_json',$json);
+                                               
phpgwapi_cache::session_set('property', 'workorder_index_json_get', 1);
+                               }
 
-                               'start_date'                                    
=>$start_date,
-                               'end_date'                                      
        =>$end_date,
-                               'lang_none'                                     
        =>lang('None'),
-                               'lang_date_search'                              
=> lang('Date search'),
-                               'lang_date_search_help'                 => 
lang('Narrow the search by dates'),
-                               'link_date_search'                              
=> $link_date_search,
+                       return $json;
+                       }
+//-------------------- JSON CODE ----------------------
+
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', $template_vars);
 
-                               'link_history'                                  
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.index')),
-                               'lang_history_statustext'               => 
lang('search for history at this location'),
-                               'allow_allrows'                                 
=> false,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($workorder_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-
-                               'cat_select'                                    
=> $cat_select,
-                               'cat_filter'                                    
=> $cat_filter,
-
-               //              'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
-                               'lang_status_statustext'                => 
lang('Select the status the agreement belongs to. To do not use a category 
select NO STATUS'),
-                               'status_name'                                   
=> 'status_id',
-                               'lang_no_status'                                
=> lang('No status'),
-                               'status_list'                                   
=> $this->bo->select_status_list($group_filters,$this->status_id),
-
-                               'lang_wo_hour_cat_statustext'   => lang('Select 
the workorder hour category'),
-                               'lang_no_wo_hour_cat'                   => 
lang('no hour category'),
-                               'wo_hour_cat_list'                              
=> $this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id')),
-
-                               'lang_user_statustext'                  => 
lang('Select the user the workorder belongs to. To do not use a category select 
NO USER'),
-                               'select_user_name'                              
=> 'filter',
-                               'lang_no_user'                                  
=> lang('No user'),
-                               'user_list'                                     
        => 
$this->bocommon->get_user_list_right2($group_filters,2,$this->filter,$this->acl_location),
-
-                               'lang_searchvendor_statustext'  => lang('Enter 
the vendor name to search for'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'search_vendor'                                 
=> $this->search_vendor,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
        => $content,
-                               'table_add'                                     
        => $table_add
-                       );
-
-                       $appname                        = lang('Workorder');
-                       $function_msg           = lang('list workorder');
-
+               if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+               {
+                       $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
+               }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+                       //Title of Page
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_workorder' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'workorder.index', 'property' );
+
                        $this->save_sessiondata();
+
                }
 
                function edit()
                {
+                       $id = phpgw::get_var('id'); // in case of bigint
+
                        if(!$this->acl_add && !$this->acl_edit)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>2, 'acl_location'=> $this->acl_location));
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.view', 'id'=> $id));
                        }
                        $boproject                      = 
CreateObject('property.boproject');
                        $bolocation                     = 
CreateObject('property.bolocation');
-                       $config                         = 
CreateObject('phpgwapi.config');
-                       $id                             = phpgw::get_var('id', 
'int');
+                       $config                         = 
CreateObject('phpgwapi.config','property');
+
                        $project_id                     = 
phpgw::get_var('project_id', 'int');
                        $values                         = 
phpgw::get_var('values');
+                       $values['ecodimb']      = phpgw::get_var('ecodimb');
 
                        $values['vendor_id']            = 
phpgw::get_var('vendor_id', 'int', 'POST');
                        $values['vendor_name']          = 
phpgw::get_var('vendor_name', 'string', 'POST');
                        $values['b_account_id']         = 
phpgw::get_var('b_account_id', 'int', 'POST');
                        $values['b_account_name']       = 
phpgw::get_var('b_account_name', 'string', 'POST');
+                       $values['event_id']                     = 
phpgw::get_var('event_id', 'int', 'POST');
+
+                       $config->read();
 
-                       $config->read_repository();
 
+                       $origin                         = 
phpgw::get_var('origin');
+                       $origin_id                      = 
phpgw::get_var('origin_id', 'int');
+
+                       if($origin == '.ticket' && $origin_id && 
!$values['descr'])
+                       {
+                               $boticket= CreateObject('property.botts');
+                               $ticket = $boticket->read_single($origin_id);
+                               $values['descr'] = $ticket['details'];
+                               $values['title'] = $ticket['subject'] ? 
$ticket['subject'] : $ticket['category_name'];
+                               $ticket_notes = 
$boticket->read_additional_notes($origin_id);
+                               $i = count($ticket_notes)-1;
+                               if(isset($ticket_notes[$i]['value_note']) && 
$ticket_notes[$i]['value_note'])
+                               {
+                                       $values['descr'] .= ": " . 
$ticket_notes[$i]['value_note'];
+                               }
+                       }
+
+                       if(isset($values['origin']) && $values['origin'])
+                       {
+                               $origin         = $values['origin'];
+                               $origin_id      = $values['origin_id'];
+                       }
+
+                       $interlink      = & $this->bo->interlink;
+                       if(isset($origin) && $origin)
+                       {
+                               unset($values['origin']);
+                               unset($values['origin_id']);
+                               $values['origin'][0]['location']= $origin;
+                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
+                               $values['origin'][0]['data'][]= array(
+                                       'id'    => $origin_id,
+                                       'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
+                                       );
+                       }
+
                        if (isset($values['save']))
                        {
+                               if($GLOBALS['phpgw']->session->is_repost())
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+                               }
+
+                               $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+                               if(isset($insert_record_entity) && 
is_array($insert_record_entity))
+                               {
+                                       for 
($j=0;$j<count($insert_record_entity);$j++)
+                                       {
+                                               
$insert_record['extra'][$insert_record_entity[$j]]      = 
$insert_record_entity[$j];
+                                       }
+                               }
+
+                               if(is_array($insert_record))
+                               {
+                                       $values = 
$this->bocommon->collect_locationdata($values,$insert_record);
+                               }
+
                                if(!$values['title'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter a workorder title !'));
@@ -560,25 +855,21 @@
 
                                if($id)
                                {
-                                       $values['workorder_id']=$id;
+                                       $values['id']=$id;
                                        $action='edit';
                                }
 
                                if(!$receipt['error'])
                                {
-                                       if(!$id)
-                                       {
-                                               
$values['workorder_id']=$this->bo->next_id();
-                                               $id     = 
$values['workorder_id'];
-                                       }
                                        if($values['copy_workorder'])
                                        {
                                                $action='add';
-                                               $values['workorder_id'] = 
$this->bo->next_id();
-                                               $id     = 
$values['workorder_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
-                                       $id = $values['workorder_id'];
+                                       if (! $receipt['error'])
+                                       {
+                                               $id = $receipt['id'];
+                                       }
                                        $function_msg = lang('Edit Workorder');
 //----------files
                                        $bofiles        = 
CreateObject('property.bofiles');
@@ -616,7 +907,7 @@
                                                }
                                        }
 //-----------
-                                       if ($values['approval'] && 
$values['mail_address'] && $config->config_data['mailnotification'])
+                                       if ($values['approval'] && 
$values['mail_address'] && $config->config_data['workorder_approval'])
                                        {
                                                
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
                                                
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
@@ -626,9 +917,8 @@
                                                $headers .= "Content-type: 
text/html; charset=iso-8859-1\r\n";
                                                $headers .= "MIME-Version: 
1.0\r\n";
 
-                                               $subject = lang(Approval).": ". 
$values['workorder_id'];
-                                       //      $message = lang('Workorder %1 
needs approval',$values['workorder_id']);
-                                               $message = '<a href ="http://' 
. $GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit', 'id'=> $values['project_id'])).'">' . 
lang('Workorder %1 needs approval',$values['workorder_id']) .'</a>';
+                                               $subject = lang(Approval).": ". 
$id;
+                                               $message = '<a href ="http://' 
. $GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.edit', 'id'=> $values['project_id'])).'">' . 
lang('Workorder %1 needs approval',$id) .'</a>';
 
                                                if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
                                                {
@@ -636,20 +926,40 @@
                                                        {
                                                                
$GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
                                                        }
-                                                       $bcc = 
$coordinator_email;
-                                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $values['mail_address'], $subject, 
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name, 
'plain');
+
+                                                       $action_params = array
+                                                       (
+                                                               'appname'       
                => 'property',
+                                                               'location'      
                => '.project.workorder',
+                                                               'id'            
                => $id,
+                                                               'responsible'   
        => '',
+                                                               
'responsible_type'  => 'user',
+                                                               'action'        
                => 'approval',
+                                                               'remark'        
                => '',
+                                                               'deadline'      
                => ''
+
+                                                       );
+                                                       $bcc = 
'';//$coordinator_email;
+                                                       foreach 
($values['mail_address'] as $_account_id => $_address)
+                                                       {
+                                                               
if(isset($values['approval'][$_account_id]) && 
$values['approval'][$_account_id])
+                                                               {
+                                                                       
$action_params['responsible'] = $_account_id;
+                                                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email', $_address, $subject, 
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name, 
'html');
+                                                                       
if($rcpt)
+                                                                       {
+                                                                               
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
+                                                                       }
+
+                                                                        
execMethod('property.sopending_action.set_pending_action', $action_params);
+                                                               }
+                                                       }
                                                }
                                                else
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('SMTP server is not set! (admin 
section)'));
                                                }
                                        }
-
-                                       if($rcpt)
-                                       {
-                                               
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',$values['mail_address']));
-                                       }
-
                                }
                        }
 
@@ -665,6 +975,11 @@
                                if($id)
                                {
                                        $values         = 
$this->bo->read_single($id);
+
+                                       if(!isset($values['origin']))
+                                       {
+                                               $values['origin'] = '';
+                                       }
                                }
                                if($project_id && !isset($values['project_id']))
                                {
@@ -682,7 +997,9 @@
                                        
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uiworkorder.view', 'id'=>$id));
                                }
-                               if (isset($receipt['notice_owner']) AND 
is_array($receipt['notice_owner']) && $config->config_data['mailnotification'])
+                               if (isset($receipt['notice_owner']) && 
is_array($receipt['notice_owner'])
+                                && $config->config_data['mailnotification'] 
+                                && 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner']
 == 1)
                                {
                                        
if($this->account!=$project['coordinator'] && 
$config->config_data['workorder_approval'])
                                        {
@@ -728,7 +1045,7 @@
                                        
$values['key_deliver']=$project['key_deliver'];
                                }
 
-/*                             if( $project['charge_tenant'] && 
!$values['workorder_id'])
+/*                             if( $project['charge_tenant'] && !$id)
                                {
                                        
$values['charge_tenant']=$project['charge_tenant'];
                                }
@@ -741,6 +1058,12 @@
                                {
                                        
$values['end_date']=$project['end_date'];
                                }
+                               else if( !$project['end_date'] && 
!$values['end_date'])
+                               {
+                                       
$values['end_date']=$project['end_date'];
+                                       $values['end_date'] = 
$GLOBALS['phpgw']->common->show_date(time(),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               }
+
                                if( $project['name'] && 
!isset($values['title']))
                                {
                                        $values['title']=$project['name'];
@@ -749,10 +1072,6 @@
                                {
                                        $values['descr']=$project['descr'];
                                }
-                               if( $project['status'] && 
!isset($values['status']))
-                               {
-                                       $values['status']=$project['status'];
-                               }
                        }
 
                        if($id)
@@ -761,7 +1080,7 @@
                        }
                        else
                        {
-                               $record_history = '';
+                               $record_history = array();
                        }
 
 //_debug_array($hour_data);
@@ -793,16 +1112,52 @@
                                $this->cat_id = $values['cat_id'];
                        }
 
+                       if(isset($config->config_data['location_at_workorder']) 
&& $config->config_data['location_at_workorder'])
+                       {
+                               $admin_location = & 
$bolocation->soadmin_location;
+                               $location_types = 
$admin_location->select_location_type();
+                               $max_level = 4;//count($location_types);
+
+                               $location_level = 
isset($project['location_data']['location_code']) ? 
count(explode('-',$project['location_data']['location_code'])) : 0 ;
+                               $location_template_type = 'form';
+                               $_location_data = array();
 
+                               if(isset($values['location_data']) && 
$values['location_data'])
+                               {
+                                       $_location_data = 
$values['location_data'];
+                               }
+                               else
+                               {
+                                               
if(isset($project['location_data']) && $project['location_data'])
+                                               {
+                                                       $_location_data = 
$project['location_data'];
+                                               }
+                               }
+
                        $location_data=$bolocation->initiate_ui_location(array(
+                                               'values'                        
=> $_location_data,
+                                               'type_id'                       
=> $max_level,
+                                               'no_link'                       
=> false, // disable lookup links for location type less than type_id
+                                               'tenant'                        
=> true,
+                                               'block_parent'          => 
$location_level,
+                                               'lookup_type'           => 
$location_template_type,
+                                               'lookup_entity'         => 
$this->bocommon->get_lookup_entity('project'),
+                                               'entity_data'           => 
(isset($values['p'])?$values['p']:''),
+                                               'filter_location'       => 
$project['location_data']['location_code']
+                                               ));
+                       }
+                       else
+                       {
+                               $location_template_type='view';
+                               
$location_data=$bolocation->initiate_ui_location(array(
                                                'values'                => 
(isset($project['location_data'])?$project['location_data']:''),
                                                'type_id'               => 
(isset($project['location_data']['location_code'])?count(explode('-',$project['location_data']['location_code'])):''),
                                                'no_link'               => 
false, // disable lookup links for location type less than type_id
                                                'tenant'                => 
(isset($project['location_data']['tenant_id'])?$project['location_data']['tenant_id']:''),
                                                'lookup_type'           => 
'view'
                                                ));
+                       }
 
-
                        if(isset($project['contact_phone']))
                        {
                                for 
($i=0;$i<count($location_data['location']);$i++)
@@ -820,52 +1175,88 @@
                                                'vendor_name'           => 
$values['vendor_name']));
 
                        
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
-                                               'b_account_id'          => 
$values['b_account_id'],
-                                               'b_account_name'        => 
$values['b_account_name']));
+                                               'b_account_id'          => 
$project['b_account_id'] ? $project['b_account_id'] : $values['b_account_id'],
+                                               'b_account_name'        => 
$values['b_account_name'],
+                                               'disabled'                      
=> !!$project['b_account_id']));
 
+                       
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array
+                                       (
+                                               'ecodimb'                       
=> $project['ecodimb'] ? $project['ecodimb'] : $values['ecodimb'],
+                                               'ecodimb_descr'         => 
$values['ecodimb_descr'],
+                                               'disabled'                      
=> !!$project['ecodimb']
+                                       )
+                       );
 
+                       $event_criteria = array
+                       (
+                               'location'              => $this->acl_location,
+                               'name'                  => 'event_id',
+                               'event_name'    => lang('schedule'),
+                               'event_id'              => $values['event_id'],
+                               'item_id'               => $id
+                       );
+                       $event_data = 
$this->bocommon->initiate_event_lookup($event_criteria);
+
+                       if(isset($event_data['count']) && $event_data['count'])
+                       {
+                               $sum_estimated_cost = $event_data['count'] * 
$values['calculation'];
+                       }
+                       else
+                       {
+                               $sum_estimated_cost = $values['calculation'];
+                       }
+
+                       $sum_estimated_cost             = 
number_format($sum_estimated_cost, 2, ',', '');
+                       $values['calculation']  = 
number_format($values['calculation'], 2, ',', '');
+                       $values['actual_cost']  = 
number_format($values['actual_cost'], 2, ',', '');
+
                        $link_data = array
                        (
                                'menuaction'    => 'property.uiworkorder.edit',
                                'id'            => $id
                        );
 
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
+                       $supervisor_id = 0;
 
-                       $dateformat= (implode($sep,$dlarr));
-
-
                        if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'])
                                && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'] )
                        {
                                $supervisor_id = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['approval_from'];
                        }
-                       else
-                       {
-                               $supervisor_id = '';
-                       }
 
-                       $need_approval = 
(isset($config->config_data['workorder_approval'])?$config->config_data['workorder_approval']:'');
+                       $need_approval = 
isset($config->config_data['workorder_approval']) ? 
$config->config_data['workorder_approval'] : '';
 
-                       if ($supervisor_id && ($need_approval=='yes'))
+                       $supervisor_email = array();
+                       if ($supervisor_id && $need_approval)
                        {
                                $prefs = 
$this->bocommon->create_preferences('property',$supervisor_id);
-                               $supervisor_email = $prefs['email'];
-                       }
-                       else
+                               $supervisor_email[] = array
+                               (
+                                       'id'      => $supervisor_id,
+                                       'address' => $prefs['email'],
+                               );
+                               if ( isset($prefs['approval_from']) )
+                               {
+                                       $prefs2 = 
$this->bocommon->create_preferences('property', $prefs['approval_from']);
+
+                                       if(isset($prefs2['email']))
                        {
-                               $supervisor_email = '';
+                                               $supervisor_email[] = array
+                                               (
+                                                       'id'      => 
$prefs['approval_from'],
+                                                       'address' => 
$prefs2['email'],
+                                               );
+                                               $supervisor_email = 
array_reverse($supervisor_email);
+                                       }
+                                       unset($prefs2);
+                               }
+                               unset($prefs);
                        }
 
-                       
$project_status=(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['project_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['project_status']:'');
+                       
$workorder_status=(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['workorder_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['workorder_status']:'');
                        if(!$values['status'])
                        {
-                               $values['status']=$project_status;
+                               $values['status']=$workorder_status;
                        }
 
                        $jscal = CreateObject('phpgwapi.jscalendar');
@@ -889,16 +1280,100 @@
 
                        $categories = 
$this->cats->formatted_xslt_list(array('selected' => $project['cat_id']));
 
+                       $datavalues[0] = array
+                       (
+                                       'name'                                  
=> "0",
+                                       'values'                                
=> json_encode($record_history),
+                                       'total_records'                 => 
count($record_history),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array(      
array('key' => 'value_date','label' => 
lang('Date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'value_user','label' => 
lang('User'),'Action'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'value_action','label' => 
lang('Action'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                array('key' => 'value_old_value','label' => lang('old value'), 
'sortable'=>true,'resizeable'=>true),
+                                                                               
        array('key' => 'value_new_value','label' => lang('New 
Value'),'sortable'=>true,'resizeable'=>true)))
+                       );
+
+                       $link_to_files 
=(isset($config->config_data['files_url'])?$config->config_data['files_url']:'');
+                       
+                       $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+
+                       for($z=0; $z<count($values['files']); $z++)
+                       {
+                               if ($link_to_files != '') {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$values['files'][$z]['directory'].'/'.$values['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$values['files'][$z]['name'].'</a>';
+                               }
+                               else {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$values['files'][$z]['file_name'].'" 
target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$values['files'][$z]['name'].'</a>';
+                               }
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'" style="cursor:help">';
+                       }                                                       
                
+
+                       $datavalues[1] = array
+                       (
+                                       'name'                                  
=> "1",
+                                       'values'                                
=> json_encode($content_files),
+                                       'total_records'                 => 
count($content_files),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                       );
+
+                       $myColumnDefs[1] = array
+                       (
+                               'name'          => "1",
+                               'values'        =>      json_encode(array(      
array(key => 
file_name,label=>lang('Filename'),sortable=>false,resizeable=>true),
+                                                                               
                array(key => delete_file,label=>lang('Delete 
file'),sortable=>false,resizeable=>true)))
+                       );
+                       
+                               
+                       $link_claim = '';
+                       
if(isset($values['charge_tenant'])?$values['charge_tenant']:'')
+                       {
+                               $claim = 
execMethod('property.sotenant_claim.read',array('project_id' => 
$project['project_id']));
+                               if($claim)
+                               {
+                                       $link_claim = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.edit', 'claim_id' => $claim[0]['claim_id']));
+                               }
+                               else
+                               {
+                                       $link_claim = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.check', 'project_id' => $project['project_id']));
+                               }
+                       }
+
+                       $catetory = 
$this->cats->return_single($project['cat_id']);
+                       $cat_sub = $this->cats->return_sorted_array($start = 
0,$limit = false,$query = '',$sort = '',$order = '',$globals = False, 
$parent_id = $project['cat_id']);
+                       $cat_sub = array_merge($catetory,$cat_sub);
+
+                       $suppresscoordination                   = 
isset($config->config_data['project_suppresscoordination']) && 
$config->config_data['project_suppresscoordination'] ? 1 : '';
                        $data = array
                        (
-                               'tabs'                                          
        => self::_generate_tabs(),
+                               'event_data'                                    
                => $event_data,
+                               'link_claim'                                    
                => $link_claim,
+                               'lang_claim'                                    
                => lang('claim'),
+                               'suppressmeter'                                 
                => isset($config->config_data['project_suppressmeter']) && 
$config->config_data['project_suppressmeter'] ? 1 : '',
+                               'suppresscoordination'                          
        => $suppresscoordination,
+                               'property_js'                                   
                => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+                               'datatable'                                     
                        => $datavalues,
+                               'myColumnDefs'                                  
                => $myColumnDefs,               
+                               'tabs'                                          
                        => self::_generate_tabs(array(),array('coordination' => 
$suppresscoordination)),
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'value_origin'                                  
                => isset($values['origin']) ? $values['origin'] : '',
+                               'value_origin_type'                             
                => isset($origin)?$origin:'',
+                               'value_origin_id'                               
                => isset($origin_id)?$origin_id:'',
+
                                'calculate_action'                      => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiwo_hour.index')),
                                'lang_calculate'                        => 
lang('Calculate Workorder'),
                                'lang_calculate_statustext'             => 
lang('Calculate workorder by adding items from vendors prizebook or adding 
general hours'),
 
                                'send_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uiwo_hour.view',
 'from'=>'index')),
-                               'lang_send'                             => 
lang('Send Workorder'),
+                               'lang_send'                                     
                        => $this->bo->order_sent_adress ? lang('ReSend 
Workorder') :lang('Send Workorder'),
                                'lang_send_statustext'                  => 
lang('send this workorder to vendor'),
 
                                'project_link'                          => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.edit')),
@@ -951,17 +1426,17 @@
                                'lang_incl_tax'                         => 
lang('incl tax'),
                                'lang_calculation'                      => 
lang('Calculation'),
                                'value_calculation'                     => 
(isset($values['calculation'])?$values['calculation']:''),
+                               'value_sum_estimated_cost'                      
        => $sum_estimated_cost,
 
                                'actual_cost'                           => 
(isset($values['actual_cost'])?$values['actual_cost']:''),
                                'lang_actual_cost'                      => 
lang('Actual cost'),
-
+                               'ecodimb_data'                                  
                => $ecodimb_data,
                                'vendor_data'                           => 
$vendor_data,
                                'location_data'                         => 
$location_data,
-                               'location_type'                         => 
'view',
+                               'location_template_type'                        
        => $location_template_type,
                                'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.index')),
                                'lang_year'                             => 
lang('Year'),
-                               'lang_category'                         => 
lang('category'),
                                'lang_save'                             => 
lang('save'),
                                'lang_done'                             => 
lang('done'),
                                'lang_title'                            => 
lang('Title'),
@@ -973,7 +1448,7 @@
                                'value_project_id'                      => 
$values['project_id'],
 
                                'lang_workorder_id'                     => 
lang('Workorder ID'),
-                               'value_workorder_id'                    => 
(isset($values['workorder_id'])?$values['workorder_id']:''),
+                               'value_workorder_id'                            
        => (isset($id)?$id:''),
 
                                'lang_title_statustext'                 => 
lang('Enter Workorder title'),
 
@@ -991,12 +1466,17 @@
 
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the workorder'),
-                               'lang_no_cat'                           => 
lang('Select category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the project belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                           => 
'values[cat_id]',
-                               'value_cat_id'                          => 
(isset($values['cat_id'])?$values['cat_id']:''),
-                               'cat_list'                                      
=> $categories['cat_list'],
+                       //      'lang_no_cat'                                   
                => lang('Select category'),
+                       //      'lang_cat_statustext'                           
        => lang('Select the category the project belongs to. To do not use a 
category select NO CATEGORY'),
+                       //      'select_name'                                   
                => 'values[cat_id]',
+                       //      'value_cat_id'                                  
                => (isset($values['cat_id'])?$values['cat_id']:''),
+                       //      'cat_list'                                      
                        => $categories['cat_list'],
 
+                               'lang_cat_sub'                                  
                => lang('category'),
+                               'cat_sub_list'                                  
                => $this->bocommon->select_list($values['cat_id'] ? 
$values['cat_id']: $project['cat_id'], $cat_sub),
+                               'cat_sub_name'                                  
                => 'values[cat_id]',
+                               'lang_cat_sub_statustext'                       
        => lang('select sub category'),
+
                                'sum_workorder_budget'                  => 
(isset($values['sum_workorder_budget'])?$values['sum_workorder_budget']:''),
                                'workorder_budget'                      => 
(isset($values['workorder_budget'])?$values['workorder_budget']:''),
 
@@ -1036,7 +1516,7 @@
                                'value_approval_mail_address'           => 
$supervisor_email,
                                'currency'                              => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
                                'link_view_file'                                
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
-                               'link_to_files'                                 
=> 
(isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:''),
+                               'link_to_files'                                 
                => 
(isset($config->config_data['files_url'])?$config->config_data['files_url']:''),
                                'files'                                         
        => isset($values['files'])?$values['files']:'',
                                'lang_files'                                    
=> lang('files'),
                                'lang_filename'                                 
=> lang('Filename'),
@@ -1051,8 +1531,26 @@
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder','files'));
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder','files','cat_sub_select'));
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+                                               
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+                       
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'workorder.edit', 'property' );  
                //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
@@ -1096,11 +1594,20 @@
 
                function delete()
                {
+
+                       $id = phpgw::get_var('id');
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               $this->bo->delete($id);
+                               return "id ".$id." ".lang("has been deleted");
+                       }
+
                        if(!$this->acl_delete)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>8, 'acl_location'=> $this->acl_location));
                        }
-                       $id = phpgw::get_var('id', 'int');
+                       //$id = phpgw::get_var('id', 'int');
                        $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
 
                        $link_data = array
@@ -1148,7 +1655,7 @@
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
                        
$GLOBALS['phpgw']->session->appsession('receipt','property','');
 
-                       $id     = phpgw::get_var('id', 'int');
+                       $id     = phpgw::get_var('id');
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('workorder', 
'hour_data_view', 'files'));
 
@@ -1174,14 +1681,38 @@
 
                        $function_msg = lang('View Workorder');
 
+                       $_location_data = array();
+                       $_tenant = 0;
+                       $_level = 0;
+                       if(isset($values['location_data']) && 
$values['location_data'])
+                       {
+                               $_location_data = $values['location_data'];
+                               $_tenant = 
isset($values['location_data']['tenant_id']) ? 
$values['location_data']['tenant_id'] : 0;
+                               $_level = 
count(explode('-',$values['location_data']['location_code']));
+                       }
+                       else
+                       {
+                                       if(isset($project['location_data']) && 
$project['location_data'])
+                                       {
+                                               $_location_data = 
$project['location_data'];
+                                               $_tenant = 
isset($project['location_data']['tenant_id']) ? 
$project['location_data']['tenant_id'] : 0;
+                                               $_level = 
count(explode('-',$project['location_data']['location_code']));
+                                       }
+                       }
+
                        $location_data=$bolocation->initiate_ui_location(array(
-                                               'values'        => 
$project['location_data'],
-                                               'type_id'       => 
count(explode('-',$project['location_data']['location_code'])),
+                                               'values'        => 
$_location_data,
+                                               'type_id'       => $_level,
                                                'no_link'       => false, // 
disable lookup links for location type less than type_id
-                                               'tenant'        => 
$project['location_data']['tenant_id'],
+                                               'tenant'        => $_tenant,
                                                'lookup_type'   => 'view'
                                                ));
 
+                       
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array(
+                                               'ecodimb'                       
=> $values['ecodimb'],
+                                               'ecodimb_descr'         => 
$values['ecodimb_descr'],
+                                               'type'                          
=>'view'));
+                       
 
                        if($project['contact_phone'])
                        {
@@ -1202,9 +1733,17 @@
 
                        $categories = 
$this->cats->formatted_xslt_list(array('selected' => $project['cat_id']));
 
+                       $config                         = 
CreateObject('phpgwapi.config','property');
+                       $config->read();
+
+
+                       $suppresscoordination                   = 
isset($config->config_data['project_suppresscoordination']) && 
$config->config_data['project_suppresscoordination'] ? 1 : '';
+
                        $data = array
                        (
-                               'tabs'                                          
        => self::_generate_tabs(),
+                               'suppressmeter'                                 
=> isset($config->config_data['project_suppressmeter']) && 
$config->config_data['project_suppressmeter'] ? 1 : '',
+                               'suppresscoordination'                  => 
$suppresscoordination,
+                               'tabs'                                          
        => self::_generate_tabs(array(),array('coordination' => 
$suppresscoordination)),
                                'project_link'                          => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.view')),
                                'table_header_workorder_budget'         => 
$table_header_workorder_budget,
                                'lang_no_workorders'                    => 
lang('No workorder budget'),
@@ -1217,10 +1756,12 @@
                                'lang_project_name'                     => 
lang('Project name'),
                                'value_project_name'                    => 
$project['name'],
 
+                               'value_origin'                          => 
$values['origin'],
+
                                'lang_vendor'                           => 
lang('Vendor'),
                                'value_vendor_id'                       => 
$values['vendor_id'],
                                'value_vendor_name'                     => 
$values['vendor_name'],
-
+                               'ecodimb_data'                          => 
$ecodimb_data,
                                'lang_b_account'                        => 
lang('Budget account'),
                                'value_b_account_id'                    => 
$values['b_account_id'],
                                'value_b_account_name'                  => 
$values['b_account_name'],
@@ -1325,21 +1866,29 @@
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }
                
-               protected function _generate_tabs()
+               protected function _generate_tabs($tabs_ = array(), $suppress = 
array())
                {
                        $tabs = array
                        (
-                               'project'               => array('label' => 
lang('Project info'), 'link' => '#project'),
                                'general'               => array('label' => 
lang('general'), 'link' => '#general'),
                                'budget'                => array('label' => 
lang('Time and budget'), 'link' => '#budget'),
                                'coordination'  => array('label' => 
lang('coordination'), 'link' => '#coordination'),
-                               'extra'                 => array('label' => 
lang('extra'), 'link' => '#extra'),
                                'documents'             => array('label' => 
lang('documents'), 'link' => '#documents'),
                                'history'               => array('label' => 
lang('history'), 'link' => '#history')
                        );
+                       $tabs = array_merge($tabs, $tabs_);
 
+                       foreach($suppress as $tab => $remove)
+                       {
+                               if($remove)
+                               {
+                                       unset($tabs[$tab]);
+                               }
+                       }
+
                        phpgwapi_yui::tabview_setup('workorder_tabview');
 
-                       return phpgwapi_yui::tabview_generate($tabs, 'project');
+                       return phpgwapi_yui::tabview_generate($tabs, 'general');
                }
+
        }

Added: people/sigurdne/modules/property/trunk/inc/cron/README
===================================================================
--- people/sigurdne/modules/property/trunk/inc/cron/README                      
        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/cron/README      2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1 @@
+The custom functions are separated by the phpgw_domain - for mulitple domains 
- one has to create one catalog for each domain.

Modified: people/sigurdne/modules/property/trunk/inc/cron/cron.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/cron/cron.php    2009-11-20 
10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/cron/cron.php    2009-11-20 
10:29:01 UTC (rev 20848)
@@ -38,11 +38,9 @@
 
        $_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 
'default';
 
-
        if(!$function = $_SERVER['argv'][2])
-
        {
-               echo date('Y/m/d H:i:s ') . " Nothing to execute\n";
+               echo "Nothing to execute\n";
                return;
        }
 
@@ -55,10 +53,22 @@
        include($path_to_phpgroupware.'/header.inc.php');
        unset($GLOBALS['phpgw_info']['flags']['noapi']);
 
-       $db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
+//     $db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
 
        $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db';
 
+       $_domain_info = isset($GLOBALS['phpgw_domain'][$_GET['domain']]) ? 
$GLOBALS['phpgw_domain'][$_GET['domain']] : '';
+       if(!$_domain_info)
+       {
+               echo "not a valid domain\n";
+               die();
+       }
+       else
+       {
+               $GLOBALS['phpgw_domain'] = array();
+               $GLOBALS['phpgw_domain'][$_GET['domain']] = $_domain_info;
+       }
+
        include(PHPGW_API_INC.'/functions.inc.php');
 
        $data = array('function' => $function,'enabled'=>1);
@@ -78,6 +88,8 @@
        }
 
        $GLOBALS['phpgw_info']['user']['apps']['admin'] = true;
+       $GLOBALS['phpgw_info']['user']['domain'] = $_GET['domain'];
+
        $num = ExecMethod('property.custom_functions.index',$data);
        // echo date('Y/m/d H:i:s ').$_GET['domain'].': '.($num ? "$num job(s) 
executed" : 'Nothing to execute')."\n";
 

Added: people/sigurdne/modules/property/trunk/inc/cron/default/catch_ppc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/cron/default/catch_ppc.php       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/cron/default/catch_ppc.php       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,373 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage catch
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class catch_ppc
+       {
+               var     $function_name = 'catch_ppc';
+
+               public function __construct()
+               {
+                       $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->join                     = & $this->db->join;
+                       $this->like                     = & $this->db->like;
+               }
+
+               function pre_run($data='')
+               {
+                       phpgwapi_cache::session_set('catch', 'data', $data);
+
+                       if(isset($data['enabled']) && $data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                               $cron = false;
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $data = phpgwapi_cache::session_get('catch', 'data');
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'data'          => urlencode(serialize($data)),
+                               'execute'       => $execute,
+                       );
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Export info as 
files'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = lang('Export info as files');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+
+                       try
+                       {
+                               $this->import_ppc();
+                       }
+                       catch(Exception $e)
+                       {
+                               
$this->receipt['error'][]=array('msg'=>$e->getMessage());
+                       }
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->db->datetime_format()),
+                               $this->function_name,
+                               implode(',',(array_keys($msgbox_data)))
+                               );
+
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function import_ppc()
+               {
+                       //do the actual import
+                       $config = CreateObject('catch.soconfig');
+                       $config->read_repository();
+                       $entity = CreateObject('property.soentity');
+                       $entity->type = 'catch';
+                       $admin_entity = CreateObject('property.soadmin_entity');
+                       $admin_entity->type = 'catch';
+
+                       $bofiles        = CreateObject('property.bofiles');
+
+                       foreach($config->config_data as $config_data)
+                       {
+                               $this->pickup_path = 
$config_data['pickup_path'];
+                               $target = $config_data['target'];
+                               $target_table = "fm_catch_{$target}";
+                               list($entity_id, $cat_id) = split('[_]', 
$target);
+                               $this->category_dir = 
"catch_{$entity_id}_{$cat_id}";
+                               $category                       = 
$admin_entity->read_single_category($entity_id, $cat_id);
+                               $schema_text            = "{$target} 
{$category['name']}";
+
+                               $metadata = $this->db->metadata($target_table);
+                               if(!$metadata)
+                               {
+                                       throw new Exception(lang('no valid 
target'));
+                               }
+                       
+                               $xmlparse = CreateObject('property.XmlToArray');
+                               $xmlparse->setEncoding('UTF-8');
+
+                               $file_list = $this->get_files();
+                               $i = 0;
+                               foreach ($file_list as $file)
+                               {
+                                       $var_result = 
$xmlparse->parseFile($file);
+                                       $var_result = 
array_change_key_case($var_result, CASE_LOWER);
+                               
+                                       //data
+                                       $insert_values  = array();
+                                       $cols           = array();
+                                       $val_errors     = array();
+
+                                       foreach($metadata as $field => 
$field_info)
+                                       {
+                                               // If field is missing from 
file jump to next
+                                               if(!isset($var_result[$field]))
+                                               {
+                                                       continue;
+                                               }
+
+                                               $insert_value = 
trim($var_result[$field]);
+                                               switch ( $field_info->type )
+                                               {
+                                                       case 'string':
+                                                       case 'varchar':
+                                                               $max_length = 
intval($field_info->max_length);
+                                                               $input_length = 
strlen( $insert_value );
+
+                                                               if( 
$input_length > $max_length ) {
+                                                                       
$val_errors[] = lang('Input for field "%1" is %2 characters, max for field is 
%3 (%4)', 
+                                                                               
$field_info->name, $input_length, $max_length, $file);
+                                                               }
+                                                               break;
+                                                       case 'int2':
+                                                       case 'int4':
+                                                               // Check if 
input starts with - (optional) and then only
+                                                               // contains 
numbers
+                                                               if( 
preg_match('@^[-]?[0-9]+$@', $insert_value) !== 1 )
+                                                               {
+                                                                       
$val_errors[] = lang('Input for field "%1" is "%2", but should be int (%3)',
+                                                                               
$field_info->name, $insert_value, $file);
+                                                               }
+                                                               break;
+                                                       case 'numeric':
+                                                               $insert_value = 
str_replace( ',', '.', $insert_value);
+                                                               $insert_value = 
floatval($insert_value);
+                                                               break;
+                                                       case 'timestamp':
+                                                               $insert_value = 
date( $this->db->date_format(), strtotime( $insert_value ) );
+                                                               break;
+                                               }
+                                               $insert_values[] = 
utf8_encode($insert_value);
+                                               $cols[] = $field;
+                                       }
+
+                                       // Raise exception if we have 
validation errors
+                                       if( count( $val_errors ) > 0 )
+                                       {
+                                               throw new Exception( 
implode("<br>", $val_errors) );                                            
+                                       }
+
+                                       if($cols) // something to import
+                                       {
+                                               $movefiles = array();
+
+                                               $this->db->transaction_begin();
+
+                                               $cols[] = 'entry_date';
+                                               $insert_values[] = time();
+                                               $id = 
$entity->generate_id(array('entity_id'=>$entity_id,'cat_id'=>$cat_id));
+                                               $num = 
$entity->generate_num($entity_id, $cat_id, $id);
+                                               $this->db->query("SELECT * FROM 
fm_catch_1_1 WHERE unitid ='{$var_result['unitid']}'",__LINE__,__FILE__);
+                                               $this->db->next_record();
+                                               $user_id = 
$this->db->f('user_');
+                                               if(!$user_id)
+                                               {
+                                                       throw new 
Exception(lang('no valid user for this UnitID: %1', $var_result['unitid']));
+                                               }
+
+                                               
$bofiles->set_account_id($user_id);
+                                               
$GLOBALS['phpgw_info']['user']['account_id'] = $user_id; // needed for the 
vfs::mkdir()
+                                               
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'property';
+
+                                               $insert_values  = 
$this->db->validate_insert($insert_values);
+                                               $this->db->query("INSERT INTO 
$target_table (id, num, user_id, " . implode(',', $cols) . ')'
+                                               . "VALUES ($id, '$num', 
$user_id, $insert_values)",__LINE__,__FILE__);
+
+                                               //attachment
+                                               foreach($var_result as $field 
=> $data)
+                                               {
+                                                       
if(is_file("{$this->pickup_path}/{$data}"))
+                                                       {
+                                                               $to_file = 
"{$bofiles->fakebase}/{$this->category_dir}/dummy/{$id}/{$field}_{$data}"; // 
the dummy is for being consistant with the entity-code that relies on loc1
+                                                               
$bofiles->create_document_dir("{$this->category_dir}/dummy/{$id}");
+
+                                                               
$bofiles->vfs->override_acl = 1;
+
+                                                               
if(!$bofiles->vfs->cp (array (
+                                                                       'from'  
=> "{$this->pickup_path}/{$data}",
+                                                                       'to'    
=> $to_file,
+                                                                       
'relatives'     => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+                                                               {
+                                                                       
$this->receipt['error'][]=array('msg'=>lang('Failed to upload file %1 on id 
%2', $data, $num));
+                                                               }
+                                                               
$bofiles->vfs->override_acl = 0;
+                                                               // move 
attachment
+                                                               
$movefiles["{$this->pickup_path}/{$data}"] = 
"{$this->pickup_path}/imported/{$data}";
+                                                       }
+                                               }
+                                               // move file
+                                               $_file = basename($file);
+                                               
$movefiles["{$this->pickup_path}/{$_file}"] = 
"{$this->pickup_path}/imported/{$_file}";
+
+                                               $i++;
+
+                                               // finishing
+                                               $criteria = array
+                                               (
+                                                       'appname'       => 
'catch',
+                                                       'location'      => 
'.catch.' . str_replace('_','.',$target),
+                                                       'allrows'       => true
+                                               );
+
+                                               $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+                                               foreach ( $custom_functions as 
$entry )
+                                               {
+                                                       // prevent path 
traversal
+                                                       if ( 
preg_match('/\.\./', $entry['file_name']) )
+                                                       {
+                                                               continue;
+                                                       }
+
+                                                       $file = 
PHPGW_SERVER_ROOT . 
"/catch/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+                                                       if ( $entry['active'] 
&& is_file($file) )
+                                                       {
+                                                               require_once 
$file;
+                                                       }
+                                               }
+                                               
+                                               $ok = false;
+                                               
if($this->db->transaction_commit())
+                                               {
+                                                       foreach ($movefiles as 
$movefrom => $moveto)
+                                                       {
+                                                               $ok = 
@rename($movefrom, $moveto);
+                                                       }
+                                               }
+                                               if(!$ok)
+                                               {
+                                                       
$this->db->query("DELETE FROM $target_table WHERE id =" . 
(int)$id,__LINE__,__FILE__);
+                                                       $i--;
+                                                       
$this->receipt['error'][]=array('msg'=>lang('There was a problem moving the 
file(s), imported records are reverted'));
+                                               }
+                                       }
+                               }
+                               
$this->receipt['message'][]=array('msg'=>lang('%1 records imported to %2', $i, 
$schema_text));
+                       }
+               }
+
+               public function get_files()
+               {
+                       $dirname = $this->pickup_path;
+                       // prevent path traversal
+                       if ( preg_match('/\./', $dirname) 
+                        || !is_dir($dirname) )
+                       {
+                               return array();
+                       }
+
+                       $file_list = array();
+                       $dir = new DirectoryIterator($dirname); 
+                       if ( is_object($dir) )
+                       {
+                               foreach ( $dir as $file )
+                               {
+                                       if ( $file->isDot()
+                                               || !$file->isFile()
+                                               || !$file->isReadable()
+                                               //|| 
mime_content_type($file->getPathname()) != 'text/xml')
+                                               //|| finfo_file( 
finfo_open(FILEINFO_MIME, '/usr/share/file/magic'), $file->getPathname() ) != 
'text/xml')
+                                               || strcasecmp( end( explode( 
".", $file->getPathname() ) ), 'xml' ) != 0 )
+                                       {
+                                               continue;
+                                       }
+
+                                       $file_list[] = (string) 
"{$dirname}/{$file}";
+                               }
+                       }
+
+                       return $file_list;
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/catch_ppc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,373 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class export_info_as_files
+       {
+               var     $function_name = 'export_info_as_files';
+
+               function export_info_as_files()
+               {
+               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db                               = 
$this->bocommon->new_db();
+                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->soadmin_location = 
CreateObject('property.soadmin_location');
+
+                       $this->join                             = 
$this->db->join;
+                       $this->like                             = 
$this->db->like;
+                       $this->left_join                = " LEFT JOIN ";
+                       $this->saveto                   = 
'/mnt/filer2/VaktPC_filer';
+               //      $this->saveto                   = '/tmp';
+                       $this->export_method = 'csv';
+               //      $this->export_method = 'excel';
+               //      $this->export_method = 'xml';
+                       $this->dateformat = 'd/m/Y';
+
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Export info as 
files'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = lang('Export info as files');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+
+                       $this->export_heiser();
+                       $this->export_brannalarm();
+                       $this->export_ventilasjon();
+                       $this->export_kabeltv();
+                       $this->export_sprinkler();
+                       $this->export_smokevent();
+                       $this->export_tenants();
+                       $this->export_keyes();
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               implode(',',(array_keys($msgbox_data)))
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function export_heiser()
+               {
+                       $descr = 
array('ID','Lokalisering','Adresse','status','Garanti 
faser','servicefrekvens','service firma','tlf service',
+                               'tlf 
service','Alarmtype','merknad_telefon','nhk_nummer','fabrikasjons_nr','heis_type',
+                               'Alarm til', 'Service kontrakt','Merknad');
+                       $name = array('num', 'location_code', 'address', 
'status', 'garanti_faser', 'servicefrekvens',
+                       'service_firma', 'tlf_service', 'tlf_heishus', 
'alarmtype', 'merknad_telefon', 'nhk_nummer',
+                       'fabrikasjons_nr', 'heis_type', 'alarm_til', 
'service_kontrakt', 'merknad');
+
+                       $filename= 'HEISER';
+                       $sql = "SELECT * from fm_entity_1_1";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+               function export_to_file($name,$descr,$filename, $sql)
+               {
+                       switch ($this->export_method)
+                       {
+                               case 'excel':
+                                       
$this->export_as_excel($name,$descr,$filename, $sql);
+                                       break;
+                               case 'csv':
+                                       
$this->export_as_csv($name,$descr,$filename, $sql);
+                                       break;
+                               case 'xml':
+                                       
$this->export_as_xml($name,$descr,$filename, $sql);
+                                       break;
+                       }
+               }
+
+               function export_brannalarm()
+               {
+                       $descr = array('ID', 'Objekt', 'Bygg', 'Inngang', 
'addresse', 'adresserbart', 'service_firma', 'Leverand\xF8r kontakt', 
'vakttelefon', 'merknad_bbb', 'type anlegg', 'sprinkelanlegg', 'securitnet nr', 
'tidsforsinkelse', 'Telenor tlf 1', 'Telenor tlf 12', 'BBB vakt 24 T');
+                       $name = array('num', 'loc1', 'loc2', 'loc3', 'address', 
'adreserbart', 'service_firma', 'lev_kontakt', 'vakttelefon', 'merknad_bbb', 
'type_anlegg', 'sprinkel', 'securitnet_nr', 'tidsforsinkelse', 'telenor_1', 
'telenor_2', 'vakt_24_bbb');
+
+                       $filename= 'BRANNALARMER';
+                       $sql = "SELECT * from fm_entity_1_2";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+               function export_ventilasjon()
+               {
+                       $descr = array('ID', 'Objekt', 'Bygg', 'addresse', 
'status', 'Anleggs type', 'Aggregat type', 'Filtertype', 'Antall filte', 
'Plassering', 'Merknad');
+                       $name = array('num', 'loc1', 'loc2', 'address', 
'status', 'v_type', 'aggr_type', 'filtertype', 'f_antall', 'plassering', 
'merknad');
+
+                       $filename= 'VENTILASJON';
+                       $sql = "SELECT * from fm_entity_1_7";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+               function export_kabeltv()
+               {
+                       $descr = array('ID', 'Objekt', 'Bygg', 'addresse', 
'antall leiligh. PT', 'leverand\xF8r', 'kontakt person', 'kotakt tlf (bbb)', 
'kotakt tlf (beboer)', 'Kunde nr leverand\xF8r', 'Kunde nr PT', 'Nett nr 
Post/tele', 'merknad');
+                       $name = array('num', 'loc1', 'loc2', 'address', 
'ant_leil_pt', 'leverandor', 'kontakt_person', 'k_tlf_bbb', 'k_tlf_beboer', 
'kunde_nr_lev', 'kunde_nr_pt', 'nett_nr_pt', 'merknad');
+
+                       $filename= 'KABEL-TV';
+                       $sql = "SELECT * from fm_entity_1_3";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+               function export_sprinkler()
+               {
+                       $descr = array('ID', 'Objekt', 'Bygg', 'Inngang', 
'addresse', 'status', 'eier', 'type anlegg', 'Drift start', 'Leverand\xF8r', 
'Telefon nr', 'Kontakt person', 'service avtale', 'plassering av sentral', 
'merknad');
+                       $name = array('num', 'loc1', 'loc2', 'loc3', 'address', 
'status', 'eier', 'type', 'dr_start', 'org_name', 'lev_tlf', 'kont_person', 
'service_avtale', 'plassering', 'merknad');
+
+                       $filename= 'SPRINKLER';
+                       $sql = "SELECT fm_entity_1_9.* , fm_vendor.org_name 
from fm_entity_1_9 left join fm_vendor on fm_entity_1_9.leverandor = 
fm_vendor.id ";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+
+               function export_smokevent()
+               {
+                       $descr = array('ID', 'Objekt', 'Bygg', 'addresse', 
'status', 'beskrivelse', 'merknad');
+                       $name = array('num', 'loc1', 'loc2', 'address', 
'status', 'beskrivelse', 'merknad');
+
+                       $filename= 'ROYKVENTILASJON';
+                       $sql = "SELECT * from fm_entity_1_8";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+               function export_tenants()
+               {
+                       $descr = array('Objekt', 
'Bygg','Inngang','Leieobjekt','Flyttenr','Reskontronr', 'Objekt Navn', 
'Etternavn', 'Fornavn', 'Kontakt tlf','Gatenavn','GateNr','Etasje','Antall 
Rom','Boareal','Ferdigdato','klargj\xF8ringsstatus');
+                       $name = array('loc1', 'loc2', 
'loc3','loc4','flyttenr','reskontronr','loc1_name', 'last_name', 'first_name', 
'contact_phone','street_name','street_number','etasje','antallrom','boareal','finnish_date','klargj_st');
+
+                       $filename= 'LEIETAKER';
+                       $sql = "SELECT 
fm_location4.location_code,fm_location4.loc1,fm_location4.loc2,fm_location4.loc3,fm_location4.loc4,fm_location4.flyttenr,"
+                       . " (fm_location4.loc1 || '.' || fm_location4.loc4 || 
'.' || fm_location4.flyttenr)as reskontronr, 
fm_location1.loc1_name,fm_tenant.id as 
tenant_id,fm_tenant.last_name,fm_tenant.first_name,fm_tenant.contact_phone,fm_streetaddress.descr
 as 
street_name,street_number,fm_location4.street_id,fm_location4.etasje,fm_location4.antallrom,fm_location4.boareal,"
+                        . "to_char(fm_location4.finnish_date, 'DD/MM/YYYY') as 
finnish_date ,fm_location4.klargj_st FROM ((((((( fm_location4 JOIN 
fm_location3 ON (fm_location4.loc3 = fm_location3.loc3) AND (fm_location4.loc2 
= fm_location3.loc2) AND (fm_location4.loc1 = fm_location3.loc1)) JOIN 
fm_location2 ON (fm_location3.loc2 = fm_location2.loc2) AND (fm_location3.loc1 
= fm_location2.loc1)) JOIN fm_location1 ON (fm_location2.loc1 = 
fm_location1.loc1)) JOIN fm_owner ON ( fm_location1.owner_id=fm_owner.id)) JOIN 
fm_part_of_town ON ( 
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id)) JOIN 
fm_streetaddress ON ( fm_location4.street_id=fm_streetaddress.id)) JOIN 
fm_tenant ON ( fm_location4.tenant_id=fm_tenant.id)) WHERE 
(fm_location4.category !=99 OR fm_location4.category IS NULL) AND 
driftsstatus_id > 0 ORDER BY reskontronr ASC";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+               function export_keyes()
+               {
+                       $descr = array('ID', 'Objekt', 'Bygg', 
'Addresse','System Nr');
+                       $name = array('num', 'loc1', 'loc2', 'address', 
'system_nr');
+
+                       $filename= 'NOEKLER';
+                       $sql = "SELECT * from fm_entity_1_6";
+
+                       $this->export_to_file($name,$descr,$filename, $sql);
+               }
+
+
+               function export_as_excel($name,$descr,$filename, $sql)
+               {
+                       $workbook       = CreateObject('phpgwapi.excel', 
"{$this->saveto}/{$filename}.xls");
+
+                       $worksheet1 =& $workbook->add_worksheet('First One');
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       for ($i=0;$i<count($descr);$i++)
+                       {
+                               $worksheet1->write_string(0, $i, 
$this->bocommon->utf2ascii($descr[$i]));
+                       }
+
+                       $worksheet1->write_string(0, $i, lang('date'));
+
+                       $line =1;
+                       while ($this->db->next_record())
+                       {
+                               for ($i=0;$i<count($name);$i++)
+                               {
+                                       $worksheet1->write($line,$i, 
$this->bocommon->utf2ascii($this->db->f($name[$i])));
+                               }
+                               $worksheet1->write($line,$i, 
$GLOBALS['phpgw']->common->show_date(time(),$this->dateformat));
+                               $line++;
+                       }
+
+
+                       $workbook->close();
+               }
+
+               function export_as_csv($name,$descr,$filename, $sql)
+               {
+
+                       $fp = fopen("{$this->saveto}/{$filename}.txt",'wb');
+
+                   $descr[] = 'Dato';
+                   fputcsv($fp, $descr, ';');
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $j=0;
+                       while ($this->db->next_record())
+                       {
+                               for ($i=0;$i<count($name);$i++)
+                               {
+                                       $content[$j][] = 
str_replace(array("\r","\n")," 
",$this->bocommon->utf2ascii($this->db->f($name[$i])));
+                               }
+                               $content[$j][] = 
$GLOBALS['phpgw']->common->show_date(time(),$this->dateformat);
+                               $j++;
+                       }
+
+                       foreach ($content as $line)
+                       {
+                           fputcsv($fp, $line, ';');
+                       }
+
+                       fclose($fp);
+               }
+
+               function export_as_xml($name,$descr,$filename, $sql)
+               {
+                   $descr[] = 'Dato';
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $j=0;
+                       while ($this->db->next_record())
+                       {
+                               for ($i=0;$i<count($name);$i++)
+                               {
+                                       $xmlvars[$j][$descr[$i]] = 
str_replace(array("\r","\n")," 
",$this->bocommon->utf2ascii($this->db->f($name[$i])));
+                               }
+                               $xmlvars[$j][$descr[$i]] = 
$GLOBALS['phpgw']->common->show_date(time(),$this->dateformat);
+                               $j++;
+                       }
+
+                       $xmltool = CreateObject('phpgwapi.xmltool');
+                       while(list($key,$value) = each($xmlvars))
+                       {
+                               $xmldata[$key] = $value;
+                       }
+
+                       $xml = var2xml('PHPGW',$xmldata);
+                       $fp = fopen("{$this->saveto}/{$filename}.xml",'wb');
+                       fwrite($fp,$xml);
+                       fclose($fp);
+               }
+
+/*
+               function arrayToXML($a)
+               {
+                       $xml = '';
+
+                       foreach($a as $k => $v)
+                       $xml .= "<$k>" . (is_array($v) ? $this->arrayToXML($v) 
: $v) . "</$k>";
+
+                       return $xml;
+               }
+*/
+
+       }
+
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/export_info_as_files.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/forward_mail_as_sms.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/forward_mail_as_sms.php 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/forward_mail_as_sms.php 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,195 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * usage:
+        * @package property
+        */
+
+       class forward_mail_as_sms
+       {
+               var     $function_name = 'forward_mail_as_sms';
+
+               function forward_mail_as_sms()
+               {
+                       $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+               }
+
+               function pre_run($data='')
+               {
+                       if(isset($data['enabled']) && $data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                               $data['account_id'] = 
$GLOBALS['phpgw']->accounts->name2id($data['user']);
+                               $GLOBALS['phpgw_info']['user']['account_id'] = 
$data['account_id'];
+                               $GLOBALS['phpgw']->session->account_id = 
$data['account_id'];
+                               
$GLOBALS['phpgw']->session->appsession('session_data','mail2sms',$data);
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                               $cron = false;
+                       }
+
+
+                       if (isset($confirm) && $confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                               $data['account_id'] = 
$GLOBALS['phpgw']->accounts->name2id($data['user']);
+                               
$GLOBALS['phpgw']->session->appsession('session_data','mail2sms',$data);
+                       }
+               }
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      => $this->function_name,
+                               'execute'       => $execute,
+                       );
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('Do you want to 
execute this action?');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+                       $msgbox_data = 
isset($this->receipt)?$this->bocommon->msgbox_data($this->receipt):'';
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Check for new 
mail - and forward as sms'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
lang('cancel'),
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('Async service');
+                       $function_msg   = 'Forward email as SMS';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+                       $receipt = $this->check_for_new_mail();
+                       if($receipt)
+                       {
+                               $this->cron_log($receipt,$cron);
+                       }
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+               function cron_log($receipt='',$cron='')
+               {
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               $receipt
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function check_for_new_mail()
+               {
+                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','mail2sms');
+
+                       $GLOBALS['phpgw_info']['user']['account_id'] = 
$data['account_id'];
+                       $GLOBALS['phpgw']->preferences->account_id = 
$data['account_id'];
+                       $pref = $GLOBALS['phpgw']->preferences->read();
+                       
$GLOBALS['phpgw_info']['user']['preferences']['felamimail'] = 
isset($pref['felamimail']) ? $pref['felamimail'] : '';
+
+                       $boPreferences  = 
CreateObject('felamimail.bopreferences');
+                       $boPreferences->setProfileActive(true,2); //2 for 
selected user
+                       $bofelamimail   = 
CreateObject('felamimail.bofelamimail');
+
+                       $connectionStatus = $bofelamimail->openConnection();
+                       $headers = $bofelamimail->getHeaders('INBOX', 1, 
$maxMessages = 15, $sort = 0, $_reverse = 1, $_filter = array('string' => '', 
'type' => 'quick', 'status' => 'unseen'));
+
+                       $j = 0;
+                       if (isset($headers['header']) && 
is_array($headers['header']))
+                       {
+                               foreach ($headers['header'] as $header)
+                               {
+                                       if($header['seen'] == 0)
+                                       {
+                                               $sms[$j]['message'] = 
utf8_encode($header['subject']);
+                                               $bodyParts = 
$bofelamimail->getMessageBody($header['uid']);
+                                               $sms[$j]['message'] .= "\n";
+                                               for($i=0; $i<count($bodyParts); 
$i++ )
+                                               {
+                                                       $sms[$j]['message'] .= 
utf8_encode($bodyParts[$i]['body']) . "\n";
+                                               }
+
+                                               $sms[$j]['message'] = 
substr($sms[$j]['message'],0,160);
+                                               $j++;
+                                       }
+                               }
+                       }
+                       if($connectionStatus == 'true')
+                       {
+                               $bofelamimail->closeConnection();
+                       }
+
+                       $bosms  = CreateObject('sms.bosms',false);
+                       if(isset($sms) && is_array($sms))
+                       {
+                               foreach ($sms as $entry)
+                               {
+                                       
$bosms->send_sms(array('p_num_text'=>$data['cellphone'], 'message' 
=>$entry['message']));
+                               }
+                       }
+
+                       $msg = $j . ' messages er sendt';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+
+                       if($j>0)
+                       {
+                               return $msg;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/forward_mail_as_sms.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,172 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_files
+       {
+               var     $function_name = 'import_files';
+
+               function import_files()
+               {
+               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db                               = 
$this->bocommon->new_db();
+                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->soadmin_location = 
CreateObject('property.soadmin_location');
+
+                       $this->join                             = 
$this->db->join;
+                       $this->like                             = 
$this->db->like;
+                       $this->left_join                = " LEFT JOIN ";
+                       $this->saveto                   = 
'/mnt/filer2/VaktPC_filer';
+               //      $this->saveto                   = '/tmp';
+                       $this->export_method = 'csv';
+               //      $this->export_method = 'excel';
+               //      $this->export_method = 'xml';
+                       $this->dateformat = 'd/m/Y';
+
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Export info as 
files'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = lang('Export info as files');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+
+                       $this->import_vaktprotokoll();
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               implode(',',(array_keys($msgbox_data)))
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function import_vaktprotokoll()
+               {
+                       $filename = 'Vakthendelser.xls';
+                       $data = CreateObject('phpgwapi.excelreader');
+
+                       $data->setOutputEncoding('CP1251');
+                       $data->read(PHPGW_SERVER_ROOT . 
"/property/inc/excelreader/test/{$filename}");
+
+                       for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++)
+                       {
+                               for ($j = 1; $j <= $data->sheets[0]['numCols']; 
$j++)
+                               {
+                                       echo 
"\"".$data->sheets[0]['cells'][$i][$j]."\",";
+                               }
+                               echo "\n";
+                       }
+               }
+       }
+
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/import_files.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,503 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_from_scanner
+       {
+               /* In Admin->Property->Async servises:
+               *  Name: property.custom_functions.index
+               *  Data: 
function=import_from_scanner,dir=C:/path/to/scanned_images
+               */
+
+               var     $dir = '/home/sn5607/test';
+               var     $suffix = 'pdf';
+               var     $meta_suffix = 'csv';
+               var     $delimiter = ',';
+               var $bypass = false; // bypass location check (only for 
debugging)
+               var $default_user_id = 6;
+               var $default_user_last_name = 'Aspevik';
+               var $mail_receipt = true;
+               var     $function_name = 'import_from_scanner';
+               var     $header = array('type','descr','target','user');
+
+               function import_from_scanner()
+               {
+               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->bofiles          = 
CreateObject('property.bofiles');
+                       $this->db           = $this->bocommon->new_db();
+
+               }
+
+               function pre_run($data='')
+               {
+                       $cron           = false;
+                       $dry_run        = false;
+
+                       if(isset($data['enabled']) && $data['enabled']==1)
+                       {
+                               $confirm                = true;
+                               $execute                = true;
+                               $cron                   = true;
+                               if($data['suffix'])
+                               {
+                                       $this->suffix = $data['suffix'];
+                               }
+                               if($data['dir'])
+                               {
+                                       $this->dir = $data['dir'];
+                               }
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = 
true;//phpgw::get_var('execute', 'bool', 'GET');
+                               if(phpgw::get_var('dir', 'string' ,'GET'))
+                               {
+                                       $this->dir = urldecode 
(phpgw::get_var('dir', 'string' ,'GET'));
+                               }
+                               if(phpgw::get_var('suffix', 'string', 'GET'))
+                               {
+                                       $this->suffix = 
phpgw::get_var('suffix', 'string', 'GET');
+                               }
+                       }
+
+                       if(!$execute)
+                       {
+                               $dry_run=true;
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($dry_run,$cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+               function confirm($execute='',$done='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      => $this->function_name,
+                               'execute'       => $execute,
+                               'dir'           => $this->dir,
+                               'suffix'        => $this->suffix,
+                       );
+
+                       if(!$done)
+                       {
+                               if(!$execute)
+                               {
+                                       $lang_confirm_msg       = 'Ga videre 
for aa se hva som blir lagt til';
+                               }
+                               else
+                               {
+                                       $lang_confirm_msg       = lang('do you 
want to perform this action');
+                               }
+                       }
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => 'Legger til 
dokumenter fra scanner',
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = 'import from scanner';
+                       $function_msg   = 'import files from 
scanner-drop-catalog';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($dry_run='',$cron='')
+               {
+                       $file_list = $this->get_files();
+
+                       if($dry_run)
+                       {
+                               _debug_array($file_list);
+                               $this->confirm($execute=true);
+
+                       }
+                       else
+                       {
+                               if (isset($file_list) && is_array($file_list))
+                               {
+                                       $this->botts            = 
CreateObject('property.botts');
+                                       $this->bolocation       = 
CreateObject('property.bolocation');
+                                       $send                   = 
CreateObject('phpgwapi.send');
+                                       foreach($file_list as $file_entry)
+                                       {
+                                               $file_entry['user_id'] = 
$this->get_user_id($file_entry['user']);
+
+                                               if($file_entry['type'] == 
'Dokumentasjon')
+                                               {
+                                                       
if($values['location_code'] = $this->get_location_code($file_entry['target']))
+                                                       {
+                                                               
$this->bolocation->initiate_ui_location(array('type_id' => -1,'tenant'  => 
true));
+
+                                                               $insert_record 
= $GLOBALS['phpgw']->session->appsession('insert_record','property');
+
+                                                               $values = 
$this->bolocation->read_single($values['location_code'],array('tenant_id'=>'lookup'));
+                                                               for ($i=0; 
$i<count($insert_record['location']); $i++)
+                                                               {
+                                                                       
if($values[$insert_record['location'][$i]])
+                                                                       {
+                                                                               
$values['location'][$insert_record['location'][$i]]= 
$values[$insert_record['location'][$i]];
+                                                                       }
+                                                               }
+
+                                                               
$values['category_id']  = 2;
+                                                               
$values['values_date']  = time();
+                                                               
$values['version']              = '1';
+                                                               
$values['coordinator']  = '';
+                                                               
$values['status']               = '1';
+                                                               
$values['branch_id']    = '';
+                                                               
$values['vendor_id']    = '';
+                                                               
$values['user_id']              = $file_entry['user_id'];
+                                                               
$values['file_name']    = $file_entry['file_name'];
+                                                               
$values['title']                = $file_entry['descr'];
+                                                               
$this->bofiles->create_document_dir("document/{$values['loc1']}");
+                                                               
$this->copy_files($values);
+                                                       }
+                                               }
+
+                                               if($file_entry['type'] == 
'Reklamasjon')
+                                               {
+                                                       
if($file_entry['target'] && $this->find_ticket($file_entry['target']))
+                                                       {
+                                                               
$this->add_file_to_ticket($file_entry['target'],$file_entry['file_name']);
+                                                       }
+                                                       else
+                                                       {
+                                                               
if($values['location_code'] = $this->get_location_code($file_entry['target']))
+                                                               {
+                                                                       
$this->bolocation->initiate_ui_location(array('type_id' => -1,'tenant'  => 
true));
+
+                                                                       
$insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+
+                                                                       $values 
= 
$this->bolocation->read_single($values['location_code'],array('tenant_id'=>'lookup'));
+                                                                       for 
($i=0; $i<count($insert_record['location']); $i++)
+                                                                       {
+                                                                               
if($values[$insert_record['location'][$i]])
+                                                                               
{
+                                                                               
        $values['location'][$insert_record['location'][$i]]= 
$values[$insert_record['location'][$i]];
+                                                                               
}
+                                                                       }
+
+                                                                       
$values['details']              = $file_entry['descr'];
+                                                                       
$values['subject']              = $file_entry['descr'];
+                                                                       
$values['assignedto']   = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault']:'');
+                                                                       
$values['group_id']             = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault']:'');
+                                                                       
$values['cat_id']               = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category']:'');
+                                                                       
$values['priority']             = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['prioritydefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['prioritydefault']:'');
+
+                                                                       
$receipt = $this->botts->add($values);
+                                                                       
$this->add_file_to_ticket($receipt['id'],$file_entry['file_name']);
+                                                               }
+                                                               else
+                                                               {
+                                                                       
$this->receipt['error'][]=array('msg'=>lang('Location is missing !'));
+                                                               }
+                                                       }
+                                               }
+
+                                               if($this->mail_receipt)
+                                               {
+                                                       $prefs = 
$this->bocommon->create_preferences('property',$file_entry['user_id']);
+                                                       if 
(strlen($prefs['email'])> (strlen($members[$i]['account_name'])+1))
+                                                       {
+                                                               $subject = 
'Resultat fra scanner';
+                                                               $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+                                                               $body = 
implode('</br>',array_keys($msgbox_data));
+                                                               //, '', $cc, 
$bcc,$current_user_address,$current_user_name,
+
+                                                               $to = 
$prefs['email'];
+                                                               $rc = 
$send->msg('email', $to, $subject, stripslashes($body), '', $cc, 
$bcc,$current_user_address,$current_user_name,'html');
+                                                       }
+                                                       else
+                                                       {
+                                                               
$this->receipt['error'][] = array('msg'=> lang('Your message could not be 
sent!'));
+                                                               
$this->receipt['error'][] = array('msg'=>lang('This user has not defined an 
email address !') . ' : ' . $members[$i]['account_name']);
+                                                       }
+                                               }
+
+                                               
unlink("{$this->dir}/{$file_entry['file_name']}{$this->suffix}");
+                                               
unlink("{$this->dir}/{$file_entry['file_name']}{$this->meta_suffix}");
+
+                                               $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                                               $insert_values= array(
+                                                       $cron,
+                                                       
date($this->bocommon->datetimeformat),
+                                                       $this->function_name,
+                                                       
implode(',',(array_keys($msgbox_data)))
+                                                       );
+
+                                               $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                                               $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                                               . "VALUES 
($insert_values)";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                               $receipt = array();
+                                       }
+                               }
+
+                               if(!$cron)
+                               {
+                                       
$this->confirm($execute=false,$done=true);
+                               }
+                       }
+               }
+
+               function get_files()
+               {
+                       $dir_handle = @opendir($this->dir);
+
+                       $myfilearray = array();
+                       while ($file = @readdir($dir_handle))
+                       {
+                               if ((strtolower(substr($file, -3, 3)) == 
$this->meta_suffix) && is_file("{$this->dir}/{$file}") )
+                               {
+                                       $myfilearray[] = $file;
+                               }
+                       }
+
+                       @closedir($dir_handle);
+                       @sort($myfilearray);
+
+                       for ($i=0;$i<count($myfilearray);$i++)
+                       {
+                               $fname = $myfilearray[$i];
+                               $file_list[$i]['file_name'] = substr($fname,0, 
strlen($fname)-strlen($this->meta_suffix));
+
+                               $fp = fopen("{$this->dir}/{$fname}", 'rb');
+
+                               $row = 1;
+                               while ($data = 
fgetcsv($fp,8000,$this->delimiter))
+                               {
+                                       if ($row ==2) // Ther first row is 
headerinfo
+                                       {
+                                               $num = count($this->header);
+
+                                               $this->currentrecord = array();
+                                               for ($c=0; $c<$num; $c++ )
+                                               {
+                                                       $value=$data[$c];
+                                                       $name=$this->header[$c];
+
+                                                       $file_list[$i][$name] = 
$value;
+                                               }
+                                       }
+                                       $row++;
+                               }
+                               fclose($fp);
+                       }
+                       return $file_list;
+               }
+
+               function add_file_to_ticket($id,$file_name)
+               {
+                               $to_file = 
"{$this->bofiles->fakebase}/fmticket/{$id}/{$file_name}{$this->suffix}";
+
+                               if($this->bofiles->vfs->file_exists(array(
+                                       'string' => $to_file,
+                                       'relatives' => Array(RELATIVE_NONE)
+                                       )))
+                               {
+                                       $this->receipt['error'][]=array('msg'=> 
'Denne filen finnes allerede for melding # ' . $id);
+                               }
+                               else
+                               {
+                                       
$this->bofiles->create_document_dir("fmticket/{$id}");
+                                       $this->bofiles->vfs->override_acl = 1;
+
+                                       if(!$this->bofiles->vfs->cp (array (
+                                               'from'  => $this->dir . '/' . 
$file_name . $this->suffix,
+                                               'to'    => $to_file,
+                                               'relatives'     => array 
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+                                       {
+                                               
$this->receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+                                       }
+                                       else
+                                       {
+                                               
$this->receipt['message'][]=array('msg'=>lang('File %1 added to ticket 
%2',$file_name . $this->suffix,$id));
+                                       }
+                                       $this->bofiles->vfs->override_acl = 0;
+                               }
+               }
+
+               function find_ticket($id='')
+               {
+                       if(!ctype_digit($id))
+                       {
+                               return false;
+                       }
+                       else
+                       {
+                               $sql = "SELECT count(*) FROM fm_tts_tickets 
WHERE id='$id'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db->next_record();
+                               if($this->db->f(0))
+                               {
+                                       return true;
+                               }
+                       }
+               }
+
+               function get_user_id($account_lastname = '')
+               {
+                       $account_lastname = 
$account_lastname?$account_lastname:$this->default_user_last_name;
+                       $sql = "SELECT account_id FROM phpgw_accounts WHERE 
account_lastname='$account_lastname'";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       if($this->db->f('account_id'))
+                       {
+                               return $this->db->f('account_id');
+                       }
+                       else
+                       {
+                               return $this->default_user_id;
+                       }
+               }
+
+               function get_location_code($target = '')
+               {
+                       if(strpos($target,'.'))
+                       {
+                               $location = explode('.', $target);
+                               $sql = "SELECT location_code FROM fm_location4 
WHERE loc1= '{$location[0]}' AND loc4= '{$location[1]}'";
+                       }
+                       else
+                       {
+                               $location =  explode('-', $target);
+                               $type = count($location);
+                               $sql = "SELECT location_code FROM 
fm_location{$type} WHERE location_code = '{$target}'";
+                       }
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f('location_code');
+               }
+
+
+               function copy_files($values)
+               {
+                       $to_file = 
"{$bofiles->fakebase}/document/{$values['loc1']}/{$values['file_name']}{$this->suffix}";
+                       $from_file = 
"{$this->dir}/{$values['file_name']}{$this->suffix}";
+                       $this->bofiles->vfs->override_acl = 1;
+
+                       if($this->bofiles->vfs->file_exists(array(
+                                       'string' => $to_file,
+                                       'relatives' => Array(RELATIVE_NONE)
+                               )))
+                       {
+                               
$this->receipt['error'][]=array('msg'=>lang('File %1 already 
exists!',$values['file_name'] . $this->suffix));
+                       }
+                       else
+                       {
+
+                               if(!$this->bofiles->vfs->cp (array (
+                                       'from'  => $from_file,
+                                       'to'    => $to_file,
+                                       'relatives'     => array 
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+                               {
+                                       
$this->receipt['error'][]=array('msg'=>lang('Failed to copy file !') . 
$values['file_name'] . $this->suffix);
+                               }
+                               else
+                               {
+                                       if($ticket['street_name'])
+                                       {
+                                               $address        = 
$this->db->db_addslashes($values['street_name'] . ' ' . 
$values['street_number']);
+                                       }
+
+                                       if(!$address)
+                                       {
+                                               $address = 
$this->db->db_addslashes($values['location_name']);
+                                       }
+
+                                       $insert_values= array(
+                                               $values['file_name'] . 
$this->suffix,
+                                               $values['title'],
+                                               'public',
+                                               $values['category_id'],
+                                               time(),
+                                               $values['values_date'],
+                                               $values['version'],
+                                               $values['coordinator'],
+                                               $values['status'],
+                                               $values['location_code'],
+                                               $address,
+                                               $values['branch_id'],
+                                               $values['vendor_id'],
+                                               $this->account,
+                                               $values['loc1'],
+                                               $values['loc2'],
+                                               $values['loc3'],
+                                               $values['loc4'],
+                                               );
+
+                                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                                       $sql = "INSERT INTO fm_document 
(document_name,title,access,category,entry_date,document_date,version,coordinator,status,"
+                                               . 
"location_code,address,branch_id,vendor_id,user_id,loc1,loc2,loc3,loc4) "
+                                               . "VALUES ($insert_values)";
+
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+
+                                       
$this->receipt['message'][]=array('msg'=>lang('File %1 
copied!',$values['file_name'] . $this->suffix));
+                               }
+                       }
+                       $this->bofiles->vfs->override_acl = 0;
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/import_from_scanner.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/lag_lang_filer.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/cron/default/lag_lang_filer.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/cron/default/lag_lang_filer.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,143 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class lag_lang_filer
+       {
+               var     $function_name = 'lag_lang_filer';
+
+               function lag_lang_filer()
+               {
+               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->db               = $this->bocommon->new_db();
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+                       $lang_yes                       = lang('yes');
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => 'lag_lang_filer fra 
database',
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = 'lag_lang_filer';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+
+                       $sql = "SELECT * from phpgw_lang WHERE app_name = 
'property' AND lang='no' ORDER BY message_id ASC";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $i=0;
+                       while ($this->db->next_record())
+                       {
+                                       $str.=$this->db->f('message_id') ."\t";
+                                       $str.=$this->db->f('app_name') ."\t";
+                                       $str.=$this->db->f('lang') ."\t";
+                                       $str.=$this->db->f('content') ."\n";
+                                       $i++;
+                       }
+
+_debug_array($str);
+/*                        $filename= 'phpgw_no_lang';
+
+                               $size=strlen($str);
+
+                               $browser = CreateObject('phpgwapi.browser');
+                               
$browser->content_header($filename,'application/txt',$size);
+
+                               echo $str;
+*/
+
+                       $this->receipt['message'][]=array('msg'=> $i . ' 
tekster lagt til');
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/lag_lang_filer.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
                              (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
      2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,174 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class oppdater_antall_leieobjekt
+       {
+               var     $function_name = 'oppdater_antall_leieobjekt';
+
+               function oppdater_antall_leieobjekt()
+               {
+               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db                               = 
$this->bocommon->new_db();
+                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->join                             = 
$this->db->join;
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => 'Oppdater antall 
leieobjekter for tv-anlegg',
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = 'Oppdater antall leieobjekter for 
tv-anlegg';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+
+                       $this->db->transaction_begin();
+
+
+                       $sql = "SELECT kunde_nr_lev, fm_entity_1_3.loc1, 
fm_entity_1_3.loc2, Count(fm_location4.location_code) AS antall_leieobjekt, 
fm_entity_1_3.location_code
+                                       FROM fm_entity_1_3 INNER JOIN 
fm_location4 ON (fm_entity_1_3.loc1 = fm_location4.loc1) AND 
(fm_entity_1_3.loc2 = fm_location4.loc2)
+                                       WHERE fm_location4.category IN 
(1,2,3,4,6,10,14,15,17,22,23,24,25)
+                                       GROUP BY kunde_nr_lev, 
fm_entity_1_3.loc1, fm_entity_1_3.loc2, fm_entity_1_3.location_code";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               if($this->db->f('kunde_nr_lev'))
+                               {
+                                       $update[]= array(
+                                       'kunde_nr_lev'  
=>$this->db->f('kunde_nr_lev'),
+                                       'antall_leieobjekt'     
=>$this->db->f('antall_leieobjekt'),
+                                       );
+                               }
+                       }
+
+//_debug_array($update);
+
+                       for ($i=0; $i<count($update); $i++)
+                       {
+                               $this->db->query("UPDATE fm_entity_1_3 set 
ant_leil_pt =" . $update[$i]['antall_leieobjekt'] . " WHERE kunde_nr_lev= '" . 
$update[$i]['kunde_nr_lev'] . "'" ,__LINE__,__FILE__);
+                       }
+
+                       $this->receipt['message'][]=array('msg'=>'antall 
leieobjekter er oppdatert for tv-anlegg');
+
+                       unset($update);
+
+                       $this->db->transaction_commit();
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               implode(',',(array_keys($msgbox_data)))
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_antall_leieobjekt.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
                             (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
     2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,227 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class oppdater_namssakstatus_pr_leietaker
+       {
+               var     $function_name = 'oppdater_namssakstatus_pr_leietaker';
+
+               function oppdater_namssakstatus_pr_leietaker()
+               {
+               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db                               = 
$this->bocommon->new_db();
+                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+                       $this->join                             = 
$this->db->join;
+                       $this->like                             = 
$this->db->like;
+                       $this->left_join                = " LEFT JOIN ";
+
+                       if(isset($this->db->adodb) && $this->db->adodb)
+                       {
+                               $this->db_boei                  = 
CreateObject('phpgwapi.db',false,$GLOBALS['external_db']['boei']['db_type']);
+                               $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
+                               $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
+                               $this->db_boei->Database        = 
$GLOBALS['external_db']['boei']['db_name'];
+                               $this->db_boei->User            = 
$GLOBALS['external_db']['boei']['db_user'];
+                               $this->db_boei->Password        = 
$GLOBALS['external_db']['boei']['db_pass'];
+                               $this->db_boei->Halt_On_Error   = 'yes';
+                               $this->db_boei->connect();
+                       }
+                       else
+                       {
+                               $this->db_boei                  = 
CreateObject('property.db_mssql');
+                               $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
+                               $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
+                               $this->db_boei->Database        = 
$GLOBALS['external_db']['boei']['db_name'];
+                               $this->db_boei->User            = 
$GLOBALS['external_db']['boei']['db_user'];
+                               $this->db_boei->Password        = 
$GLOBALS['external_db']['boei']['db_pass'];
+                               $this->db_boei->Halt_On_Error   = 'yes';
+                       }
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Update the 
category to not active based on if there is only nonactive apartments'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = 'Oppdatere namssaksstatus pr 
leietater';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+
+                       $receipt = $this->oppdater_namssakstatus();
+                       $this->cron_log($receipt,$cron);
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+               }
+
+               function cron_log($receipt='',$cron='')
+               {
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               $receipt
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function oppdater_namssakstatus()
+               {
+
+                       $sql = "SELECT TOP 100 PERCENT fm_tenant.id"
+                                       . " FROM  fm_tenant LEFT OUTER JOIN"
+                    . " v_Leietaker ON fm_tenant.id = v_Leietaker.leietaker_id 
AND "
+                    . " fm_tenant.status_drift = 
v_Leietaker.namssakstatusdrift_id AND "
+                    . " fm_tenant.status_eco = 
v_Leietaker.namssakstatusokonomi_id"
+                                       . " WHERE (v_Leietaker.leietaker_id IS 
NULL)";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+                       $this->db->transaction_begin();
+                       $this->db_boei->transaction_begin();
+
+                       while ($this->db_boei->next_record())
+                       {
+                               $leietaker[]= $this->db_boei->f('id');
+                       }
+
+                       for ($i=0; $i<count($leietaker); $i++)
+                       {
+                               $sql = "SELECT namssakstatusokonomi_id, 
namssakstatusdrift_id"
+                                       . " FROM  v_Leietaker"
+                                       . " WHERE (v_Leietaker.leietaker_id = 
'" . $leietaker[$i] . "')";
+
+                               $this->db_boei->query($sql,__LINE__,__FILE__);
+
+                               $this->db_boei->next_record();
+                               $leietaker_oppdatert[]= array (
+                                'id'                           => 
$leietaker[$i],
+                                'status_drift'         => 
$this->db_boei->f('namssakstatusdrift_id'),
+                                'status_eco'           => 
$this->db_boei->f('namssakstatusokonomi_id')
+                                );
+
+                       }
+
+                       for ($i=0; $i<count($leietaker_oppdatert); $i++)
+                       {
+                               $sql = " UPDATE fm_tenant SET "
+                               . " status_eco = '" . 
$leietaker_oppdatert[$i]['status_eco'] . "',"
+                               . " status_drift = '" . 
$leietaker_oppdatert[$i]['status_drift'] . "'"
+                               . " WHERE  id = '" . 
$leietaker_oppdatert[$i]['id'] . "'";
+
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db_boei->query($sql,__LINE__,__FILE__);
+                       }
+
+                       $this->db->transaction_commit();
+                       $this->db_boei->transaction_commit();
+
+                       $msg = $i . ' namssakstatus er oppdatert';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_utgaatt_objekt.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_utgaatt_objekt.php
                         (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_utgaatt_objekt.php
 2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,238 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class oppdater_utgaatt_objekt
+       {
+               var     $function_name = 'oppdater_utgaatt_objekt';
+
+               function __construct()
+               {
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->like                     = & $this->db->like;
+                       $this->join                     = & $this->db->join;
+                       $this->left_join                = & 
$this->db->left_join;
+                       $this->soadmin_location = 
CreateObject('property.soadmin_location');
+               }
+
+               function pre_run($data = array())
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Update the 
category to not active based on if there is only nonactive apartments'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = lang('Update the not active category 
for locations');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+                       $location_types = 
$this->soadmin_location->select_location_type();
+
+                       $m= count($location_types);
+
+
+                       $this->db->query("UPDATE fm_location" . $m. " set       
status= 2  WHERE category=99",__LINE__,__FILE__);
+
+                       for ($type_id=$m; $type_id>1; $type_id--)
+                       {
+                               $parent_table = 'fm_location' . ($type_id-1);
+
+                               $joinmethod .= " $this->join $parent_table";
+
+                               $paranthesis .='(';
+
+                               $on = 'ON';
+                               for ($i=($type_id-1); $i>0; $i--)
+                               {
+                                       $joinmethod .= " $on (fm_location" . 
($type_id) .".loc" . ($i). ' = '.$parent_table . ".loc" . ($i) . ")";
+                                       $on = 'AND';
+                                       if($i==1)
+                                       {
+                                               $joinmethod .= ")";
+                                       }
+                               }
+
+                               $sql = "SELECT $parent_table.location_code 
,count(*) as count_99  FROM $paranthesis fm_location$type_id $joinmethod where 
fm_location$type_id.status=2 group by $parent_table.location_code ";
+                               $this->db->query($sql,__LINE__,__FILE__);
+
+                               while ($this->db->next_record())
+                               {
+                                       
$outdated[$this->db->f('location_code')]['count_99']=$this->db->f('count_99');
+                               }
+
+                               $sql = "SELECT $parent_table.location_code 
,count(*) as count_all  FROM $paranthesis fm_location$type_id $joinmethod group 
by $parent_table.location_code ";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               while ($this->db->next_record())
+                               {
+                                       if( 
$outdated[$this->db->f('location_code')]['count_99']==$this->db->f('count_all'))
+                                       {
+                                               $update[]=array('location_code' 
=> $this->db->f('location_code'));
+                                       }
+                               }
+
+                               $metadata = 
$this->db->metadata('fm_location'.($type_id-1));
+
+                               $this->db->transaction_begin();
+
+                               $j=0;
+                               for ($i=0; $i<count($update); $i++)
+                               {
+                                       $sql = "SELECT category FROM 
$parent_table WHERE location_code= '" . $update[$i]['location_code'] ."'";
+
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                                       $this->db->next_record();
+
+                                       if($this->db->f('category')!=99)
+                                       {
+                                               $sql = "SELECT * from 
$parent_table WHERE location_code ='" . $update[$i]['location_code'] . "'";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                               $this->db->next_record();
+
+                                               foreach($metadata as $field => 
$val)
+                                               {
+                                                       $cols[] = $field;
+                                                       $vals[] = 
$this->db->f($field);
+                                               }
+
+                                               $cols[] = 'exp_date';
+                                               $vals[] = 
date($this->db->datetime_format(),time());
+
+                                               $cols   =implode(",", $cols);
+                                               $vals = 
$this->db->validate_insert($vals);
+
+                                               $sql = "INSERT INTO 
fm_location" . ($type_id-1) ."_history ($cols) VALUES ($vals)";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                               unset($cols);
+                                               unset($vals);
+
+                                               $j++;
+                                               $this->db->query("UPDATE 
fm_location" . ($type_id-1). " set     status= 2, category=99, change_type=2  
WHERE location_code= '" . $update[$i]['location_code'] ."'",__LINE__,__FILE__);
+                                               if($type_id == 2)
+                                               {
+                                                       
$this->db->query("UPDATE fm_location1 set kostra_id = NULL  WHERE 
location_code= '" . $update[$i]['location_code'] ."'",__LINE__,__FILE__);
+                                               }
+                                       }
+                               }
+
+                               
$this->receipt['message'][]=array('msg'=>lang('%1 location %2 has been updated 
to not active of %3 already not 
active',$j,$location_types[($type_id-2)]['descr'],count($update)));
+
+                               $log_msg .= lang('%1 location %2 has been 
updated to not active of %3 already not 
active',$j,$location_types[($type_id-2)]['descr'],count($update));
+                               unset($outdated);
+                               unset($update);
+                               unset($joinmethod);
+                               unset($paranthesis);
+                               unset($metadata);
+                               $this->db->transaction_commit();
+                       }
+
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->db->datetime_format()),
+                               $this->function_name,
+                               implode(',',(array_keys($msgbox_data)))
+                               );
+
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/oppdater_utgaatt_objekt.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,456 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class organize_drawing
+       {
+               /* In Admin->Property->Async servises:
+               *  Name: property.custom_functions.index
+               *  Data: function=organize_drawing,dir=C:/path/to/drawings
+               */
+
+               var     $dir = '/mnt/filer2/Tegninger';
+               var     $suffix = 'dwg';
+               var     $bypass = false; // bypass location check (only for 
debugging)
+               var     $function_name = 'organize_drawing';
+
+               function organize_drawing()
+               {
+               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->vfs              = CreateObject('phpgwapi.vfs');
+                       $this->rootdir          = $this->vfs->basedir;
+                       $this->fakebase         = $this->vfs->fakebase;
+                       $this->db               = $this->bocommon->new_db();
+
+               }
+
+               function pre_run($data='')
+               {
+
+                       if($data['enabled']==1)
+                       {
+                               $confirm                = true;
+                               $execute                = true;
+                               $cron                   = true;
+                               if($data['suffix'])
+                               {
+                                       $this->suffix = $data['suffix'];
+                               }
+                               if($data['dir'])
+                               {
+                                       $this->dir = $data['dir'];
+                               }
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                               if(phpgw::get_var('dir', 'string' ,'GET'))
+                               {
+                                       $this->dir = urldecode 
(phpgw::get_var('dir', 'string' ,'GET'));
+                               }
+                               if(phpgw::get_var('suffix', 'string', 'GET'))
+                               {
+                                       $this->suffix = 
phpgw::get_var('suffix', 'string', 'GET');
+                               }
+                       }
+
+                       if(!$execute)
+                       {
+                               $dry_run=true;
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($dry_run,$cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+               function confirm($execute='',$done='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      => $this->function_name,
+                               'execute'       => $execute,
+                               'dir'           => $this->dir,
+                               'suffix'        => $this->suffix,
+                       );
+
+                       if(!$done)
+                       {
+                               if(!$execute)
+                               {
+                                       $lang_confirm_msg       = 'Ga videre 
for aa se hva som blir lagt til';
+                               }
+                               else
+                               {
+                                       $lang_confirm_msg       = lang('do you 
want to perform this action');
+                               }
+                       }
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => 'Organisere 
tegninger i register og pa disk',
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = 'Organisere tegninger';
+                       $function_msg   = 'Organisere tegninger i register og 
pa disk';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($dry_run='',$cron='')
+               {
+
+                       $file_list = $this->get_files();
+
+                       if($dry_run)
+                       {
+                               $this->confirm($execute=true);
+                               _debug_array($file_list);
+                       }
+                       else
+                       {
+                               if (isSet($file_list) AND is_array($file_list))
+                               {
+                                       foreach($file_list as $file_entry)
+                                       {
+                                               $loc1_list[$file_entry['loc1']] 
= true;
+                                       }
+
+                                       $loc1_list = array_keys($loc1_list);
+
+                                       for ($i=0;$i<count($loc1_list);$i++)
+                                       {
+                                               
$this->create_loc1_dir($loc1_list[$i]);
+                                       }
+
+                                       for ($i=0;$i<count($file_list);$i++)
+                                       {
+                                               
$this->copy_files($file_list[$i]);
+                                       }
+                               }
+                               if(!$cron)
+                               {
+                                       
$this->confirm($execute=false,$done=true);
+                               }
+
+                               $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                               $insert_values= array(
+                                       $cron,
+                                       date($this->bocommon->datetimeformat),
+                                       $this->function_name,
+                                       implode(',',(array_keys($msgbox_data)))
+                                       );
+
+                               $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                               $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                               . "VALUES ($insert_values)";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                       }
+               }
+
+               function get_files()
+               {
+                       $drawing_branch=array(
+                       'a' => 'arkitekt'
+                       );
+
+                       $category=array(
+                       'plan' => 2,
+                       'snitt' => 3,
+                       'fasade' => 4
+                       );
+
+                       $branch_id_array=array(
+                       'arkitekt' => 13
+                       );
+
+                       $dir_handle = @opendir($this->dir);
+
+                       $i=0; $myfilearray = '';
+                       while ($file = @readdir($dir_handle))
+                       {
+                               if ((strtolower(substr($file, -3, 3)) == 
$this->suffix) && is_file($this->dir . '/' . $file) )
+                               {
+                                       $myfilearray[$i] = $file;
+                                       $i++;
+                               }
+                       }
+                       @closedir($dir_handle);
+                       @sort($myfilearray);
+
+                       for ($i=0;$i<count($myfilearray);$i++)
+                       {
+                               $fname = $myfilearray[$i];
+                               $loc1 = substr($myfilearray[$i],4,4);
+                               $loc2 = substr($myfilearray[$i],8,2);
+                               $etasje = '';
+                               $loc3 = '';
+                               $nr = '';
+                               $direction = '';
+
+                               $type = $this->get_type($myfilearray[$i]);
+                               switch($type)
+                               {
+                                       case 'plan':
+                                               $etasje = 
substr($myfilearray[$i],13,2);
+                                               $loc3 = 
substr($myfilearray[$i],10,2);
+                                               $location_code = $loc1 . '-' . 
$loc2 . '-' . $loc3;
+                                               break;
+                                       case 'snitt':
+                                               $location_code = $loc1 . '-' . 
$loc2;
+                                               $nr = 
substr($myfilearray[$i],-8,3);
+                                               break;
+                                       case 'fasade':
+                                               $location_code = $loc1 . '-' . 
$loc2;
+                                               $direction = 
substr($myfilearray[$i],11,2);
+                                               $nr = 
substr($myfilearray[$i],-8,3);
+                                               break;
+                               }
+
+
+                               $branch = 
$drawing_branch[strtolower(substr($myfilearray[$i],-5,1))];
+
+                               if ($this->check_building($loc1,$loc2) && $type 
&& $branch)
+                               {
+                                       $file_list[] = array
+                                       (
+                                               'file_name'     => $fname,
+                                               'loc1'          => $loc1,
+                                               'loc2'          => $loc2,
+                                               'loc3'          => $loc3,
+                                               'type'          => $type,
+                                               'nr'            => $nr,
+                                               'etasje'        => $etasje,
+                                               'branch'        => $branch,
+                                               'branch_id' => 
$branch_id_array[$branch],
+                                               'category_id'   => 
$category[$type],
+                                               'direction'     => $direction,
+                                               'location_code' => 
$location_code,
+                                       );
+                               }
+                       }
+
+                       return $file_list;
+               }
+
+
+               function get_type($filename='')
+               {
+                       $drawing_type=array(
+                       'p' => 'plan',
+                       'f' => 'fasade',
+                       's' => 'snitt'
+                       );
+
+                       for ($i=10;$i<strlen($filename);$i++)
+                       {
+                               $type = 
$drawing_type[strtolower(substr($filename,$i,1))];
+                               if($type)
+                               {
+                                       return $type;
+                               }
+                       }
+               }
+
+               function check_building($loc1='',$loc2='')
+               {
+                       $sql = "SELECT count(*)  FROM fm_location2 WHERE loc1= 
'$loc1' AND loc2= '$loc2'";
+
+//_debug_array($sql);
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       if($this->db->f(0))
+                       {
+                               return true;
+                       }
+
+                       if($this->bypass)
+                       {
+                               return true;
+                       }
+
+               }
+
+               function create_loc1_dir($loc1='')
+               {
+                       if(!$this->vfs->file_exists(array(
+                                       'string' => $this->fakebase . '/' . 
'document' . '/' . $loc1,
+                                       'relatives' => Array(RELATIVE_NONE)
+                               )))
+                       {
+                               $this->vfs->override_acl = 1;
+
+                               if(!$this->vfs->mkdir (array(
+                                    'string' => $this->fakebase. '/' . 
'document' . '/' . $loc1,
+                                    'relatives' => array(
+                                         RELATIVE_NONE
+                                    )
+                               )))
+                               {
+                                       
$this->receipt['error'][]=array('msg'=>lang('failed to create directory') . ' 
:'. $this->fakebase. '/' . 'document' . '/' . $loc1);
+                               }
+                               else
+                               {
+                                       
$this->receipt['message'][]=array('msg'=>lang('directory created') . ' :'. 
$this->fakebase. '/' . 'document' . '/' . $loc1);
+                               }
+                               $this->vfs->override_acl = 0;
+                       }
+
+//                     return $this->receipt;
+               }
+
+               function copy_files($values)
+               {
+                       $to_file = $this->fakebase . '/' . 'document' . '/' . 
$values['loc1'] . '/' . $values['file_name'];
+                       $from_file = $this->dir . '/' . $values['file_name'];
+                       $this->vfs->override_acl = 1;
+
+
+//_debug_array($to_file);
+                       if($this->vfs->file_exists(array(
+                                       'string' => $to_file,
+                                       'relatives' => Array(RELATIVE_NONE)
+                               )))
+                       {
+                               
$this->receipt['error'][]=array('msg'=>lang('File %1 already 
exists!',$values['file_name']));
+                       }
+                       else
+                       {
+
+                               if(!$this->vfs->cp (array (
+                                       'from'  => $from_file,
+                                       'to'    => $to_file,
+                                       'relatives'     => array 
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+                               {
+                                       
$this->receipt['error'][]=array('msg'=>lang('Failed to copy file !') . 
$values['file_name']);
+                               }
+                               else
+                               {
+                                       $address = 
$this->get_address($values['loc1'],$values['loc2'],$values['loc3']);
+
+                                       switch($values['type'])
+                                       {
+                                               case 'plan':
+                                                       $values['title'] = 
$this->db->db_addslashes($values['branch'] . ', ' .$values['type'] . ', etasje: 
' . $values['etasje']);
+                                                       break;
+                                               case 'snitt':
+                                                       $values['title'] = 
$this->db->db_addslashes($values['branch'] . ', ' . $values['type'] . ' nr: ' . 
$values['nr']);
+                                                       break;
+                                               case 'fasade':
+                                                       $values['title'] = 
$this->db->db_addslashes($values['branch'] . ', ' . $values['type'] . ' nr: ' . 
$values['nr'] . ' retning: ' . $values['direction']);
+                                                       break;
+                                       }
+
+                                       $insert_values= array(
+                                               $values['file_name'],
+                                               $values['title'],
+                                               'public',
+                                               $values['category_id'],
+                                               time(),
+                                               $values['values_date'],
+                                               $values['version'],
+                                               $values['coordinator'],
+                                               $values['status'],
+                                               $values['location_code'],
+                                               $address,
+                                               $values['branch_id'],
+                                               $values['vendor_id'],
+                                               $this->account,
+                                               $values['loc1'],
+                                               $values['loc2'],
+                                               $values['loc3'],
+                                               );
+
+                                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                                       $sql = "INSERT INTO fm_document 
(document_name,title,access,category,entry_date,document_date,version,coordinator,status,"
+                                               . 
"location_code,address,branch_id,vendor_id,user_id,loc1,loc2,loc3) "
+                                               . "VALUES ($insert_values)";
+
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+
+                                       unlink($from_file);
+
+                                       
$this->receipt['message'][]=array('msg'=>lang('File %1 
copied!',$values['file_name']));
+                                       
$this->receipt['message'][]=array('msg'=>lang('File %1 deleted!',$from_file));
+                               }
+                       }
+
+                       $this->vfs->override_acl = 0;
+//                     return $this->receipt;
+               }
+
+               function get_address($loc1='',$loc2='',$loc3='')
+               {
+                       if ($loc3)
+                       {
+                               $sql = "SELECT loc3_name as address FROM 
fm_location3 WHERE loc1='$loc1' AND loc2='$loc2' AND loc3='$loc3'";
+                       }
+                       else
+                       {
+                               $sql = "SELECT loc2_name as address FROM 
fm_location2 WHERE loc1='$loc1' AND loc2='$loc2'";
+                       }
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f('address');
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/organize_drawing.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/synkroniser_med_boei.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/synkroniser_med_boei.php
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/synkroniser_med_boei.php
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,952 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class synkroniser_med_boei
+       {
+               var     $function_name = 'synkroniser_med_boei';
+
+               function synkroniser_med_boei()
+               {
+               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db               = $this->bocommon->new_db();
+                       $this->join                             = 
$this->db->join;
+                       $this->like                             = 
$this->db->like;
+                       $this->left_join                = " LEFT JOIN ";
+
+                       if(isset($this->db->adodb) && $this->db->adodb)
+                       {
+                               $this->db_boei                  = 
CreateObject('phpgwapi.db',false,$GLOBALS['external_db']['boei']['db_type']);
+                               $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
+                               $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
+                               $this->db_boei->Database        = 
$GLOBALS['external_db']['boei']['db_name'];
+                               $this->db_boei->User            = 
$GLOBALS['external_db']['boei']['db_user'];
+                               $this->db_boei->Password        = 
$GLOBALS['external_db']['boei']['db_pass'];
+                               $this->db_boei->Halt_On_Error   = 'yes';
+                               $this->db_boei->connect();
+                       }
+                       else
+                       {
+                               $this->db_boei                  = 
CreateObject('property.db_mssql');
+                               $this->db_boei->Host            = 
$GLOBALS['external_db']['boei']['db_host'];
+                               $this->db_boei->Type            = 
$GLOBALS['external_db']['boei']['db_type'];
+                               $this->db_boei->Database        = 
$GLOBALS['external_db']['boei']['db_name'];
+                               $this->db_boei->User            = 
$GLOBALS['external_db']['boei']['db_user'];
+                               $this->db_boei->Password        = 
$GLOBALS['external_db']['boei']['db_pass'];
+                               $this->db_boei->Halt_On_Error   = 'yes';
+                       }
+
+                       $this->db_boei2 = clone($this->db_boei);
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Update the 
category to not active based on if there is only nonactive apartments'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = 'synkroniser med BOEI';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+                       set_time_limit(120);
+                       $receipt = $this->legg_til_eier_phpgw();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->legg_til_gateadresse_phpgw();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->legg_til_objekt_phpgw();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->legg_til_bygg_phpgw();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->legg_til_seksjon_phpgw();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->legg_til_leieobjekt_phpgw();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->legg_til_leietaker_phpgw();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->oppdater_leieobjekt();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->oppdater_boa_objekt();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->oppdater_boa_bygg();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->oppdater_boa_del();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->oppdater_oppsagtdato();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->slett_feil_telefon();
+                       $this->cron_log($receipt,$cron);
+                       $receipt = $this->update_tenant_name();
+                       $this->cron_log($receipt,$cron);
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+               function cron_log($receipt='',$cron='')
+               {
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               $receipt
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function legg_til_eier_phpgw()
+               {
+                       $sql = " SELECT TOP 100 PERCENT v_Eier.id, 
v_Eier.category"
+                               . " FROM  v_Eier";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+                       while ($this->db_boei->next_record())
+                       {
+                               if($this->db_boei->f('category')==0)
+                               {
+                                       $category = 4;
+                               }
+                               else
+                               {
+                                       $category = 
$this->db_boei->f('category');
+                               }
+                               $owner[]= array (
+                                'id'           => $this->db_boei->f('id'),
+                                'category'     => $category,
+                                );
+                       }
+       //              $this->db->transaction_begin();
+       //              $this->db_boei->transaction_begin();
+
+                       for ($i=0; $i<count($owner); $i++)
+                       {
+                               $sql2 = "UPDATE fm_owner set category = 
'{$owner[$i]['category']}' WHERE id = '{$owner[$i]['id']}'";
+
+                               $this->db->query($sql2,__LINE__,__FILE__);
+                               $this->db_boei->query($sql2,__LINE__,__FILE__);
+                       }
+
+                       unset($owner);
+
+                       $sql = "SELECT v_Eier.id, 
v_Eier.org_name,v_Eier.category FROM  fm_owner RIGHT OUTER JOIN "
+                               . " v_Eier ON fm_owner.id = v_Eier.id"
+                                       . " WHERE (fm_owner.id IS NULL)";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+                       while ($this->db_boei->next_record())
+                       {
+                               if($this->db_boei->f('category')==0)
+                               {
+                                       $category = 4;
+                               }
+                               else
+                               {
+                                       $category = 
$this->db_boei->f('category');
+                               }
+                               $owner_utf[]= array (
+                                'id'           => $this->db_boei->f('id'),
+                                'org_name'     => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
+                                'remark'       => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
+                                'category'     => $category,
+                                'entry_date'   => time(),
+                                'owner_id'             => 6
+                                );
+
+                               $owner_latin[]= array (
+                                'id'           => $this->db_boei->f('id'),
+                                'org_name'     => 
$this->db->db_addslashes($this->db_boei->f('org_name')),
+                                'remark'       => 
$this->db->db_addslashes($this->db_boei->f('org_name')),
+                                'category'     => $category,
+                                'entry_date'   => time(),
+                                'owner_id'             => 6
+                                );
+
+                       }
+
+                       for ($i=0; $i<count($owner_utf); $i++)
+                       {
+                               $sql2_utf = "INSERT INTO fm_owner 
(id,org_name,remark,category,entry_date,owner_id)"
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($owner_utf[$i]) . ")";
+
+                               $sql2_latin = "INSERT INTO fm_owner 
(id,org_name,remark,category,entry_date,owner_id)"
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($owner_latin[$i]) . ")";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+
+                               $owner_msg[]=$owner_utf[$i]['org_name'];
+                       }
+
+       //              $this->db->transaction_commit();
+       //              $this->db_boei->transaction_commit();
+
+                       $msg = count($owner) . ' eier er lagt til: ' . 
@implode(",", $owner_msg);
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       unset ($owner_utf);
+                       unset ($owner_latin);
+                       unset ($owner_msg);
+                       return $msg;
+
+               }
+
+
+
+               function legg_til_gateadresse_phpgw()
+               {
+                       $sql = "SELECT v_Gateadresse.gateadresse_id, 
v_Gateadresse.gatenavn FROM  fm_streetaddress RIGHT OUTER JOIN "
+                               . " v_Gateadresse ON fm_streetaddress.id = 
v_Gateadresse.gateadresse_id"
+                                       . " WHERE (fm_streetaddress.id IS 
NULL)";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+                       while ($this->db_boei->next_record())
+                       {
+                               $gate[]= array (
+                                'id'           => 
$this->db_boei->f('gateadresse_id'),
+                                'descr'        => $this->db_boei->f('gatenavn')
+                                );
+
+                       }
+                       $this->db->transaction_begin();
+                       $this->db_boei->transaction_begin();
+
+                       for ($i=0; $i<count($gate); $i++)
+                       {
+
+                               $sql = "DELETE from fm_streetaddress WHERE id = 
" . (int)$gate[$i]['id'];
+                               $sql2_latin = "INSERT INTO fm_streetaddress 
(id,descr)"
+                                       . " VALUES (" . $gate[$i]['id'] . ", 
'". $gate[$i]['descr']. "')";
+
+                               $sql2_utf = "INSERT INTO fm_streetaddress 
(id,descr)"
+                                       . " VALUES (" . $gate[$i]['id'] . ", 
'". utf8_encode($gate[$i]['descr']). "')";
+
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db_boei->query($sql,__LINE__,__FILE__);
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $gate_msg[]=utf8_encode($gate[$i]['descr']);
+                       }
+
+                       $this->db->transaction_commit();
+                       $this->db_boei->transaction_commit();
+
+                       $msg = count($gate) . ' gateadresser er lagt til: ' . 
@implode(",", $gate_msg);
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       unset ($gate);
+                       unset ($gate_msg);
+                       return $msg;
+
+               }
+
+               function legg_til_objekt_phpgw()
+               {
+                       $sql = "SELECT v_Objekt.objekt_id, v_Objekt.navn, 
v_Objekt.bydel_id, v_Objekt.eier_id,v_Objekt.tjenestested"
+                                       . " FROM fm_location1 RIGHT OUTER JOIN "
+                               . " v_Objekt ON fm_location1.loc1 = 
v_Objekt.objekt_id"
+                                       . " WHERE fm_location1.loc1 IS NULL";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+                       while ($this->db_boei->next_record())
+                       {
+                               $objekt_utf[]= array (
+                                'location_code'        => 
$this->db_boei->f('objekt_id'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc1_name'            => 
utf8_encode($this->db_boei->f('navn')),
+                                'part_of_town_id'      => 
$this->db_boei->f('bydel_id'),
+                                'owner_id'             => 
$this->db_boei->f('eier_id'),
+                                'kostra_id'            => 
$this->db_boei->f('tjenestested')
+                                );
+                               $objekt_latin[]= array (
+                                'location_code'        => 
$this->db_boei->f('objekt_id'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc1_name'            => 
$this->db_boei->f('navn'),
+                                'part_of_town_id'      => 
$this->db_boei->f('bydel_id'),
+                                'owner_id'             => 
$this->db_boei->f('eier_id'),
+                                'kostra_id'            => 
$this->db_boei->f('tjenestested')
+                                );
+
+                       }
+
+       //              $this->db->transaction_begin();
+       //              $this->db_boei->transaction_begin();
+
+                       for ($i=0; $i<count($objekt_latin); $i++)
+                       {
+
+                               $sql2_utf = "INSERT INTO fm_location1 
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id) "
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($objekt_utf[$i]) . ")";
+                               $sql2_latin = "INSERT INTO fm_location1 
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id) "
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($objekt_latin[$i]) . ")";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (1, 
'{$objekt_utf[$i]['location_code']}')",__LINE__,__FILE__);
+
+                               $obj_msg[]=$objekt_utf[$i]['loc1'];
+                       }
+
+       //              $this->db->transaction_commit();
+       //              $this->db_boei->transaction_commit();
+
+                       $msg = count($objekt_latin) . ' Objekt er lagt til: ' . 
@implode(",", $obj_msg);
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       unset ($objekt_utf);
+                       unset ($objekt_latin);
+                       unset ($obj_msg);
+                       return $msg;
+               }
+
+               function legg_til_bygg_phpgw()
+               {
+                       $sql = "SELECT v_Bygg.objekt_id + '-' + v_Bygg.bygg_id 
AS location_code, v_Bygg.objekt_id, v_Bygg.bygg_id, 
v_Bygg.byggnavn,v_Bygg.driftstatus"
+                               . " FROM v_Bygg LEFT OUTER JOIN"
+                       . " fm_location2 ON v_Bygg.objekt_id = 
fm_location2.loc1 AND v_Bygg.bygg_id = fm_location2.loc2"
+                       . " WHERE fm_location2.loc1 IS NULL";
+
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+                       while ($this->db_boei->next_record())
+                       {
+                               $bygg_utf[]= array (
+                                'location_code'        => 
$this->db_boei->f('location_code'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc2'                         => 
$this->db_boei->f('bygg_id'),
+                                'loc2_name'            => 
utf8_encode($this->db_boei->f('byggnavn')),
+                                );
+                               $bygg_latin[]= array (
+                                'location_code'        => 
$this->db_boei->f('location_code'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc2'                         => 
$this->db_boei->f('bygg_id'),
+                                'loc2_name'            => 
$this->db_boei->f('byggnavn'),
+                                );
+                       }
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei->transaction_begin();
+
+                       for ($i=0; $i<count($bygg_latin); $i++)
+                       {
+
+                               $sql2_utf = "INSERT INTO fm_location2 
(location_code, loc1, loc2, loc2_name) "
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($bygg_utf[$i]) . ")";
+                               $sql2_latin = "INSERT INTO fm_location2 
(location_code, loc1, loc2, loc2_name) "
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($bygg_latin[$i]) . ")";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (2, 
'{$bygg_utf[$i]['location_code']}')",__LINE__,__FILE__);
+
+                               $bygg_msg[]=$bygg_utf[$i]['location_code'];
+                       }
+
+               //      $this->db->transaction_commit();
+               //      $this->db_boei->transaction_commit();
+
+                       $msg = count($bygg_latin) . ' Bygg er lagt til: ' . 
@implode(",", $bygg_msg);
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       unset ($bygg_utf);
+                       unset ($bygg_latin);
+                       unset ($bygg_msg);
+                       return $msg;
+
+               }
+
+               function legg_til_seksjon_phpgw()
+               {
+
+                       $sql = "SELECT v_Seksjon.objekt_id + '-' + 
v_Seksjon.bygg_id + '-' + v_Seksjon.seksjons_id AS location_code, 
v_Seksjon.objekt_id, v_Seksjon.bygg_id,"
+                               . " v_Seksjon.seksjons_id, 
v_Seksjon.beskrivelse, v_Seksjon.totalt_fellesareal"
+                               . " FROM v_Seksjon LEFT OUTER JOIN"
+                               . " fm_location3 ON v_Seksjon.objekt_id = 
fm_location3.loc1 AND v_Seksjon.bygg_id = fm_location3.loc2 AND "
+                               . " v_Seksjon.seksjons_id = fm_location3.loc3"
+                               . " WHERE fm_location3.loc1 IS NULL";
+
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+                       while ($this->db_boei->next_record())
+                       {
+                               $seksjon_utf[]= array (
+                                'location_code'        => 
$this->db_boei->f('location_code'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc2'                         => 
$this->db_boei->f('bygg_id'),
+                                'loc3'                         => 
$this->db_boei->f('seksjons_id'),
+                                'loc3_name'            => 
utf8_encode($this->db_boei->f('beskrivelse')),
+                                'fellesareal'  => 
$this->db_boei->f('totalt_fellesareal')
+                                );
+                               $seksjon_latin[]= array (
+                                'location_code'        => 
$this->db_boei->f('location_code'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc2'                         => 
$this->db_boei->f('bygg_id'),
+                                'loc3'                         => 
$this->db_boei->f('seksjons_id'),
+                                'loc3_name'            => 
$this->db_boei->f('beskrivelse'),
+                                'fellesareal'  => 
$this->db_boei->f('totalt_fellesareal')
+                                );
+                       }
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei->transaction_begin();
+
+                       for ($i=0; $i<count($seksjon_latin); $i++)
+                       {
+
+                               $sql2_utf = "INSERT INTO fm_location3 
(location_code, loc1, loc2, loc3, loc3_name, fellesareal) "
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($seksjon_utf[$i]) . ")";
+                               $sql2_latin = "INSERT INTO fm_location3 
(location_code, loc1, loc2, loc3, loc3_name, fellesareal) "
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($seksjon_latin[$i]) . ")";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (3, 
'{$seksjon_utf[$i]['location_code']}')",__LINE__,__FILE__);
+
+                               
$seksjon_msg[]=$seksjon_utf[$i]['location_code'];
+                       }
+
+               //      $this->db->transaction_commit();
+               //      $this->db_boei->transaction_commit();
+
+                       $msg = count($seksjon_latin) . ' Seksjon er lagt til: ' 
. @implode(",", $seksjon_msg);
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       unset ($seksjon_utf);
+                       unset ($seksjon_latin);
+                       unset ($seksjon_msg);
+                       return $msg;
+               }
+
+               function legg_til_leieobjekt_phpgw()
+               {
+
+                       $sql = "SELECT v_Leieobjekt.objekt_id + '-' + 
v_Leieobjekt.bygg_id + '-' + v_Leieobjekt.seksjons_id + '-' + 
v_Leieobjekt.leie_id AS location_code,"
+                  . " v_Leieobjekt.objekt_id, v_Leieobjekt.leie_id, 
v_Leieobjekt.leieobjekttype_id, v_Leieobjekt.bygg_id, v_Leieobjekt.seksjons_id,"
+                  . " v_Leieobjekt.formaal_id, v_Leieobjekt.gateadresse_id, 
v_Leieobjekt.gatenr, v_Leieobjekt.etasje, v_Leieobjekt.antallrom,"
+                  . " v_Leieobjekt.boareal, v_Leieobjekt.livslopsstd, 
v_Leieobjekt.heis, v_Leieobjekt.driftsstatus_id, v_Leieobjekt.leietaker_id,"
+                  . " v_Leieobjekt.beregnet_boa, v_Leieobjekt.flyttenr"
+                  . " FROM v_Leieobjekt LEFT OUTER JOIN"
+                  . " fm_location4 ON v_Leieobjekt.objekt_id = 
fm_location4.loc1 AND v_Leieobjekt.leie_id = fm_location4.loc4"
+                  . " WHERE fm_location4.loc1 IS NULL";
+
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db_boei->next_record())
+                       {
+                               $leieobjekt_utf[]= array (
+                                'location_code'        => 
$this->db_boei->f('location_code'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc4'                         => 
$this->db_boei->f('leie_id'),
+                                'leieobjekttype_id'=> 
$this->db_boei->f('leieobjekttype_id'),
+                                'loc2'                         => 
$this->db_boei->f('bygg_id'),
+                                'loc3'                         => 
$this->db_boei->f('seksjons_id'),
+                                'category'             => 
$this->db_boei->f('formaal_id'),
+                                'street_id'            => 
$this->db_boei->f('gateadresse_id'),
+                                'street_number'        => 
utf8_encode($this->db_boei->f('gatenr')),
+                                'etasje'                       => 
utf8_encode($this->db_boei->f('etasje')),
+                                'antallrom'            => 
$this->db_boei->f('antallrom'),
+                                'boareal'                      => 
$this->db_boei->f('boareal'),
+                                'livslopsstd'          => 
$this->db_boei->f('livslopsstd'),
+                                'heis'                         => 
$this->db_boei->f('heis'),
+                                'driftsstatus_id'      => 
$this->db_boei->f('driftsstatus_id'),
+                                'tenant_id'            => 
$this->db_boei->f('leietaker_id'),
+                                'beregnet_boa'         => 
$this->db_boei->f('beregnet_boa'),
+                                'flyttenr'             => 
$this->db_boei->f('flyttenr')
+                                );
+                               $leieobjekt_latin[]= array (
+                                'location_code'        => 
$this->db_boei->f('location_code'),
+                                'loc1'                         => 
$this->db_boei->f('objekt_id'),
+                                'loc4'                         => 
$this->db_boei->f('leie_id'),
+                                'leieobjekttype_id'=> 
$this->db_boei->f('leieobjekttype_id'),
+                                'loc2'                         => 
$this->db_boei->f('bygg_id'),
+                                'loc3'                         => 
$this->db_boei->f('seksjons_id'),
+                                'category'             => 
$this->db_boei->f('formaal_id'),
+                                'street_id'            => 
$this->db_boei->f('gateadresse_id'),
+                                'street_number'        => 
$this->db_boei->f('gatenr'),
+                                'etasje'                       => 
$this->db_boei->f('etasje'),
+                                'antallrom'            => 
$this->db_boei->f('antallrom'),
+                                'boareal'                      => 
$this->db_boei->f('boareal'),
+                                'livslopsstd'          => 
$this->db_boei->f('livslopsstd'),
+                                'heis'                         => 
$this->db_boei->f('heis'),
+                                'driftsstatus_id'      => 
$this->db_boei->f('driftsstatus_id'),
+                                'tenant_id'            => 
$this->db_boei->f('leietaker_id'),
+                                'beregnet_boa'         => 
$this->db_boei->f('beregnet_boa'),
+                                'flyttenr'             => 
$this->db_boei->f('flyttenr')
+                                );
+
+                       }
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei->transaction_begin();
+
+                       for ($i=0; $i<count($leieobjekt_latin); $i++)
+                       {
+
+                               $sql2_utf = "INSERT INTO fm_location4 
(location_code, loc1, loc4, leieobjekttype_id, loc2, loc3, category, street_id, 
street_number, etasje, antallrom, boareal, livslopsstd, heis, driftsstatus_id,
+                      tenant_id, beregnet_boa, flyttenr)"
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leieobjekt_utf[$i]) . ")";
+                               $sql2_latin = "INSERT INTO fm_location4 
(location_code, loc1, loc4, leieobjekttype_id, loc2, loc3, category, street_id, 
street_number, etasje, antallrom, boareal, livslopsstd, heis, driftsstatus_id,
+                      tenant_id, beregnet_boa, flyttenr)"
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leieobjekt_latin[$i]) . ")";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO fm_locations 
(level, location_code) VALUES (4, 
'{$leieobjekt_utf[$i]['location_code']}')",__LINE__,__FILE__);
+
+                               
$leieobjekt_msg[]=$leieobjekt_utf[$i]['location_code'];
+                       }
+
+               //      $this->db->transaction_commit();
+               //      $this->db_boei->transaction_commit();
+
+                       $msg = count($leieobjekt_latin) . ' Leieobjekt er lagt 
til: ' . @implode(",", $leieobjekt_msg);
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       unset ($leieobjekt_latin);
+                       unset ($leieobjekt_utf);
+                       unset ($leieobjekt_msg);
+                       return $msg;
+               }
+
+               function legg_til_leietaker_phpgw()
+               {
+                       $sql = " SELECT v_Leietaker.leietaker_id, 
v_Leietaker.fornavn, v_Leietaker.etternavn, v_Leietaker.kjonn_juridisk,"
+                               . " v_Leietaker.namssakstatusokonomi_id, 
v_Leietaker.namssakstatusdrift_id"
+                               . " FROM fm_tenant RIGHT OUTER JOIN"
+                               . " v_Leietaker ON fm_tenant.id = 
v_Leietaker.leietaker_id"
+                               . " WHERE fm_tenant.id IS NULL";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db_boei->next_record())
+                       {
+                               $leietaker_utf[]= array (
+                                'id'                           => 
$this->db_boei->f('leietaker_id'),
+                                'first_name'           => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('fornavn'))),
+                                'last_name'            => 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('etternavn'))),
+                                'category'                     => 
$this->db_boei->f('kjonn_juridisk') + 1,
+                                'status_eco'           => 
$this->db_boei->f('namssakstatusokonomi_id'),
+                                'status_drift'         => 
$this->db_boei->f('namssakstatusdrift_id'),
+                                'entry_date'           => time(),
+                                'owner_id'                     => 6
+                                );
+                               $leietaker_latin[]= array (
+                                'id'                           => 
$this->db_boei->f('leietaker_id'),
+                                'first_name'           => 
$this->db->db_addslashes($this->db_boei->f('fornavn')),
+                                'last_name'            => 
$this->db->db_addslashes($this->db_boei->f('etternavn')),
+                                'category'                     => 
$this->db_boei->f('kjonn_juridisk') + 1,
+                                'status_eco'           => 
$this->db_boei->f('namssakstatusokonomi_id'),
+                                'status_drift'         => 
$this->db_boei->f('namssakstatusdrift_id'),
+                                'entry_date'           => time(),
+                                'owner_id'                     => 6
+                                );
+                       }
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei->transaction_begin();
+
+                       for ($i=0; $i<count($leietaker_latin); $i++)
+                       {
+                               $this->db->query("DELETE FROM fm_tenant WHERE 
id=" . (int)$leietaker_latin[$i]['id'],__LINE__,__FILE__);
+                               $this->db_boei->query("DELETE FROM fm_tenant 
WHERE id=" . (int)$leietaker_latin[$i]['id'],__LINE__,__FILE__);
+
+                               $sql2_utf = "INSERT INTO fm_tenant (id, 
first_name, last_name, category, status_eco, status_drift,entry_date,owner_id)"
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leietaker_utf[$i]) . ")";
+                               $sql2_latin = "INSERT INTO fm_tenant (id, 
first_name, last_name, category, status_eco, status_drift,entry_date,owner_id)"
+                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leietaker_latin[$i]) . ")";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+
+                               $leietaker_msg[]= '[' 
.$leietaker_utf[$i]['last_name'] . ', ' . $leietaker_utf[$i]['first_name'] . 
']';
+                       }
+
+               //      $this->db->transaction_commit();
+               //      $this->db_boei->transaction_commit();
+
+                       $msg = count($leietaker_latin) . ' Leietaker er lagt 
til: ' . @implode(",", $leietaker_msg);
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       unset ($leietaker);
+                       unset ($leietaker_msg);
+                       return $msg;
+
+               }
+
+               function update_tenant_name()
+               {
+                       $sql = " SELECT leietaker_id, fornavn, etternavn FROM 
v_Leietaker";
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+                       $i=0;
+                       while ($this->db_boei->next_record())
+                       {
+                               $sql2_utf = " UPDATE  fm_tenant SET "
+                               . " first_name          = '" . 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('fornavn'))) . "',"
+                               . " last_name           = '" . 
$this->db->db_addslashes(utf8_encode($this->db_boei->f('etternavn'))) ."'"
+                               . " WHERE  id = " . 
(int)$this->db_boei->f('leietaker_id');
+
+                               $sql2_latin = " UPDATE  fm_tenant SET "
+                               . " first_name          = '" . 
$this->db->db_addslashes($this->db_boei->f('fornavn')) . "',"
+                               . " last_name           = '" . 
$this->db->db_addslashes($this->db_boei->f('etternavn')) ."'"
+                               . " WHERE  id = " . 
(int)$this->db_boei->f('leietaker_id');
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+                               $i++;
+                       }
+
+                       $msg = $i . ' Leietakere er oppdatert';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+               }
+
+
+               function oppdater_leieobjekt()
+               {
+                       $sql = " SELECT TOP 100 PERCENT 
v_Leieobjekt.objekt_id,v_Leieobjekt.leie_id,v_Leieobjekt.leietaker_id, boareal, 
formaal_id, gateadresse_id, gatenr, etasje,driftsstatus_id, 
v_Leieobjekt.flyttenr, innflyttetdato"
+                               . " FROM  v_Leieobjekt JOIN v_reskontro ON 
v_Leieobjekt.objekt_id=v_reskontro.objekt_id AND 
v_Leieobjekt.leie_id=v_reskontro.leie_id"
+                               . " AND 
v_Leieobjekt.flyttenr=v_reskontro.flyttenr AND 
v_Leieobjekt.leietaker_id=v_reskontro.leietaker_id";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei2->transaction_begin();
+
+
+                       $i=0;
+                       while ($this->db_boei->next_record())
+                       {
+                               $sql2_utf = " UPDATE  fm_location4 SET "
+                               . " tenant_id = '" . 
$this->db_boei->f('leietaker_id') . "',"
+                               . " category = '" . 
$this->db_boei->f('formaal_id') . "',"
+                               . " etasje = '" . 
utf8_encode($this->db_boei->f('etasje')) . "',"
+                               . " street_id = '" . 
$this->db_boei->f('gateadresse_id') . "',"
+                               . " street_number = '" . 
utf8_encode($this->db_boei->f('gatenr')) . "',"
+                               . " driftsstatus_id = '" . 
$this->db_boei->f('driftsstatus_id') . "',"
+                               . " boareal = '" . $this->db_boei->f('boareal') 
. "',"
+                               . " flyttenr = '" . 
$this->db_boei->f('flyttenr') . "',"
+                               . " innflyttetdato = '" . 
date($this->bocommon->dateformat,strtotime($this->db_boei->f('innflyttetdato')))
 . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc4= '" . 
$this->db_boei->f('leie_id') . "'";
+                               $sql2_latin = " UPDATE  fm_location4 SET "
+                               . " tenant_id = '" . 
$this->db_boei->f('leietaker_id') . "',"
+                               . " category = '" . 
$this->db_boei->f('formaal_id') . "',"
+                               . " etasje = '" . $this->db_boei->f('etasje') . 
"',"
+                               . " street_id = '" . 
$this->db_boei->f('gateadresse_id') . "',"
+                               . " street_number = '" . 
$this->db_boei->f('gatenr') . "',"
+                               . " driftsstatus_id = '" . 
$this->db_boei->f('driftsstatus_id') . "',"
+                               . " boareal = '" . $this->db_boei->f('boareal') 
. "',"
+                               . " flyttenr = '" . 
$this->db_boei->f('flyttenr') . "',"
+                               . " innflyttetdato = '" . 
date($this->bocommon->dateformat,strtotime($this->db_boei->f('innflyttetdato')))
 . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc4= '" . 
$this->db_boei->f('leie_id') . "'";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+                               $i++;
+                       }
+
+               //      $this->db->transaction_commit();
+               //      $this->db_boei2->transaction_commit();
+
+                       $msg = $i . ' Leieobjekt er oppdatert';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+
+               }
+
+               function oppdater_boa_objekt()
+               {
+
+                       $sql = " SELECT TOP 100 PERCENT 
sum(v_Leieobjekt.boareal) as sum_boa, count(leie_id) as ant_leieobjekt,"
+                                       . " 
v_Objekt.objekt_id,bydel_id,tjenestested,navn,v_Objekt.eier_id FROM  v_Objekt 
$this->join v_Leieobjekt ON v_Objekt.objekt_id = v_Leieobjekt.objekt_id"
+                                       . " WHERE v_Leieobjekt.formaal_id NOT 
IN (99)"
+                                       . " GROUP BY 
bydel_id,v_Objekt.objekt_id,navn,tjenestested,eier_id";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei2->transaction_begin();
+
+                       $i=0;
+                       while ($this->db_boei->next_record())
+                       {
+                               $sql2_utf = " UPDATE fm_location1 SET "
+                               . " loc1_name = '" . 
utf8_encode($this->db_boei->f('navn')) . "',"
+                               . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
+                               . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "',"
+                               . " part_of_town_id = '" . 
$this->db_boei->f('bydel_id') . "',"
+                               . " owner_id = '" . 
$this->db_boei->f('eier_id') . "',"
+                               . " kostra_id = '" . 
$this->db_boei->f('tjenestested') . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'";
+                               $sql2_latin = " UPDATE fm_location1 SET "
+                               . " loc1_name = '" . $this->db_boei->f('navn') 
. "',"
+                               . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
+                               . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "',"
+                               . " part_of_town_id = '" . 
$this->db_boei->f('bydel_id') . "',"
+                               . " owner_id = '" . 
$this->db_boei->f('eier_id') . "',"
+                               . " kostra_id = '" . 
$this->db_boei->f('tjenestested') . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+                               $i++;
+                       }
+               //      $this->db->transaction_commit();
+               //      $this->db_boei2->transaction_commit();
+
+                       $msg = $i . ' Objekt er oppdatert';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+
+
+               }
+
+               function oppdater_boa_bygg()
+               {
+                       $sql = " SELECT TOP 100 PERCENT 
sum(v_Leieobjekt.boareal) as sum_boa, count(leie_id) as ant_leieobjekt,"
+                                       . " v_Bygg.objekt_id,v_Bygg.bygg_id , 
byggnavn  FROM  v_Bygg $this->join v_Leieobjekt "
+                                       . " ON v_Bygg.objekt_id = 
v_Leieobjekt.objekt_id AND v_Bygg.bygg_id = v_Leieobjekt.bygg_id"
+                                       . " WHERE v_Leieobjekt.formaal_id NOT 
IN (99)"
+                                       . " GROUP BY 
v_Bygg.objekt_id,v_Bygg.bygg_id ,byggnavn";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei2->transaction_begin();
+
+                       $i=0;
+                       while ($this->db_boei->next_record())
+                       {
+                               $sql2_utf = " UPDATE fm_location2 SET "
+                               . " loc2_name = '" . 
utf8_encode($this->db_boei->f('byggnavn')) . "',"
+                               . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
+                               . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'";
+                               $sql2_latin = " UPDATE fm_location2 SET "
+                               . " loc2_name = '" . 
$this->db_boei->f('byggnavn') . "',"
+                               . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
+                               . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+                               $i++;
+                       }
+               //      $this->db->transaction_commit();
+               //      $this->db_boei2->transaction_commit();
+
+                       $msg = $i . ' Bygg er oppdatert';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+               }
+
+               function oppdater_boa_del()
+               {
+
+                       $sql = " SELECT TOP 100 PERCENT 
sum(v_Leieobjekt.boareal) as sum_boa, count(leie_id) as ant_leieobjekt,"
+                                       . " 
v_Seksjon.objekt_id,v_Seksjon.bygg_id,v_Seksjon.seksjons_id , beskrivelse   
FROM  v_Seksjon $this->join v_Leieobjekt "
+                                       . " ON v_Seksjon.objekt_id = 
v_Leieobjekt.objekt_id"
+                                       . " AND v_Seksjon.bygg_id = 
v_Leieobjekt.bygg_id"
+                                       . " AND v_Seksjon.seksjons_id = 
v_Leieobjekt.seksjons_id"
+                                       . " WHERE v_Leieobjekt.formaal_id NOT 
IN (99)"
+                                       . " GROUP BY 
v_Seksjon.objekt_id,v_Seksjon.bygg_id,v_Seksjon.seksjons_id,beskrivelse";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+                       $i=0;
+
+               //      $this->db->transaction_begin();
+               //      $this->db_boei2->transaction_begin();
+
+                       while ($this->db_boei->next_record())
+                       {
+                               $sql2_utf = " UPDATE fm_location3 SET "
+                               . " loc3_name = '" . 
utf8_encode($this->db_boei->f('beskrivelse')) . "',"
+                               . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
+                               . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'  AND  loc3= '" . 
$this->db_boei->f('seksjons_id') . "'";
+                               $sql2_latin = " UPDATE fm_location3 SET "
+                               . " loc3_name = '" . 
$this->db_boei->f('beskrivelse') . "',"
+                               . " sum_boa = '" . $this->db_boei->f('sum_boa') 
. "',"
+                               . " ant_leieobjekt = '" . 
$this->db_boei->f('ant_leieobjekt') . "'"
+                               . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc2= '" . 
$this->db_boei->f('bygg_id') . "'  AND  loc3= '" . 
$this->db_boei->f('seksjons_id') . "'";
+
+                               $this->db->query($sql2_utf,__LINE__,__FILE__);
+                               
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+                               $i++;
+                       }
+               //      $this->db->transaction_commit();
+               //      $this->db_boei2->transaction_commit();
+
+                       $msg = $i . ' Seksjoner er oppdatert';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+               }
+
+               function oppdater_oppsagtdato()
+               {
+
+                       $sql = "SELECT TOP 100 PERCENT fm_tenant.id"
+                                       . " FROM  fm_tenant LEFT OUTER JOIN"
+                    . " v_Leietaker ON fm_tenant.id = v_Leietaker.leietaker_id 
AND "
+                    . " fm_tenant.oppsagtdato = v_Leietaker.oppsagtdato"
+                                       . " WHERE (v_Leietaker.leietaker_id IS 
NULL)";
+
+                       $this->db_boei->query($sql,__LINE__,__FILE__);
+
+       //              $this->db->transaction_begin();
+       //              $this->db_boei->transaction_begin();
+
+                       while ($this->db_boei->next_record())
+                       {
+                               $leietaker[]= $this->db_boei->f('id');
+                       }
+
+                       for ($i=0; $i<count($leietaker); $i++)
+                       {
+                               $sql = "SELECT oppsagtdato"
+                                       . " FROM  v_Leietaker"
+                                       . " WHERE (v_Leietaker.leietaker_id = 
'" . $leietaker[$i] . "')";
+
+                               $this->db_boei->query($sql,__LINE__,__FILE__);
+
+                               $this->db_boei->next_record();
+                               $leietaker_oppdatert[]= array (
+                                'id'                           => 
$leietaker[$i],
+                                'oppsagtdato'          => 
$this->db_boei->f('oppsagtdato')
+                                );
+
+                       }
+
+                       for ($i=0; $i<count($leietaker_oppdatert); $i++)
+                       {
+                               $sql = " UPDATE fm_tenant SET "
+                               . " oppsagtdato = '" . 
$leietaker_oppdatert[$i]['oppsagtdato'] . "'"
+                               . " WHERE  id = '" . 
$leietaker_oppdatert[$i]['id'] . "'";
+
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db_boei->query($sql,__LINE__,__FILE__);
+                       }
+
+               //      $this->db->transaction_commit();
+               //      $this->db_boei->transaction_commit();
+
+                       $msg = $i . ' oppsagtdato er oppdatert';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+
+               }
+
+
+               function slett_feil_telefon()
+               {
+                       $sql = "SELECT count(contact_phone) as ant_tlf from 
fm_tenant WHERE id > 99999 OR id = 0";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $this->db->next_record();
+
+                       $ant_tlf = $this->db->f('ant_tlf');
+
+                       $sql = "UPDATE fm_tenant SET contact_phone = NULL WHERE 
id > 99999 OR id = 0";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $msg = $ant_tlf . ' Telefon nr er slettet';
+                       $this->receipt['message'][]=array('msg'=> $msg);
+                       return $msg;
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/synkroniser_med_boei.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,159 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class update_googlemap
+       {
+               var     $function_name = 'update_googlemap';
+
+               function update_googlemap()
+               {
+               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db                               = 
$this->bocommon->new_db();
+                       $this->db2                              = 
$this->bocommon->new_db($this->db);
+
+                       $this->join                             = 
$this->db->join;
+                       $this->like                             = 
$this->db->like;
+                       $this->left_join                = " LEFT JOIN ";
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Export info as 
files'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = lang('Export info as files');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+                       $this->update_location4();
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               implode(',',(array_keys($msgbox_data)))
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function update_location4()
+               {
+                       $fieldname = 'googlemap';
+                       $area = "Bergen";
+                       $sql = "SELECT 
fm_location4.location_code,fm_location4.loc1,fm_location4.loc2,fm_location4.loc3,fm_location4.loc4,"
+                        . " fm_location1.loc1_name,fm_tenant.id as 
tenant_id,fm_tenant.last_name,fm_tenant.first_name,fm_tenant.contact_phone,fm_streetaddress.descr
 as 
street_name,street_number,fm_location4.street_id,fm_location4.etasje,fm_location4.antallrom,fm_location4.boareal"
+                        . " FROM ((((((( fm_location4 JOIN fm_location3 ON 
(fm_location4.loc3 = fm_location3.loc3) AND (fm_location4.loc2 = 
fm_location3.loc2) AND (fm_location4.loc1 = fm_location3.loc1)) JOIN 
fm_location2 ON (fm_location3.loc2 = fm_location2.loc2) AND (fm_location3.loc1 
= fm_location2.loc1)) JOIN fm_location1 ON (fm_location2.loc1 = 
fm_location1.loc1)) JOIN fm_owner ON ( fm_location1.owner_id=fm_owner.id)) JOIN 
fm_part_of_town ON ( 
fm_location1.part_of_town_id=fm_part_of_town.part_of_town_id)) JOIN 
fm_streetaddress ON ( fm_location4.street_id=fm_streetaddress.id)) JOIN 
fm_tenant ON ( fm_location4.tenant_id=fm_tenant.id)) WHERE 
(fm_location4.category !=99 OR fm_location4.category IS NULL) AND 
driftsstatus_id > 0 ";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $sql2 = "UPDATE fm_location4 SET $fieldname 
='http://maps.google.no/maps?&q=$area,"; . $this->db->f('street_name'). ',' . 
$this->db->f('street_number') ."' WHERE location_code = '" . 
$this->db->f('location_code') . "'";
+//_debug_array($sql2);
+                               $this->db2->query($sql2,__LINE__,__FILE__);
+                       }
+               }
+       }
+
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/update_googlemap.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/cron/default/update_phpgw.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/cron/default/update_phpgw.php    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/cron/default/update_phpgw.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,161 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * usage:
+        * @package property
+        */
+
+       class update_phpgw
+       {
+               var     $function_name = 'update_phpgw';
+
+               function update_phpgw()
+               {
+               //      $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
+               }
+
+               function pre_run($data='')
+               {
+                       if(isset($data['enabled']) && $data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                               $cron = false;
+                       }
+
+
+                       if (isset($confirm) && $confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      => $this->function_name,
+                               'execute'       => $execute,
+                       );
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('Do you want to 
execute this action?');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+                       $msgbox_data = 
isset($this->receipt)?$this->bocommon->msgbox_data($this->receipt):'';
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
isset($this->receipt['message'])?$this->receipt['message']:'',
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Update 
database for all applications'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
lang('cancel'),
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('Async service');
+                       $function_msg   = 'Forward email as SMS';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+                       $this->perform_update_db();
+
+                       if(isset($this->receipt) && $this->receipt)
+                       {
+                               $this->cron_log($this->receipt,$cron);
+                       }
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+               function cron_log($receipt='',$cron='')
+               {
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               $receipt
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function perform_update_db()
+               {
+                       $GLOBALS['phpgw_setup'] = 
CreateObject('phpgwapi.setup', true, true);
+                       $setup_info = 
$GLOBALS['phpgw_setup']->detection->get_versions();
+                       $GLOBALS['phpgw_setup']->db = 
CreateObject('phpgwapi.db');
+                       $GLOBALS['phpgw_info']['setup']['stage']['db'] = 
$GLOBALS['phpgw_setup']->detection->check_db();
+                       $setup_info = 
$GLOBALS['phpgw_setup']->detection->get_db_versions($setup_info);
+                       $setup_info = 
$GLOBALS['phpgw_setup']->detection->compare_versions($setup_info);
+                       $setup_info = 
$GLOBALS['phpgw_setup']->detection->check_depends($setup_info);
+                       ksort($setup_info);
+                       $clear_cache = '';
+                       foreach($setup_info as $app => $appinfo)
+                       {
+                               if(isset($appinfo['status']) && 
$appinfo['status']=='U' && isset($appinfo['currentver']) && 
$appinfo['currentver'])
+                               {
+                                       $terror = array();
+                                       $terror[] = 
$setup_info[$appinfo['name']];
+                                       
$GLOBALS['phpgw_setup']->process->upgrade($terror,false);
+                                       
$GLOBALS['phpgw_setup']->process->upgrade_langs($terror,false);
+                                       
$this->receipt['message'][]=array('msg'=> 'Upgraded application: ' . 
$appinfo['name']);
+                                       if($appinfo['name']=='property')
+                                       {
+                                               $clear_cache = true;
+                                       }
+                               }
+                       }
+                       if($clear_cache)
+                       {
+                               $this->db->query('DELETE FROM fm_cache');
+                       }
+               }
+       }
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/update_phpgw.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/cron/default/update_workorder_status.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/cron/default/update_workorder_status.php
                         (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/cron/default/update_workorder_status.php
 2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,194 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage custom
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class update_workorder_status
+       {
+               var     $function_name = 'update_workorder_status';
+
+               function update_workorder_status()
+               {
+               //      $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db                               = 
clone($GLOBALS['phpgw']->db);
+                       $this->date                             =  
1220245200;// unix timestamp 1. Sept 2008
+               }
+
+               function pre_run($data='')
+               {
+                       if($data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction' => 
'property.custom_functions.index',
+                               'function'      =>$this->function_name,
+                               'execute'       => $execute,
+                       );
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php'),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => lang('Export info as 
files'),
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $dateformat             = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $function_msg   = lang('close workorders older than 
%1', $GLOBALS['phpgw']->common->show_date($this->date,$dateformat));
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function execute($cron='')
+               {
+                       $this->update_status();
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+
+                       $insert_values= array(
+                               $cron,
+                               date($this->bocommon->datetimeformat),
+                               $this->function_name,
+                               implode(',',(array_keys($msgbox_data)))
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function update_status()
+               {
+                       set_time_limit(0);
+                       $sql = "SELECT id,status from fm_workorder WHERE 
entry_date < {$this->date} AND status !='closed'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $workorders = array();
+                       while ($this->db->next_record())
+                       {
+                               $workorders[] = array
+                               (
+                                       'id'            => $this->db->f('id'),
+                                       'status'        => 
$this->db->f('status')
+                               );
+                       }
+                       $sql = "SELECT id,status from fm_project WHERE 
entry_date < {$this->date} AND status !='closed'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $projects = array();
+                       while ($this->db->next_record())
+                       {
+                               $projects[] = array
+                               (
+                                       'id'            => $this->db->f('id'),
+                                       'status'        => 
$this->db->f('status')
+                               );
+                       }
+
+                       $GLOBALS['phpgw']->db->transaction_begin();
+                       
+                       $historylog     = 
CreateObject('property.historylog','workorder');
+                       foreach ($workorders as $workorder)
+                       {
+                               $historylog->add('S',$workorder['id'], 
'closed');       
+                       }
+
+                       unset($historylog);
+
+                       $historylog     = 
CreateObject('property.historylog','project');
+                       foreach ($projects as $project)
+                       {
+                               $historylog->add('S',$project['id'], 'closed'); 
+                       }
+
+                       if($GLOBALS['phpgw']->db->transaction_commit())
+                       {
+                               $this->db->transaction_begin();
+
+                               $sql = "UPDATE fm_workorder SET status = 
'closed' WHERE entry_date < {$this->date} AND status !='closed'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+
+                               $sql = "UPDATE fm_project SET status = 'closed' 
WHERE entry_date < {$this->date} AND status !='closed'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+               
+                               $this->db->transaction_commit();                
        
+                       }
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/cron/default/update_workorder_status.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/custom/README
===================================================================
--- people/sigurdne/modules/property/trunk/inc/custom/README                    
        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/custom/README    2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1 @@
+The custom functions are separated by the phpgw_domain - for mulitple domains 
- one has to create one catalog for each domain.

Added: 
people/sigurdne/modules/property/trunk/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
                                (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
        2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,29 @@
+<?php
+       if($ticket['cat_id'] == 4)
+       {
+               $db = $this->bocommon->new_db();
+
+               if(!$id)
+               {
+                       $id = $receipt['id'];
+               }
+
+               $db->query("SELECT * FROM fm_tts_tickets WHERE 
id='$id'",__LINE__,__FILE__);
+               $db->next_record();
+               if($db->f('finnish_date2'))
+               {
+                       $finnish_date = $db->f('finnish_date2');
+               }
+               else
+               {
+                       $finnish_date = $db->f('finnish_date');
+               }
+
+               $location_code = $db->f('location_code');
+
+               if($finnish_date >0)
+               {
+                       $finnish_date = 
date($this->bocommon->dateformat,$finnish_date);
+                       $db->query("UPDATE fm_location4 set finnish_date = 
'$finnish_date' WHERE location_code='$location_code'",__LINE__,__FILE__);
+               }
+       }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
                             (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
     2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,84 @@
+<?php
+
+//_debug_array($values);
+//_debug_array($values_attribute);
+//_debug_array($action);
+
+               // this routine will only work with the exact configuration of 
Bergen Bolig og Byfornyelse - but can serve as an example
+
+               $this->db               = & $GLOBALS['phpgw']->db;
+
+               //'property'    = $GLOBALS['phpgw_info']['flags']['currentapp'];
+
+               $sql = "SELECT ext_meter_id as maaler_nr FROM fm_entity_1_11 
WHERE location_code='" . $values['location_code'] . "'";
+               $this->db->query($sql,__LINE__,__FILE__);
+               $this->db->next_record();
+               $maaler_nr = $this->db->f('maaler_nr');
+
+               if(!$values_attribute)
+               {
+                       if ($maaler_nr)
+                       {
+                               $sql = "UPDATE fm_entity_2_1 set maaler_nr= 
'$maaler_nr' WHERE location_code ='" . $values['location_code'] . "'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                       }
+               }
+
+               $sql = "SELECT besiktet_dato FROM fm_entity_2_1 WHERE id 
='{$receipt['id']}'";
+               $this->db->query($sql,__LINE__,__FILE__);
+               $this->db->next_record();
+               if($this->db->f('besiktet_dato'))
+               {
+                       $besiktet_dato = 
$this->db->from_timestamp($this->db->f('besiktet_dato'));
+               }
+
+               if (isSet($values_attribute) AND is_array($values_attribute))
+               {
+                       foreach($values_attribute as $entry)
+                       {
+                               switch($entry['name'])
+                               {
+                                       case 'maaler_nr':
+                                               if($entry['value'] && 
($entry['value'] != $maaler_nr))
+                                               {
+                                                       $this->soproject = 
CreateObject('property.soproject');
+                                                       if 
($values['street_name'])
+                                                       {
+                                                               $address = 
$this->db->db_addslashes($values['street_name'] . ' ' 
.$values['street_number']);
+                                                       }
+                                                       else
+                                                       {
+                                                               $address = 
$this->db->db_addslashes($values['location_name']);
+                                                       }
+                                                       
$this->soproject->update_power_meter($entry['value'],$values['location_code'],$address);
+
+                                                       $maaler_nr = 
$entry['value'];
+                                               }
+
+                                               break;
+                                       case 'maalerstand':
+                                               if($entry['value'])
+                                               {
+                                                       $new_value = 
$entry['value'];
+
+                                                       
$this->db->query("select maaler_stand, id from fm_entity_1_11 WHERE 
ext_meter_id = '$maaler_nr' AND location_code ='" . $values['location_code']. 
"'",__LINE__,__FILE__);
+                                                       
$this->db->next_record();
+                                                       $old_value = 
$this->db->f('maaler_stand');
+                                                       $id = 
$this->db->f('id');
+                                                       if($id)
+                                                       {
+                                                               $attrib_id = 8;
+                                                               if($new_value 
!= $old_value)
+                                                               {
+                                                                       
$historylog     = CreateObject('property.historylog','entity_1_11');
+                                                                       
$historylog->add('SO',$id,$new_value,false, $attrib_id,$besiktet_dato);
+                                                                       
$this->db->query("UPDATE fm_entity_1_11 set maaler_stand = '$new_value' WHERE 
ext_meter_id = '$maaler_nr' AND location_code ='" . $values['location_code']. 
"'",__LINE__,__FILE__);
+                                                               }
+                                                       }
+                                               }
+                                               break;
+                               }
+                       }
+               }
+
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
                                (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
        2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,31 @@
+<?php
+
+//_debug_array($values);
+//_debug_array($values_attribute);
+//_debug_array($action);
+
+               // this routine will only work with the exact configuration of 
Bergen Bolig og Byfornyelse - but can serve as an example
+
+               $db = & $GLOBALS['phpgw']->db;
+
+               $sql = "SELECT innflyttet FROM fm_entity_2_11 WHERE 
location_code ='" . $values['location_code'] . "'";
+               $db->query($sql,__LINE__,__FILE__);
+               $db->next_record();
+               $innflyttetdato_old = $db->f('innflyttet');
+
+               $sql = "SELECT innflyttetdato, tenant_id FROM fm_location4 
WHERE location_code ='" . $values['location_code'] . "'";
+               $db->query($sql,__LINE__,__FILE__);
+               $db->next_record();
+               $innflyttetdato = $db->f('innflyttetdato');
+               $tenant_id = $db->f('tenant_id');
+
+               if($tenant_id == $values['extra']['tenant_id'] && 
!$innflyttetdato_old)
+               {
+                       $value_set['innflyttet']        = $innflyttetdato;
+                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $db->transaction_begin();
+                       $db->query("UPDATE fm_entity_2_11 set $value_set WHERE 
id=" . (int) $receipt['id'],__LINE__,__FILE__);
+                       $db->transaction_commit();
+               }
+
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/custom/default/kalkuler_risiko_for_ros.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/custom/default/kalkuler_risiko_for_ros.php
                               (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/custom/default/kalkuler_risiko_for_ros.php
       2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,82 @@
+<?php
+
+//_debug_array($values);
+//_debug_array($values_attribute);
+//_debug_array($action);
+
+               // this routine will only work with the exact configuration of 
Bergen Bolig og Byfornyelse - but can serve as an example
+
+               $db = & $GLOBALS['phpgw']->db;
+
+               if (isSet($values_attribute) AND is_array($values_attribute))
+               {
+
+                       foreach($values_attribute as $entry)
+                       {
+                               switch($entry['name'])
+                               {
+                                       case 'sansynlighet':
+                                               $sansynlighet = 
(int)$entry['value'];
+                                               break;
+                               }
+                       }
+
+                       reset($values_attribute);
+                       
+                       $value_set['r_tverrfaglig'] = 0;
+
+                       foreach($values_attribute as $entry)
+                       {
+                               $risk =  $entry['value'] * $sansynlighet;
+                               switch($entry['name'])
+                               {
+                                       case 'k_beboer':
+                                               $value_set['r_beboer']  = $risk;
+                                               if($risk > 
$value_set['r_tverrfaglig'])
+                                               {
+                                                       
$value_set['r_tverrfaglig'] = $risk;
+                                               }
+                                               break;
+                                       case 'k_miljo':
+                                               $value_set['r_miljo']   = $risk;
+                                               if($risk > 
$value_set['r_tverrfaglig'])
+                                               {
+                                                       
$value_set['r_tverrfaglig'] = $risk;
+                                               }
+                                               break;
+                                       case 'k_ok_verdier':
+                                               $value_set['r_ok_verdier']      
= $risk;
+                                               if($risk > 
$value_set['r_tverrfaglig'])
+                                               {
+                                                       
$value_set['r_tverrfaglig'] = $risk;
+                                               }
+                                               break;
+                                       case 'k_drift':
+                                               $value_set['r_drift']   = $risk;
+                                               if($risk > 
$value_set['r_tverrfaglig'])
+                                               {
+                                                       
$value_set['r_tverrfaglig'] = $risk;
+                                               }
+                                               break;
+                                       case 'k_ansatte':
+                                               $value_set['r_ansatte'] = $risk;
+                                               if($risk > 
$value_set['r_tverrfaglig'])
+                                               {
+                                                       
$value_set['r_tverrfaglig'] = $risk;
+                                               }
+                                               break;
+                                       case 'k_annet':
+                                               $value_set['r_annet']   = $risk;
+                                               if($risk > 
$value_set['r_tverrfaglig'])
+                                               {
+                                                       
$value_set['r_tverrfaglig'] = $risk;
+                                               }
+                                               break;
+                               }
+                       }
+
+                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $db->transaction_begin();
+                       $db->query("UPDATE fm_entity_2_6 set $value_set WHERE 
id=" . (int)$receipt['id'],__LINE__,__FILE__);
+                       $db->transaction_commit();
+               }


Property changes on: 
people/sigurdne/modules/property/trunk/inc/custom/default/kalkuler_risiko_for_ros.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/export/README
===================================================================
--- people/sigurdne/modules/property/trunk/inc/export/README                    
        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/export/README    2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1 @@
+The export filters are separated by the phpgw_domain - for mulitple domains - 
one has to create one catalog for each domain.

Added: people/sigurdne/modules/property/trunk/inc/export/default/Agresso
===================================================================
--- people/sigurdne/modules/property/trunk/inc/export/default/Agresso           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/export/default/Agresso   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,1023 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage export
+       * @version $Id: Agresso,v 1.35 2007/03/16 08:57:05 sigurdne Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class export_conv
+       {
+               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
+               
+               var $old_files_deleted;
+               var $debug;
+               
+               function export_conv()
+               {
+                       $GLOBALS['phpgw_info']['flags']['currentapp']   =       
'property';
+                       $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+       //              $this->db                       = $GLOBALS['phpgw']->db;
+
+                       $this->soXport = CreateObject('property.soXport');      
+                       $this->config = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();
+                       $this->bocommon                 = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->db               = $this->bocommon->new_db();    
                
+               }
+
+               function 
select_periods_with_invoice_to_transfer($pre_transfer='')
+               {
+                       if($pre_transfer)
+                       {
+                               $sql= "SELECT DISTINCT periode from fm_ecobilag 
WHERE utbetalingsigndato IS NULL ";
+                       }
+                       else
+                       {
+                               $sql= "SELECT DISTINCT periode from fm_ecobilag 
WHERE budsjettsigndato is not null and (saksigndato is not null or 
oppsynsigndato is not null) and utbetalingsigndato is not null ";
+                       }
+                       
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $periode[]      = $this->db->f('periode');
+                       }
+                       return $periode;
+               }
+
+               function log_end($batchid)
+               {
+                       $tid=date($this->soXport->datetimeformat);
+                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','End transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function log_error($batchid,$error_desr)
+               {
+                       $tid=date($this->soXport->datetimeformat);
+                       $sql= "insert into fm_ecologg 
(batchid,ecobilagid,status,melding,tid) values 
('$batchid',NULL,0,'$error_desr','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function increment_batchid()
+               {
+
+                       $this->db->query("update fm_idgenerator  set value = 
value + 1 where name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $bilagsnr = $this->db->f('value');
+                       return $bilagsnr;
+
+               }
+
+               function next_batchid()
+               {
+
+                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $batchid = $this->db->f('value')+1;
+
+                       return $batchid;
+               }
+
+               //Lagre start melding
+               function log_start($batchid)
+               {
+                       $tid=date($this->soXport->datetimeformat);
+                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','Start transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function get_vendor_info($vendor_id='')
+               {
+                       $sql = "select org_nr,konto_nr from fm_vendor where 
id='$vendor_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $vendor_info= array(
+                               'org_nr' => $this->db->f('org_nr'),
+                               'konto_nr' => $this->db->f('konto_nr')
+                               );
+
+                       return $vendor_info;
+               }
+
+               function get_order_title($order_id='')
+               {
+                       $sql = "select type from fm_orders where 
id='$order_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       switch($this->db->f('type'))
+                       {
+                               case 'workorder':
+                                       $sql2 = "select title from fm_workorder 
where id='$order_id'";
+                                       
$this->db->query($sql2,__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $order_title = $this->db->f('title');
+                                       break;
+                               case 's_agreement':
+                                       $sql2 = "select descr as title from 
fm_s_agreement where id='$order_id'";
+                                       
$this->db->query($sql2,__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $order_title = $this->db->f('title');
+                                       break;
+                       }
+
+                       return $order_title;
+               }
+
+
+               function select_invoice_rollback($day,$month,$year,$Filnavn)
+               {
+
+                       switch($GLOBALS['phpgw_info']['server']['db_type'])
+                       {
+                               case 'mssql':
+                                       $datepart_year          = 
"datepart(year,overftid)";
+                                       $datepart_month         = 
"datepart(month,overftid)";
+                                       $datepart_day           = 
"datepart(day,overftid)";
+                                       break;
+                               case 'mysql':
+                                       $datepart_year          = 
"YEAR(overftid)";
+                                       $datepart_month         = 
"MONTH(overftid)";
+                                       $datepart_day           = 
"DAYOFMONTH(overftid)";
+                                       break;
+                               case 'pgsql':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                               case 'postgres':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                       }
+
+
+                       $sql="select * from fm_ecobilagoverf where 
filnavn='$Filnavn' and $datepart_year=$year and $datepart_month=$month and 
$datepart_day= $day";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $i = 0;
+                       while ($this->db->next_record())
+                       {
+                               $invoice_roleback[$i]['id']     = 
$this->db->f('id');
+                               $invoice_roleback[$i]['bilagsnr']       = 
$this->db->f('bilagsnr');
+                               $invoice_roleback[$i]['kidnr']  = 
$this->db->f('kidnr');
+                               $invoice_roleback[$i]['typeid'] = 
$this->db->f('typeid');
+                               $invoice_roleback[$i]['kildeid']        = 
$this->db->f('kildeid');
+                               $invoice_roleback[$i]['pmwrkord_code']  = 
$this->db->f('pmwrkord_code');
+                               $invoice_roleback[$i]['belop']  = 
$this->db->f('belop');
+                               $invoice_roleback[$i]['fakturadato']    = 
$this->db->f('fakturadato');
+                               $invoice_roleback[$i]['periode']        = 
$this->db->f('periode');
+                               $invoice_roleback[$i]['forfallsdato']   = 
$this->db->f('forfallsdato');
+                               $invoice_roleback[$i]['fakturanr']      = 
$this->db->f('fakturanr');
+                               $invoice_roleback[$i]['spbudact_code']  = 
$this->db->f('spbudact_code');
+                               $invoice_roleback[$i]['regtid'] = 
$this->db->f('regtid');
+                               $invoice_roleback[$i]['artid']  = 
$this->db->f('artid');
+                               $invoice_roleback[$i]['godkjentbelop']  = 
$this->db->f('godkjentbelop');
+                               $invoice_roleback[$i]['spvend_code']    = 
$this->db->f('spvend_code');
+                               $invoice_roleback[$i]['dima']   = 
$this->db->f('dima');
+                               $invoice_roleback[$i]['loc1']   = 
$this->db->f('loc1');
+                               $invoice_roleback[$i]['dimb']   = 
$this->db->f('dimb');
+                               $invoice_roleback[$i]['mvakode']        = 
$this->db->f('mvakode');
+                               $invoice_roleback[$i]['dimd']   = 
$this->db->f('dimd');
+                               $invoice_roleback[$i]['project_id']     = 
$this->db->f('project_id');
+                               $invoice_roleback[$i]['kostra_id']      = 
$this->db->f('kostra_id');
+                               $invoice_roleback[$i]['item_type']      = 
$this->db->f('item_type');
+                               $invoice_roleback[$i]['item_id']        = 
$this->db->f('item_id');
+
+                               if($this->db->f('oppsynsmannid'))
+                               {
+                                       $invoice_roleback[$i]['oppsynsmannid']  
= $this->db->f('oppsynsmannid');
+                               }
+                               if($this->db->f('saksbehandlerid'))
+                               {
+                                       
$invoice_roleback[$i]['saksbehandlerid']        = 
$this->db->f('saksbehandlerid');
+                               }
+
+                               $invoice_roleback[$i]['budsjettansvarligid']    
= $this->db->f('budsjettansvarligid');
+
+                               if($this->db->f('oppsynsigndato'))
+                               {
+                                       $invoice_roleback[$i]['oppsynsigndato'] 
= $this->db->f('oppsynsigndato');
+                               }
+                               if($this->db->f('saksigndato'))
+                               {
+                                       $invoice_roleback[$i]['saksigndato']    
= $this->db->f('saksigndato');
+                               }
+
+                               $invoice_roleback[$i]['budsjettsigndato']       
= $this->db->f('budsjettsigndato');
+                               $invoice_roleback[$i]['merknad']        = 
$this->db->f('merknad');
+                               $invoice_roleback[$i]['splitt'] = 
$this->db->f('splitt');
+                               $invoice_roleback[$i]['ordrebelop']     = 
$this->db->f('ordrebelop');
+                               $invoice_roleback[$i]['utbetalingid']   = 
$this->db->f('utbetalingid');
+                               $invoice_roleback[$i]['utbetalingsigndato']     
= $this->db->f('utbetalingsigndato');
+                               $i++;
+                       }
+                       return $invoice_roleback;
+               }
+
+
+               //rollback function
+               function bilag_update_overf($BilagOverf)
+               {
+                       $values= array(
+                               $BilagOverf['project_id'],
+                               $BilagOverf['kostra_id'],
+                               $BilagOverf['pmwrkord_code'],
+                               $BilagOverf['bilagsnr'],
+                               $BilagOverf['splitt'],
+                               $BilagOverf['kildeid'],
+                               $BilagOverf['kidnr'],
+                               $BilagOverf[typeid],
+                               $BilagOverf['fakturadato'],
+                               $BilagOverf['forfallsdato'],
+                               $BilagOverf['regtid'],
+                               $BilagOverf['artid'],
+                               $BilagOverf['spvend_code'],
+                               $BilagOverf['dimb'],
+                               $BilagOverf['oppsynsmannid'],
+                               $BilagOverf['saksbehandlerid'],
+                               $BilagOverf['budsjettansvarligid'],
+                               $BilagOverf['fakturanr'],
+                               $BilagOverf['spbudact_code'],
+                               $BilagOverf['dima'],
+                               $BilagOverf['loc1'],
+                               $BilagOverf['dimd'],
+                               $BilagOverf['mvakode'],
+                               $BilagOverf['periode'],
+                               
$this->db->db_addslashes($BilagOverf['merknad']),
+                               $BilagOverf['utbetalingid'],
+                               $BilagOverf['oppsynsigndato'],
+                               $BilagOverf['saksigndato'],
+                               $BilagOverf['budsjettsigndato'],
+                               $BilagOverf['utbetalingsigndato'],
+                               $BilagOverf['item_type'],
+                               $BilagOverf['item_id'],
+                               );
+                       
+                       $values = $this->bocommon->validate_db_insert($values);
+
+                       $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
+                       . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
+                       . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
+                       . " 
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
+                       . " values ($values,"
+                       . $this->bocommon->moneyformat($BilagOverf['belop']) . 
","
+                       . 
$this->bocommon->moneyformat($BilagOverf['godkjentbelop']) . ")";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+
+               //Oppdater bel\xF8p p\xE5 arbeidsordre operator="-" ved 
tilbakerulling
+               function 
correct_actual_cost($pmwrkord_code,$Belop,$actual_cost_field,$operator)
+               {
+                       $Belop=$Belop/100;
+                       
+                       if($operator == "-")
+                       {
+                               $update_paid = ", paid = 1";
+                       }
+                       else
+                       {
+                               $update_paid = ", paid = 2";
+                       }
+
+                       $sql="UPDATE fm_workorder SET 
$actual_cost_field=$actual_cost_field $operator $Belop $update_paid WHERE 
id='$pmwrkord_code'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+
+               function 
overfor($download,$pre_transfer='',$force_period_year='')
+               {
+
+//                     $download = 'on';
+//                     $download = False;
+                       $pre_transfer=True;
+//                     $this->debug=True;
+
+                       //Generer batch ID
+                       $batchid = $this->soXport->next_batchid();
+                       if ($download=='on')
+                       {
+                               $this->increment_batchid();
+                               //Lagre melding
+                               $this->log_start($batchid);
+                       }
+
+                       //Velg ut alle perioder som har bilag som skal 
overf\xF8res
+
+
+                       if ($pre_transfer)
+                       {
+                               $periode = 
$this->select_periods_with_invoice_to_transfer($pre_transfer);
+
+                               for ($i=0;$i<count($periode);$i++)
+                               {
+       
+                                       $receipt['message'][]= array('msg' => 
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer));
+                               }
+                       }
+
+
+                       $pre_transfer=False;
+                       
+                       $periode = 
$this->select_periods_with_invoice_to_transfer($pre_transfer);
+
+                       for ($i=0;$i<count($periode);$i++)
+                       {
+
+                               $receipt['message'][]= array('msg' => 
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer,$force_period_year));
+                       }
+
+
+
+                       //Lagre melding
+                       if ($download=='on' || $pre_transfer)
+                       {
+                               $this->log_end($batchid); //Lagre melding
+                       }
+
+                       return $receipt;
+               }
+               
+               function errorhandler($batchid,$error_desr)
+               {
+                       $this->db->transaction_abort();
+
+                       $meld = $error_desr;
+               
+                       //Vis feilmelding
+//                     echo $meld;
+               
+                       //Lagre feilmelding
+                       $this->log_error($batchid,$error_desr);
+               }
+               
+               function RullTilbake($Filnavn,$Dato)
+               {                                                               
+                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       $dateformat = str_replace(".","",$dateformat);
+                       $dateformat = str_replace("-","",$dateformat);
+                       $dateformat = str_replace("/","",$dateformat);
+                       $y=strpos($dateformat,'y');
+                       $d=strpos($dateformat,'d');
+                       $m=strpos($dateformat,'m');
+       
+                       $dateparts = explode('/', $Dato);
+                       $day = $dateparts[$d];
+                       $month = $dateparts[$m];
+                       $year = $dateparts[$y];
+        /*             $date1 = mktime (2,0,0,$month,$day,$year);
+                       if ($date1)
+                       {
+                               $Dato=$date1;
+                       }
+       
+                       $Dato= date("M d Y",$Dato);
+       */
+                       
+                       
$BilagOverf=$this->select_invoice_rollback($day,$month,$year,$Filnavn);
+                       $this->db->transaction_begin();
+
+                       for ($i=0;$i<count($BilagOverf);$i++)
+                       {
+                               $this->bilag_update_overf($BilagOverf[$i]);
+                               
+               
+                               if($BilagOverf[$i]['pmwrkord_code'])
+                               {
+                                       $Belop = sprintf("%01.2f", 
$BilagOverf[$i]['ordrebelop'])*100;
+                               
+                                       if ($BilagOverf[$i]['dimd'] % 2 == 0)
+                                       {
+                                               
$actual_cost_field='act_mtrl_cost';
+                                       }
+                                       else
+                                       {
+                                               
$actual_cost_field='act_vendor_cost';
+                                       }
+               
+                                       $operator='-';
+
+                                       
$this->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
+                               }
+               
+                               //Slett fra avviks tabell
+                       //      
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
+               
+                               //Slett fra arkiv
+                               
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
+               
+                               $antall = $antall + 1;
+                       }
+               
+                       if($antall > 0)
+                       {               
+                               $fil_katalog = 
$this->config->config_data['export_path'];                       
+                       
+                               if(unlink ($fil_katalog. '/' . $Filnavn))
+                               {
+                                       $this->db->transaction_commit();
+                                       $receipt['message'][]= array('msg' => 
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
+                                       $receipt['message'][]= array('msg' => 
lang('File %1 is deleted',$Filnavn));
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $receipt['message'][]= array('msg' => 
'Noe gikk galt!');
+                               }                                               
        
+                       }
+                       else
+                       {
+                               $receipt['error'][]= array('msg' => lang('Sorry 
- None hits'));
+                       }
+                       return $receipt;
+               }
+                               
+               
+               function LagFilnavn ($batchid,$pre_transfer='')
+               {       
+                       if($pre_transfer)
+                       {
+                               $fil_katalog = 
$this->config->config_data['export_pre_path'];
+                       
+                               // Slett gamle filer
+
+                               if(!$this->old_files_deleted)
+                               {
+                                       for ($i=0;$i<13;$i++)
+                                       {
+                                               @unlink($fil_katalog . '/FDA_' 
. $i. '.TXT');
+                                       }
+                                       
+                                       $this->old_files_deleted= True;
+                               }
+
+
+                               $i = 1;
+                               do
+                               {
+                                       $Filnavn = $fil_katalog . '/FDA_' . $i. 
'.TXT';
+                               
+                                       //Sjekk om filen eksisterer
+                                       If (!file_exists($Filnavn))
+                                       {
+                                               return $Filnavn;
+                                       }
+                               
+                                       $i++;
+                               }
+                               while  ($i < 13);
+
+                       }
+                       else
+                       {
+                               $fil_katalog = 
$this->config->config_data['export_path'];
+                               $continue = True;
+                               $i = 1;
+                               do
+                               {
+                                       $Filnavn = $fil_katalog . '/FDB' . 
date("dmy") . '_' . sprintf("%02s",$i) . '.TXT';
+                               
+                                       //Sjekk om filen eksisterer
+                                       If (!file_exists($Filnavn))
+                                       {
+                                               return $Filnavn;
+                                       }
+                               
+                                       $i++;
+                               }
+                               while  ($continue);
+                       }
+                       
+                       
+                       //Ingen l\xF8penr er ledige, gi feilmelding
+                       return False;
+               }
+               
+               function 
OverforPeriode($batchid,$periode,$download,$pre_transfer='',$force_period_year='')
+               {
+                       $BilagId = 'NULL';
+       
+                       //Bestem filnavn
+
+
+                       $Filnavn = $this->LagFilnavn($batchid,$pre_transfer);
+                       if (!$Filnavn)
+                       {
+                               $message='LagFilnavn: Alle loepenr for filnavn 
er i bruk';
+                               $this->errorhandler($batchid,$message);
+                               return $message;
+                       }
+
+                       //Test om filen kan opprettes og skrives til
+                       if (@fopen($Filnavn, "wb"))
+                       {
+                               unlink($Filnavn);
+                       }
+                       else
+                       {
+                               $message='kan ikke lagre til fil: '. $Filnavn 
.'<br>';
+                               return $message;
+                       }
+                       
+                       //Velg ut alle hoved bilag som skal overf\xF8res
+
+                       $this->db->transaction_begin();
+
+                       
$oRsBilag=$this->soXport->hoved_bilag($periode,$pre_transfer);
+                                                                       
+                       $bilag_count= count($oRsBilag);
+                       for ($k=0;$k<$bilag_count;$k++)
+                       {                               
+                               $tranfser_bilag[] = $oRsBilag[$k]['bilagsnr'];
+                               
+                               //Bestem belops felt
+                               if ($oRsBilag[$k]['splitt']==0)
+                               {
+                                       //Bilaget er ikke splittet
+                                       if ($oRsBilag[$k]['godkjentbelop'] <> 
$oRsBilag[$k]['belop'])
+                                       {
+                                               $BelopFelt = 'godkjentbelop';   
                
+                                               //Logg til avviks tabell
+                                               if ($download=='on' && 
!$pre_transfer)
+                                               {
+//                                                     
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $BelopFelt = 'belop';
+                                       }
+                               }
+                               
+                               //Bilaget er splittet
+                               if ($oRsBilag[$k]['godkjentbelop'] == 
$oRsBilag[$k]['belop'])
+                               {
+                                       $BelopFelt = 'godkjentbelop';
+                               }
+                               else
+                               {
+                                        //Ikke lovlig
+                                       $message = lang('Avvik mellom 
fakturabelop og godkjent belop pa splittet faktura!');
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+               
+                               $Belop_motpost =$oRsBilag[$k][$BelopFelt] *100; 
+
+                               //Skriv hovedbilag
+
+                               $Buntnr         = 
sprintf("%-12s",basename($Filnavn,".TXT"));// verdi: MMDDFL, type: c12, plass: 
1 - 12
+                               $Forsystem      = 'BI';// verdi: BI, type: c2, 
plass: 13 - 14
+                               
+                               $Transtype      = 'GL';// verdi: GL, type: c2, 
plass: 17 - 18
+                               $Firmakode      = sprintf("%-2s",'BB');// 
verdi: Firmakode, type: c2, plass: 19 - 20
+
+                               $Valuteringsdato= 
date(Ymd,strtotime($oRsBilag[$k]['fakturadato']));// verdi: Dato, type: date, 
plass: 251 - 258
+                               $Bilagsdato     = 
date(Ymd,strtotime($oRsBilag[$k]['fakturadato'])) ;// verdi: Dato, type: date, 
plass: 259 - 266
+                               $Bilagsnr       = 
sprintf("%-9s",substr($oRsBilag[$k]['bilagsnr'],-8));// verdi: Bilagsnummer, 
type: i4, plass: 267 - 275
+               //              $Periode        = 
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) . 
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
+                               $ESL            = sprintf("%1s",'');// verdi: 
Blank, type: i+C481, plass: 282 - 282
+
+                               if($pre_transfer)
+                               {
+                                       if(abs(date(m,time()) - $periode) >1)
+                                       {
+                                               $temp_period = date(m,time()) 
-1;
+                                       
+                                               if($temp_period == 0)
+                                               {
+                                                       $temp_period =1;
+                                               }
+                                               
+                                               $temp_year = date(Y,time());
+                                       }
+                                       else
+                                       {
+                                               $temp_period = $periode;
+                                               $temp_year = 
date(Y,strtotime($oRsBilag[$k]['fakturadato']));
+                                       }
+
+                                       $Periode        = 
sprintf("%06s",$temp_year . sprintf("%02d",$temp_period));// verdi: Periode, 
type: i4, plass: 276 - 281
+                                       $Bilagsart      = 
sprintf("%2s",'FF');// verdi: , type: c2, plass: 15 - 16
+                                       $Forfall        = '20991231';// verdi: 
Forfallsdato , type: date, plass: 298 - 305                              
+                               }
+                               else
+                               {
+
+                                       if($force_period_year)
+                                       {
+                                               $Periode        = 
sprintf("%06s",$force_period_year . sprintf("%02d",$periode));// verdi: 
Periode, type: i4, plass: 276 - 281
+                                       }
+                                       else
+                                       {
+                                               $Periode        = 
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) . 
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
+                                       }
+                                       
+                                       $Bilagsart      = 
sprintf("%2s",'FD');// verdi: , type: c2, plass: 15 - 16
+                                       $Forfall        = 
date(Ymd,strtotime($oRsBilag[$k]['forfallsdato']));// verdi: Forfallsdato , 
type: date, plass: 298 - 305                              
+                               }
+                               
+                               $Rab_forf       = sprintf("%-8s",'');// verdi: 
Blank, type: date, plass: 306 - 313
+                               $Rabatt         = sprintf("%020s",'');// verdi: 
Blank, type: money, plass: 314 - 333
+                               $Avt_Kon        = sprintf("%-8s",'');// verdi: 
Blank, type: c8, plass: 334 - 341
+
+                               $Kid            = 
sprintf("%-27s",$oRsBilag[$k]['kidnr']);// verdi: Kid, type: c27, plass: 351 - 
377
+                               $Bet_overforing = sprintf("%-2s",'');// verdi: 
Blank, type: c2, plass: 378 - 379
+                               $Status         = 'N';// verdi: N, type: c1, 
plass: 380 - 380
+                               $Resk_type      = 'P';// verdi: Blank, type: 
c1, plass: 381 - 381
+                               $Resk_nr        = 
sprintf("%-9s",$oRsBilag[$k]['spvend_code']);// verdi: Blank., type: i4, plass: 
382 - 390
+                               $Forskudd       = '0';// verdi: 0, type: i1, 
plass: 391 - 391
+                               $Fakturaref     = '000000000';// verdi: 0, 
type: i4, plass: 392 - 400
+                               $Fakturaref     = '000000000';// verdi: 0, 
type: i4, plass: 401 - 409
+                               $Inkassokode    = sprintf("%-6s",'');// verdi: 
Blank, type: c6, plass: 410 - 415
+                               $Bet_mottager   = sprintf("%-8s",'');// verdi: 
Blank, type: c8, plass: 416 - 423
+                               $Att_ansvarlig  = 
sprintf("%-6s",utf8_decode($oRsBilag[$k]['saksbehandler']));// verdi: Blank, 
type: c6, plass: 424 - 429
+
+                               $vendor_info = 
$this->get_vendor_info($oRsBilag[$k]['spvend_code']);
+                               
+                               if(!$vendor_info['org_nr'])
+                               {
+                                       $message = 'mangler org_nr for 
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+
+                               if(!$vendor_info['konto_nr'])
+                               {
+                                       $message = 'mangler konto for 
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+
+                               $Resk_navn      = 
sprintf("%-50s",$vendor_info['org_nr']);// verdi: F\xF8dselsnr, type: c50, 
plass: 430 - 479
+                               $Postadresse    = sprintf("%-160s",'');// 
verdi: Blank, type: c160, plass: 480 - 639
+                               $Stat_Provins   = sprintf("%-50s",'');// verdi: 
Blank, type: c50, plass: 640 - 689
+                               $Sted           = sprintf("%-50s",'');// verdi: 
Blank, type: c50, plass: 690 - 739
+                               $Bank_Postgiro_kontonr = 
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi: 
konto_nr, type: c35, plass: 740 - 774
+                               $Betalingsmate  = sprintf("%-2s",'');// verdi: 
Blank, type: c2, plass: 775 - 776
+                               $Mva_reg_nr     = sprintf("%-25s",'');// verdi: 
Blank, type: c25, plass: 777 - 801
+                               $Postnummer     = sprintf("%-15s",'');// verdi: 
Blank, type: c15, plass: 802 - 816
+                               $Val_dok        = sprintf("%-3s",'');// verdi: 
Blank, type: c3, plass: 817 - 819
+
+
+                               //Velg ut alle underbilag
+                               
$oRsUnderbilag=$this->soXport->select_underbilag($oRsBilag[$k]['bilagsnr']);    
        
+
+
+                               $underbilag_count= count($oRsUnderbilag);
+                               $last_record = $underbilag_count - 1;
+
+                               for ($i=0;$i<$underbilag_count;$i++)
+                               {
+                                       $BilagId = $oRsUnderbilag[$i]['id'];
+                                       
+                                       $Belop = 
$oRsUnderbilag[$i][$BelopFelt]*100;
+                                       $Belop_ = $Belop;
+                                       
+                                       if($Belop < 0)
+                                       {
+                                               $Belop = abs($Belop);
+                                               $Belop = 
sprintf("%019s",$Belop);
+                                               $Belop = '-' . $Belop;
+                                       }
+                                       else
+                                       {                                       
+                                               $Belop = 
sprintf("%019s",$Belop);
+                                               $Belop = '+' . $Belop;
+                                       }
+                                       
+
+                                       if($oRsUnderbilag[$i]['pmwrkord_code'])
+                                       {
+               
+                                               //Oppdater bel\xF8p p\xE5 
arbeidsordre
+                                               if ($download=='on' && 
!$pre_transfer)
+                                               {
+                                                       if 
($oRsUnderbilag[$i]['dimd'] % 2 == 0)
+                                                       {
+                                                               
$actual_cost_field='act_mtrl_cost';
+                                                       }
+                                                       else
+                                                       {
+                                                               
$actual_cost_field='act_vendor_cost';
+                                                       }
+                                                       $operator='+';
+                                                       
+                                                       if(!$this->debug)
+                                                       {
+                                                               
$this->correct_actual_cost($oRsUnderbilag[$i]['pmwrkord_code'],$Belop_,$actual_cost_field,$operator);
+                                                       }
+                                               }
+                                       }
+               
+                                       //Overf\xF8r til fm_ecobilagoverf
+               
+                                       $oRsOverfBilag=$oRsUnderbilag[$i];
+                                       $oRsOverfBilag['filnavn']= 
basename($Filnavn);
+                                       
$oRsOverfBilag['ordrebelop']=$oRsUnderbilag[$i][$BelopFelt];
+
+
+                                       //dersom det mangler budsjett konto - 
kun aktuelt for ikke godkjent - sett konto til 2899999
+                                       
+                                       if(!$oRsOverfBilag['spbudact_code'] && 
$pre_transfer)
+                                       {
+                                               $oRsOverfBilag['spbudact_code'] 
= 12304361;
+                                       }
+                                       
+                                       
+                                       //dersom ikke gyldig objekt - kun 
aktuelt for ikke godkjent - sett objekt til 9999
+                                       
+                                       if(!($oRsOverfBilag['kostra_id']>0) && 
$pre_transfer)
+                                       {
+                                               $oRsOverfBilag['kostra_id'] = 
26550;
+                                               $oRsOverfBilag['mvakode'] = 0;
+                                               $oRsOverfBilag['dima'] = 9999;
+                                       }
+                                       
+                                       $Konto          = 
sprintf("%08s",$oRsOverfBilag['spbudact_code']);// verdi: Art, type: c8, plass: 
21 - 28
+                                       $Dim_1          = 
sprintf("%8s",$oRsOverfBilag['district_id']);// verdi: Ansvarssted, type: c8, 
plass: 29 - 36
+                                       $Dim_2          = 
sprintf("%-8s",$oRsOverfBilag['kostra_id']);// verdi: Tjeneste, type: c8, 
plass: 37 - 44
+                                       
+                                       if($pre_transfer)
+                                       {
+                                               $Dim_3          = 
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,4));// verdi: Objekt, type: c8, 
plass: 45 - 52
+                                       }
+                                       else
+                                       {
+                                               $Dim_3          = 
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,6));// verdi: Objekt-bygg, type: 
c8, plass: 45 - 52
+                                       }
+                                       
+                                       
+                                       $Dim_4          = sprintf("%-8s",'');// 
verdi: Ressurs, type: c8, plass: 53 - 60
+                                       $Dim_5          = 
sprintf("%-12s",$oRsOverfBilag['project_id']);// verdi: Prosjekt, type: c12, 
plass: 61 - 72
+                                       $Dim_6          = 
sprintf("%-4s",$oRsOverfBilag['dimd']);// verdi: Blank, type: c4, plass: 73 - 76
+                                       $Dim_7          = sprintf("%-4s",'');// 
verdi: Blank, type: c4, plass: 77 - 80
+
+                                       
$Avgiftskode=sprintf("%-2s",$oRsOverfBilag['mvakode']);// verdi: Avgiftskode, 
type: c2, plass: 81 - 82
+                                       
+                                       $Avgiftssystem  = sprintf("%2s",'');// 
verdi: Blank, type: c2, plass: 83 - 84
+                                       $Valutakode     ='NOK';// verdi: NOK, 
type: c3, plass: 85 - 87
+                                       $Debet_Kredit   = sprintf("%2s",'');// 
verdi: Blank, type: i2, plass: 88 - 89
+                                       $Valutabelop    = $Belop;// verdi: 
Bel\xF8p, type: money, plass: 90 - 109
+                                       $Belop_i_firmavaluta=$Belop;// verdi: 
Bel\xF8p, type: money, plass: 110 - 129
+                                       $Antall         = sprintf("%11s",'');// 
verdi: Blank, type: i4, plass: 130 - 140
+                                       $Belop2         = sprintf("%20s",'');// 
verdi: Blank, type: f8, plass: 141 - 160
+                                       $Belop3         = sprintf("%20s",'');// 
verdi: Blank, type: money, plass: 161 - 180
+
+                               //      $Belop4 (ogs\xE5 kalt "money3" )blir 
brukt for identifisere overf\xF8ring p\xE5 tvers av filer.
+                                       $Belop4         = 
sprintf("%20s",$batchid);// verdi: Blank, type: money, plass: 181 - 200 - 
batch_id h\xF8yre justert
+
+
+                                       if($oRsOverfBilag['pmwrkord_code'])
+                                       {
+                                               $Tekst  = 
sprintf("%-50s",substr(utf8_decode($this->get_order_title($oRsOverfBilag['pmwrkord_code'])),0,50));//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
 verdi: Tekst, type: text (50), plass: 201 - 250
+                                       }
+                                       else
+                                       {
+                                               $Tekst  = 
sprintf("%-50s",'');//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
 verdi: Tekst, type: text (50), plass: 201 - 250
+                                       }
+                                       
+                                       $Fakturanr      = 
sprintf("%-15s",substr(utf8_decode($oRsOverfBilag['fakturanr']), 0, 15));// 
verdi: Fakturanr, type: c15, plass: 283 - 297
+
+                                       $Ordrenummer    = 
sprintf("%-9s",$oRsOverfBilag['pmwrkord_code']);// verdi: Infodoc ordrenr, 
type: i4, plass: 342 - 350
+       
+                                       
+                                       //Kopier verdier
+                                       if ($download=='on' && !$pre_transfer 
&& !$this->debug)
+                                       {
+                                               
$this->soXport->add_OverfBilag($oRsOverfBilag);
+                                       }
+                                       
+                                       //Skriv til fil
+                                       
+                                       $buffer .= $Buntnr . $Forsystem . 
$Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 . 
$Dim_4 . 
+                                       $Dim_5 . $Dim_6 . $Dim_7 . $Avgiftskode 
. $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop . 
+                                       $Belop_i_firmavaluta . $Antall . 
$Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato . 
+                                       $Bilagsnr . $Periode . $ESL . 
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer . 
+                                       $Kid . $Bet_overforing . $Status . 
$Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref . 
+                                       $Inkassokode . $Bet_mottager . 
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted . 
+                                       $Bank_Postgiro_kontonr . $Betalingsmate 
. $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
+
+                                       if($i==$last_record)
+                                       {
+                                               $Konto          = 
sprintf("%-8s",'2327010');// verdi: Art, type: c8, plass: 21 - 28
+                                               $Dim_1          = 
sprintf("%-8s",'');// verdi: Ansvarssted, type: c8, plass: 29 - 36
+                                               $Dim_2          = 
sprintf("%-8s",'');// verdi: Tjeneste, type: c8, plass: 37 - 44
+                                               $Dim_3          = 
sprintf("%-8s",'');// verdi: Objekt, type: c8, plass: 45 - 52
+                                               $Dim_4          = 
sprintf("%-8s",'');// verdi: Ressurs, type: c8, plass: 53 - 60
+                                               $Dim_5          = 
sprintf("%-12s",'');// verdi: Prosjekt, type: c12, plass: 61 - 72
+                                               $Dim_6          = 
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 73 - 76
+                                               $Dim_7          = 
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 77 - 80
+                                               $Fakturanr      = 
sprintf("%-15s",'');// verdi: Fakturanr, type: c15, plass: 283 - 297
+                                               $Ordrenummer    = 
sprintf("%-9s",'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
+                                               $Tekst          = 
sprintf("%-50s",'');//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
 verdi: Tekst, type: text (50), plass: 201 - 250
+
+                                               if($Belop_motpost < 0)
+                                               {
+                                                       $Belop_motpost = 
sprintf("%019s",abs($Belop_motpost));
+                                                       $Belop_motpost = '+' . 
$Belop_motpost;
+                                               }
+                                               else
+                                               {
+                                                       $Belop_motpost = 
sprintf("%019s",$Belop_motpost);
+                                                       $Belop_motpost = '-' . 
$Belop_motpost;
+
+                                               }
+                                               
+                                               $Transtype      = 'AP';// 
verdi: GL, type: c2, plass: 17 - 18
+                                               $Valutabelop    = 
$Belop_motpost;// verdi: Bel\xF8p, type: money, plass: 90 - 109
+                                               
$Belop_i_firmavaluta=$Belop_motpost;// verdi: Bel\xF8p, type: money, plass: 110 
- 129
+
+                                               $buffer .= $Buntnr . $Forsystem 
. $Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 . 
$Dim_4 . 
+                                               $Dim_5 . $Dim_6 . $Dim_7 . 
$Avgiftskode . $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop . 
+                                               $Belop_i_firmavaluta . $Antall 
. $Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato . 
+                                               $Bilagsnr . $Periode . $ESL . 
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer . 
+                                               $Kid . $Bet_overforing . 
$Status . $Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref . 
+                                               $Inkassokode . $Bet_mottager . 
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted . 
+                                               $Bank_Postgiro_kontonr . 
$Betalingsmate . $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";                  
               
+                                       }
+                               
+                                       //Slett post i fm_ecobilag
+                                       if ($download=='on' && !$pre_transfer 
&& !$this->debug)
+                                       {
+                                               
$this->soXport->delete_from_fm_ecobilag($oRsUnderbilag[$i]['id']);              
+                                               //Logg transaksjon              
+                                               
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice tranferred'));
+                                       }
+               
+                                       $BilagId = 'NULL';
+               
+                                       $antall = $antall + 1;
+                               }
+                       }
+                               
+                       //Fullf\xF8r transaksjon
+                       
+               
+                       if ($download=='on' && !$pre_transfer && !$this->debug):
+                       {
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+                               
+                               if(fclose($fp))
+                               {
+                                       $file_written=True;
+                               }
+
+                               if($file_written && 
$this->config->config_data['invoice_export_method']!='ftp'):
+                               {
+                                       $transfer_ok = True;
+                               }
+                               elseif($file_written):
+                               {
+                                       $transfer_ok = 
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
+                               }
+                               endif;
+
+                               if($transfer_ok)
+                               {
+                                       $this->db->transaction_commit();
+                                       $message = 'Godkjent: periode: 
'.$Periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' . $Filnavn;
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $message = 'Noe gikk galt med 
overforing av godkjendte fakturaer!';                             
+                               }
+                       }
+                       elseif($download=='on' && $pre_transfer && 
!$this->debug):
+                       {
+
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+
+                               if(fclose($fp))
+                               {
+                                       $file_written=True;
+                               }
+                               
+                               if($file_written && 
$this->config->config_data['invoice_export_method']!='ftp'):
+                               {
+                                       $transfer_ok = True;
+                               }
+                               elseif($file_written):
+                               {
+                                       $transfer_ok = 
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
+                               }
+                               endif;
+
+                               if($transfer_ok)
+                               {
+                                       $this->db->transaction_commit();
+                                       $message = 'Ankomstregistrering: 
periode: '.$Periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' . 
$Filnavn;
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $message = 'Noe gikk galt med 
ankomstregistrering!';                            
+                               }
+                       }
+                       else:
+                       {
+                               $message = $buffer;
+                               $this->db->transaction_abort();
+
+                       }
+                       endif;
+
+                       return $message;
+               }
+               
+               function transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
+               {                       
+
+                       
if($this->config->config_data['invoice_export_method']=='ftp')
+                       {
+                               $ftp    = $this->phpftp_connect();      
+                               
+                               $basedir = 
$this->config->config_data['invoice_ftp_basedir'];
+                               if($basedir)
+                               {
+                                       $newfile = $basedir . '/' . 
basename($Filnavn);
+                               }
+                               else
+                               {
+                                       $newfile = basename($Filnavn);
+                               }
+
+                               if (ftp_put($ftp,$newfile, $Filnavn, 
FTP_BINARY))
+                               {
+                                       for 
($i=0;$i<count($tranfser_bilag);$i++)
+                                       {                               
+                                               
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice 
pre_transferred %1',basename($Filnavn)));
+                                       }
+                                       $transfer_ok = True;
+                               }
+                               else
+                               {
+                                       for 
($i=0;$i<count($tranfser_bilag);$i++)
+                                       {                               
+                                               
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to 
pre_transfere %1 to agresso',basename($Filnavn)));
+                                       }
+                                       $transfer_ok = False;
+                               }
+                               if(!$transfer_ok)
+                               {
+                                       unlink($Filnavn);
+                               }
+                       
+                               ftp_quit($ftp);
+                       }
+                       return  $transfer_ok;
+               }
+
+               function phpftp_connect() 
+               {
+                       $host = $this->config->config_data['invoice_ftp_host'];
+                       $user = $this->config->config_data['invoice_ftp_user'];
+                       $pass = $this->config->config_data['invoice_ftp_pw'];
+                       
+//                     echo "connecting to $host with $user and $pass\n <br>";
+                       $ftp = ftp_connect($host);
+                       if($ftp) 
+                       {
+                               if (ftp_login($ftp,$user,$pass)) 
+                               {
+                                       return $ftp;
+                               }
+                       }
+               }
+       }
+?>

Added: people/sigurdne/modules/property/trunk/inc/export/default/Basware_X114
===================================================================
--- people/sigurdne/modules/property/trunk/inc/export/default/Basware_X114      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/export/default/Basware_X114      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,869 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage export
+       * @version $Id: Basware_X114 3375 2009-08-14 11:56:22Z sigurd $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       phpgw::import_class('phpgwapi.datetime');
+
+       class export_conv
+       {
+               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
+               
+               var $old_files_deleted;
+               var $debug;
+               
+               function  __construct()
+               {
+                       $GLOBALS['phpgw_info']['flags']['currentapp']   =       
'property';
+                       $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->join                             = & 
$this->db->join;
+
+                       $this->soXport                  = 
CreateObject('property.soXport');     
+                       $this->config                   = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();
+               }
+
+               protected function select_vouchers_to_transfer()
+               {
+                       $sql= "SELECT DISTINCT bilagsnr from fm_ecobilag WHERE 
budsjettsigndato IS NOT NULL AND (saksigndato IS NOT NULL OR oppsynsigndato IS 
NOT NULL) AND utbetalingsigndato IS NOT NULL";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $vouchers = array();
+                       while ($this->db->next_record())
+                       {
+                               $vouchers[]     = $this->db->f('bilagsnr');
+                       }
+                       return $vouchers;
+               }
+
+               protected function log_end($batchid)
+               {
+                       $tid=date($this->soXport->datetimeformat);
+                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','End transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               protected function log_error($batchid,$error_desr)
+               {
+                       $tid = date($this->soXport->datetimeformat);
+                       $sql = "INSERT INTO fm_ecologg 
(batchid,ecobilagid,status,melding,tid) VALUES 
('$batchid',NULL,0,'$error_desr','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               protected function increment_batchid()
+               {
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
value + 1 WHERE name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->query("SELECT value from fm_idgenerator 
WHERE name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $batchid = $this->db->f('value');
+                       return $batchid;
+               }
+
+               protected function next_batchid()
+               {
+                       $this->db->query("SELECT value from fm_idgenerator 
WHERE name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $batchid = $this->db->f('value')+1;
+                       return $batchid;
+               }
+
+               //Lagre start melding
+               protected function log_start($batchid)
+               {
+                       $tid = date($this->db->datetime_format());
+                       $sql= "INSERT INTO fm_ecologg (batchid,melding,tid) 
VALUES ('$batchid','Start transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               protected function get_vendor_info($vendor_id='')
+               {
+                       $sql = "SELECT org_nr, konto_nr FROM fm_vendor WHERE 
id='$vendor_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $vendor_info= array
+                       (
+                               'org_nr' => $this->db->f('org_nr'),
+                               'konto_nr' => $this->db->f('konto_nr')
+                       );
+
+                       return $vendor_info;
+               }
+
+               protected function get_order_title($order_id='')
+               {
+                       $sql = "SELECT type FROM fm_orders WHERE 
id='$order_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       switch($this->db->f('type'))
+                       {
+                               case 'workorder':
+                                       $sql2 = "SELECT title FROM fm_workorder 
WHERE id='$order_id'";
+                                       
$this->db->query($sql2,__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $order_title = $this->db->f('title');
+                                       break;
+                               case 's_agreement':
+                                       $sql2 = "SELECT descr as title FROM 
fm_s_agreement WHERE id='$order_id'";
+                                       
$this->db->query($sql2,__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $order_title = $this->db->f('title');
+                                       break;
+                       }
+
+                       return $order_title;
+               }
+
+
+               protected function select_invoice_rollback($date, $Filnavn)
+               {
+                       $date_array = phpgwapi_datetime::date_array($date);
+                       $day = $date_array['day'];
+                       $month = $date_array['month'];
+                       $year = $date_array['year'];
+
+                       switch($GLOBALS['phpgw_info']['server']['db_type'])
+                       {
+                               case 'mssql':
+                                       $datepart_year          = 
"datepart(year,overftid)";
+                                       $datepart_month         = 
"datepart(month,overftid)";
+                                       $datepart_day           = 
"datepart(day,overftid)";
+                                       break;
+                               case 'mysql':
+                                       $datepart_year          = 
"YEAR(overftid)";
+                                       $datepart_month         = 
"MONTH(overftid)";
+                                       $datepart_day           = 
"DAYOFMONTH(overftid)";
+                                       break;
+                               case 'pgsql':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                               case 'postgres':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                       }
+
+                       $sql="SELECT * FROM fm_ecobilagoverf WHERE 
filnavn='$Filnavn' AND $datepart_year=$year AND $datepart_month=$month AND 
$datepart_day= $day";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $invoice_rollback = array();
+                       while ($this->db->next_record())
+                       {
+                               $invoice_rollback[] = array
+                               (
+                                       'id'                                    
=> $this->db->f('id'),
+                                       'bilagsnr'                              
=> $this->db->f('bilagsnr'),
+                                       'kidnr'                                 
=> $this->db->f('kidnr'),
+                                       'typeid'                                
=> $this->db->f('typeid'),
+                                       'kildeid'                               
=> $this->db->f('kildeid'),
+                                       'pmwrkord_code'                 => 
$this->db->f('pmwrkord_code'),
+                                       'belop'                                 
=> $this->db->f('belop'),
+                                       'fakturadato'                   => 
$this->db->f('fakturadato'),
+                                       'periode'                               
=> $this->db->f('periode'),
+                                       'forfallsdato'                  => 
$this->db->f('forfallsdato'),
+                                       'fakturanr'                             
=> $this->db->f('fakturanr'),
+                                       'spbudact_code'                 => 
$this->db->f('spbudact_code'),
+                                       'regtid'                                
=> $this->db->f('regtid'),
+                                       'artid'                                 
=> $this->db->f('artid'),
+                                       'godkjentbelop'                 => 
$this->db->f('godkjentbelop'),
+                                       'spvend_code'                   => 
$this->db->f('spvend_code'),
+                                       'dima'                                  
=> $this->db->f('dima'),
+                                       'loc1'                                  
=> $this->db->f('loc1'),
+                                       'dimb'                                  
=> $this->db->f('dimb'),
+                                       'mvakode'                               
=> $this->db->f('mvakode'),
+                                       'dimd'                                  
=> $this->db->f('dimd'),
+                                       'project_id'                    => 
$this->db->f('project_id'),
+                                       'kostra_id'                             
=> $this->db->f('kostra_id'),
+                                       'item_type'                             
=> $this->db->f('item_type'),
+                                       'item_id'                               
=> $this->db->f('item_id'),
+                                       'oppsynsmannid'                 => 
$this->db->f('oppsynsmannid'),
+                                       'saksbehandlerid'               => 
$this->db->f('saksbehandlerid'),
+                                       'budsjettansvarligid'   => 
$this->db->f('budsjettansvarligid'),
+                                       'oppsynsigndato'                => 
$this->db->f('oppsynsigndato'),
+                                       'saksigndato'                   => 
$this->db->f('saksigndato'),
+                                       'budsjettsigndato'              => 
$this->db->f('budsjettsigndato'),
+                                       'merknad'                               
=> $this->db->f('merknad'),
+                                       'splitt'                                
=> $this->db->f('splitt'),
+                                       'ordrebelop'                    => 
$this->db->f('ordrebelop'),
+                                       'utbetalingid'                  => 
$this->db->f('utbetalingid'),
+                                       'utbetalingsigndato'    => 
$this->db->f('utbetalingsigndato'),
+                                       'external_ref'                  => 
$this->db->f('external_ref'),
+                               );
+                       }
+                       return $invoice_rollback;
+               }
+
+               //rollback function
+               protected function bilag_update_overf($BilagOverf)
+               {
+                       $values= array
+                       (
+                               $BilagOverf['project_id'],
+                               $BilagOverf['kostra_id'],
+                               $BilagOverf['pmwrkord_code'],
+                               $BilagOverf['bilagsnr'],
+                               $BilagOverf['splitt'],
+                               $BilagOverf['kildeid'],
+                               $BilagOverf['kidnr'],
+                               $BilagOverf['typeid'],
+                               $BilagOverf['fakturadato'],
+                               $BilagOverf['forfallsdato'],
+                               $BilagOverf['regtid'],
+                               $BilagOverf['artid'],
+                               $BilagOverf['spvend_code'],
+                               $BilagOverf['dimb'],
+                               $BilagOverf['oppsynsmannid'],
+                               $BilagOverf['saksbehandlerid'],
+                               $BilagOverf['budsjettansvarligid'],
+                               $BilagOverf['fakturanr'],
+                               $BilagOverf['spbudact_code'],
+                               $BilagOverf['dima'],
+                               $BilagOverf['loc1'],
+                               $BilagOverf['dimd'],
+                               $BilagOverf['mvakode'],
+                               $BilagOverf['periode'],
+                               
$this->db->db_addslashes($BilagOverf['merknad']),
+                               $BilagOverf['utbetalingid'],
+                               $BilagOverf['oppsynsigndato'],
+                               $BilagOverf['saksigndato'],
+                               $BilagOverf['budsjettsigndato'],
+                               $BilagOverf['utbetalingsigndato'],
+                               $BilagOverf['item_type'],
+                               $BilagOverf['item_id'],
+                               $BilagOverf['external_ref'],
+                               $this->db->money_format($BilagOverf['belop']),
+                               
$this->db->money_format($BilagOverf['godkjentbelop'])
+                       );
+                       
+                       $values = $this->db->validate_insert($values);
+
+                       $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
+                       . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
+                       . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
+                       . " 
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,external_ref,belop,godkjentbelop)"
+                       . " values ($values)";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               //Oppdater bel\xF8p p\xE5 arbeidsordre operator="-" ved 
tilbakerulling
+               protected function correct_actual_cost($order_id, $Belop, 
$actual_cost_field, $operator)
+               {
+                       $sql = "SELECT type FROM fm_orders WHERE 
id='$order_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $update_paid = '';
+                       switch($this->db->f('type'))
+                       {
+                               case 'workorder':
+                                       $table = 'fm_workorder';
+                                       if($operator == "-")
+                                       {
+                                               $update_paid = ", paid = 1";
+                                       }
+                                       else
+                                       {
+                                               $update_paid = ", paid = 2";
+                                       }
+                                       break;
+                               case 's_agreement':
+                                       $table = 'fm_s_agreement';
+                                       $actual_cost_field = 'actual_cost';
+                                       break;
+                       }
+
+                       $Belop = $Belop/100;
+
+                       $sql="UPDATE $table SET 
$actual_cost_field=$actual_cost_field $operator $Belop $update_paid WHERE 
id='$order_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               public function overfor($download,$force_period_year='')
+               {
+//                     $download = 'on';
+//                     $download = False;
+                       $this->debug=True;
+
+                       //Generer batch ID
+                       $batchid = $this->soXport->next_batchid();
+                       if ($download=='on')
+                       {
+                               $this->increment_batchid();
+                               //Lagre melding
+                               $this->log_start($batchid);
+                       }
+
+                       //Velg ut alle perioder som har bilag som skal 
overf\xF8res
+                       $vouchers = $this->select_vouchers_to_transfer();
+
+                       foreach ($vouchers as $voucher_id)
+                       {
+                               $receipt['message'][]= array('msg' => 
$this->transfer_voucher($batchid, $voucher_id, $download, $force_period_year));
+                       }
+
+                       //Lagre melding
+                       if ($download=='on')
+                       {
+                               $this->log_end($batchid); //Lagre melding
+                       }
+
+                       return $receipt;
+               }
+               
+               protected function errorhandler($batchid,$error_desr)
+               {
+                       $this->db->transaction_abort();
+
+                       $meld = $error_desr;
+               
+                       //Vis feilmelding
+//                     echo $meld;
+               
+                       //Lagre feilmelding
+                       $this->log_error($batchid,$error_desr);
+               }
+               
+               public function RullTilbake($Filnavn, $date)
+               {                                                               
+                       $voucher = $this->select_invoice_rollback($date, 
$Filnavn);
+                       $this->db->transaction_begin();
+
+                       foreach ($voucher as $line)
+                       {
+                               $this->bilag_update_overf($line);
+
+                               if($line['pmwrkord_code'])
+                               {
+                                       $Belop = sprintf("%01.2f", 
$line['ordrebelop'])*100;
+                               
+                                       if ($line['dimd'] % 2 == 0)
+                                       {
+                                               
$actual_cost_field='act_mtrl_cost';
+                                       }
+                                       else
+                                       {
+                                               
$actual_cost_field='act_vendor_cost';
+                                       }
+               
+                                       $operator='-';
+
+                                       
$this->correct_actual_cost($line['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
+                               }
+               
+                               //Slett fra avviks tabell
+                       //      $this->soXport->delete_avvik($line['bilagsnr']);
+               
+                               //Slett fra arkiv
+                               
$this->soXport->delete_invoice($line['bilagsnr']);
+                       }
+               
+                       $antall = count($voucher);
+                       if($antall > 0)
+                       {               
+                               $fil_katalog = 
$this->config->config_data['export_path'];                       
+                       
+                               if(unlink ($fil_katalog. '/' . $Filnavn))
+                               {
+                                       $this->db->transaction_commit();
+                                       $receipt['message'][]= array('msg' => 
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
+                                       $receipt['message'][]= array('msg' => 
lang('File %1 is deleted',$Filnavn));
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $receipt['message'][]= array('msg' => 
'Noe gikk galt!');
+                               }                                               
        
+                       }
+                       else
+                       {
+                               $receipt['error'][]= array('msg' => lang('Sorry 
- None hits'));
+                       }
+                       return $receipt;
+               }
+                               
+               protected function LagFilnavn ($batchid)
+               {       
+                       $fil_katalog = 
$this->config->config_data['export_path'];
+                       $continue = True;
+                       $i = 1;
+                       do
+                       {
+                               $Filnavn = $fil_katalog . '/x114_' . 
date("dmy") . '_' . sprintf("%02s",$i) . '.TXT';
+
+                               //Sjekk om filen eksisterer
+                               If (!file_exists($Filnavn))
+                               {
+                                       return $Filnavn;
+                               }
+
+                               $i++;
+                       }
+                       while  ($continue);
+                       
+                       //Ingen l\xF8penr er ledige, gi feilmelding
+                       return False;
+               }
+               
+               protected function transfer_voucher($batchid, $voucher_id, 
$download, $force_period_year = '')
+               {
+                       //Bestem filnavn
+                       $Filnavn = $this->LagFilnavn($batchid);
+                       if (!$Filnavn)
+                       {
+                               $message='LagFilnavn: Alle loepenr for filnavn 
er i bruk';
+                               $this->errorhandler($batchid,$message);
+                               return $message;
+                       }
+
+                       //Test om filen kan opprettes og skrives til
+                       if (@fopen($Filnavn, "wb"))
+                       {
+                               unlink($Filnavn);
+                       }
+                       else
+                       {
+                               $message='kan ikke lagre til fil: '. $Filnavn 
.'<br>';
+                               if($this->debug)
+                               {
+                                       echo $message;
+                               }
+                               else
+                               {
+                                       return $message;
+                               }
+                       }
+                       
+                       //Velg ut alle hoved bilag som skal overf\xF8res
+
+                       $this->db->transaction_begin();
+
+                       $oRsBilag = $this->get_voucher($voucher_id);
+                       $antall = count($oRsBilag);
+
+                       $tranfser_bilag = array($oRsBilag[0]['bilagsnr']);
+                       $localtime = phpgwapi_datetime::user_localtime();
+
+                       $transactioninformation = array
+                       (
+                               0 => array
+                               (
+                                       'TRANSACTIONTYPE' => 'X114',
+                                       'TRANSFER' => array
+                                       (
+                                               0 => array
+                                               (
+                                                       'TRANSFERDATE' => 
date('d.m.Y', $localtime),//28.05.2009
+                                                       'TRANSFERTIME' => 
date('H:i:s', $localtime)//14:29:52
+                                               )
+                                       )
+                               )
+                       );
+
+                       $invoiceheader = array
+                       (
+                               0 => array
+                               (
+                                       'TRANSACTIONTYPE'                       
=> 'X114',
+                                       'VOUCHERID'                             
        => $oRsBilag[0]['bilagsnr'], // 70903541
+                                       'SCANNINGNO'                            
=> $oRsBilag[0]['external_ref'], // 11E28NJINL3VR6
+                                       'PROFILE'                               
        => 'TRAINVPOMA',
+                                       'CLIENT.CODE'                           
=> $client_code, //14,
+                                       'POATTRIB1'                             
        => '', //dummy
+                                       'POATTRIB2'                             
        => '', //dummy
+                                       'POPURCHASER'                           
=> '', //dummy
+                                       'PURCHASEORDERNO'                       
=> $oRsBilag[0]['order_id'], // 1409220008
+                                       'PURCHASEORDEROWNER.CODE'       => 
$purchaseorderower, // 100644
+                                       'PURCHASEORDERSTATUS.CODE'      => 'OK',
+                                       'GENERALCOMMENT'                        
=> $comment, // Denne er fakturert i 3 deler OBS OBS!
+                               )
+                       );
+
+                       $accountline = array();
+
+                       if($force_period_year)
+                       {
+                               $periode        = 
sprintf("%06s",$force_period_year . sprintf("%02d",$oRsBilag[0]['periode']));
+                       }
+                       else
+                       {
+                               $periode        = 
sprintf("%06s",date(Y,strtotime($oRsBilag[0]['fakturadato'])) . 
sprintf("%02d",$oRsBilag[0]['periode']));
+                       }
+
+                       foreach ($oRsBilag as $line)
+                       {
+                               //Bestem belops felt
+                               if ($line['splitt'] == 0)
+                               {
+                                       //Bilaget er ikke splittet
+                                       if ($line['godkjentbelop'] <> 
$line['belop'])
+                                       {
+                                               $BelopFelt = 'godkjentbelop';   
                
+                                               //Logg til avviks tabell
+                                               if ($download=='on')
+                                               {
+//                                                     
$this->soXport->log_to_deviation_table($line);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $BelopFelt = 'belop';
+                                       }
+                               }
+                               
+                               //Bilaget er splittet
+                               if ($line['godkjentbelop'] == $line['belop'])
+                               {
+                                       $BelopFelt = 'godkjentbelop';
+                               }
+                               else
+                               {
+                                        //Ikke lovlig
+                                       $message = lang('Avvik mellom 
fakturabelop og godkjent belop pa splittet faktura!');
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+
+                               $amount =  $line[$BelopFelt] * 100; 
+
+                               if($line['order_id'])
+                               {
+                                       //Oppdater bel\xF8p p\xE5 arbeidsordre
+                                       if ($download=='on')
+                                       {
+                                               if ($line['dimd'] % 2 == 0)
+                                               {
+                                                       
$actual_cost_field='act_mtrl_cost';
+                                               }
+                                               else
+                                               {
+                                                       
$actual_cost_field='act_vendor_cost';
+                                               }
+                                               $operator='+';
+                                               
+                                               if(!$this->debug)
+                                               {
+                                                       
$this->correct_actual_cost($line['order_id'],$amount, 
$actual_cost_field,$operator);
+                                               }
+                                       }
+                               }
+
+
+                               $oRsOverfBilag                          = $line;
+                               $oRsOverfBilag['filnavn']       = 
basename($Filnavn);
+                               $oRsOverfBilag['ordrebelop']= $line[$BelopFelt];
+
+                               //Kopier verdier  til fm_ecobilagoverf
+                               if ($download=='on' && !$this->debug)
+                               {
+                                       
$this->soXport->add_OverfBilag($oRsOverfBilag);
+                               }
+
+/*
+                               $Resk_nr        = 
sprintf("%-9s",$oRsBilag[$k]['spvend_code']);// verdi: Blank., type: i4, plass: 
382 - 390
+                               $Att_ansvarlig  = 
sprintf("%-6s",utf8_decode($oRsBilag[$k]['saksbehandler']));// verdi: Blank, 
type: c6, plass: 424 - 429
+
+                               $vendor_info = 
$this->get_vendor_info($oRsBilag[$k]['spvend_code']);
+                               
+                               if(!$vendor_info['org_nr'])
+                               {
+                                       $message = 'mangler org_nr for 
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+
+                               if(!$vendor_info['konto_nr'])
+                               {
+                                       $message = 'mangler konto for 
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+
+                               $Resk_navn      = 
sprintf("%-50s",$vendor_info['org_nr']);// verdi: F\xF8dselsnr, type: c50, 
plass: 430 - 479
+                               $Bank_Postgiro_kontonr = 
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi: 
konto_nr, type: c35, plass: 740 - 774
+
+*/
+
+                               $descr = '';
+                               if($line['merknad'])
+                               {
+                                       $descr = $line['merknad'];
+                               }
+                               else if ($line['order_id'])
+                               {
+                                       $descr = 
$this->get_order_title($line['order_id']);
+                               }
+                               
+                               $accountline[] = array
+                               (
+                                       'TRANSACTIONTYPE'               => 
'R114',
+                                       'ACCOUNTLINK.CODE'              => 
$account_link, // 4180
+                                       'AMOUNT'                                
=> $amount, // 312500
+                                       'APPROVER.FULLNAME'             => 
$approver, //Batch 04 - 14
+                                       'DIMENSION.D1.CODE'             => 
$line['dima'], // 1111
+                                       'DIMENSION.D2.CODE'             => 
$line['dimb'], // 62000
+                                       'DIMENSION.D3.CODE'             => 
$dim3, // dummy
+                                       'DIMENSION.D4.CODE'             => 
$dim4, // dummy
+                                       'DIMENSION.D5.CODE'             => 
$dim5, // dummy
+                                       'DIMENSION.D6.CODE'             => 
$dim6, // dummy
+                                       'DIMENSION.D7.CODE'             => 
$dim7, // dummy
+                                       'DIMENSION.D8.CODE'             => 
$dim8, // dummy
+                                       'POITEMDESCRIPTION'             => 
$descr, // Suger\xF8r,plast,fleksibelt,20cm
+                                       'POITEMNUMBER'                  => 
$itemnumber, //200200
+                                       'POITEMTYPE'                    => 
$itemtype, // A = Item, B = Special Product (SP), C = Text based  (Misc.)
+                                       'POLINENUMBER'                  => 
$linenumber, // 10
+                                       'RECEIVER.FULLNAME'             => 
$receiver, // Batch 04 - 14
+                                       'STATUS'                                
=> 5,
+                                       'SUBACCOUNT'                    => 
$periode, //200905 Accounting period YYYYMM
+                                       'ALLOCATION.KEY'                => 
$distribution_code, //0
+                                       'ALLOCATION.PERIOD'             => '' 
//dummy
+                               );              
+
+                       }
+       
+/*
+                       $Dim_1          = 
sprintf("%8s",$oRsOverfBilag['district_id']);// verdi: Ansvarssted, type: c8, 
plass: 29 - 36
+                       $Dim_2          = 
sprintf("%-8s",$oRsOverfBilag['kostra_id']);// verdi: Tjeneste, type: c8, 
plass: 37 - 44
+                       $Dim_3          = 
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,6));// verdi: Objekt-bygg, type: 
c8, plass: 45 - 52
+                       $Dim_4          = sprintf("%-8s",'');// verdi: Ressurs, 
type: c8, plass: 53 - 60
+                       $Dim_5          = 
sprintf("%-12s",$oRsOverfBilag['project_id']);// verdi: Prosjekt, type: c12, 
plass: 61 - 72
+                       $Dim_6          = 
sprintf("%-4s",$oRsOverfBilag['dimd']);// verdi: Blank, type: c4, plass: 73 - 76
+                       $Dim_7          = sprintf("%-4s",'');// verdi: Blank, 
type: c4, plass: 77 - 80
+*/
+
+                       $invoices = array
+                       (
+                               0 => array
+                               (
+                                       'INVOICE' => array
+                                       (
+                                               0 => array
+                                               (
+                                                       'INVOICEHEADER' => 
$invoiceheader,
+                                                       'ACCOUNTLINES' => array
+                                                       (
+                                                               0 => array
+                                                               (
+                                                                       
'ACCOUNTLINE' => $accountline
+                                                               )
+                                                       )
+                                               )
+                                       )
+                               )
+                       );
+
+                       $export_data = array
+                       (
+                               'TRANSACTIONINFORMATION'        => 
$transactioninformation,
+                               'INVOICES'                                      
=> $invoices                            
+                       );
+
+                       $xmltool = CreateObject('phpgwapi.xmltool');    
+
+                       $buffer = $xmltool->import_var('INVOICEIMPORT', 
$export_data,true, true);
+                       $buffer = str_replace('<INVOICEIMPORT>', 
'<INVOICEIMPORT TYPE="INVOICE">', $buffer);
+                       
+_debug_array(date('H:i:s', phpgwapi_datetime::user_localtime()));
+                       echo $buffer; die();
+//-- fortsett her....                                                          
        
+
+                       //Slett bilaget i fm_ecobilag
+                       if ($download=='on' && !$this->debug)
+                       {
+                               $this->_delete_from_fm_ecobilag($voucher_id);   
        
+                               //Logg transaksjon              
+                               
$this->soXport->log_transaction($batchid,$voucher_id,lang('Invoice 
tranferred'));
+                       }
+                               
+                       //Fullf\xF8r transaksjon
+                       if ($download=='on' && !$this->debug):
+                       {
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+                               
+                               if(fclose($fp))
+                               {
+                                       $file_written=True;
+                               }
+
+                               if($file_written && 
$this->config->config_data['invoice_export_method']!='ftp'):
+                               {
+                                       $transfer_ok = True;
+                               }
+                               elseif($file_written):
+                               {
+                                       $transfer_ok = 
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
+                               }
+                               endif;
+
+                               if($transfer_ok)
+                               {
+                                       $this->db->transaction_commit();
+                                       $message = "Antall bilag/underbilag 
overfort: {$antall}, fil: {$Filnavn}";
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $message = 'Noe gikk galt med 
overforing av godkjendte fakturaer!';                             
+                               }
+                       }
+                       else:
+                       {
+                               $message = $buffer;
+                               $this->db->transaction_abort();
+
+                       }
+                       endif;
+
+                       return $message;
+               }
+               
+       protected function get_voucher($bilagsnr)
+       {
+                       $bilagsnr = (int)$bilagsnr;
+                       $sql= "SELECT fm_ecobilag.*,fm_ecouser.initials as 
saksbehandler FROM fm_ecobilag $this->join fm_ecouser ON 
fm_ecobilag.budsjettansvarligid=fm_ecouser.lid WHERE bilagsnr = {$bilagsnr}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $voucher = array();
+                       while ($this->db->next_record())
+                       {
+                               $voucher[] = array
+                               (
+                                       'id'                                    
=> $this->db->f('id'),
+                                       'bilagsnr'                              
=> $bilagsnr,
+                                       'kidnr'                                 
=> $this->db->f('kidnr'),
+                                       'typeid'                                
=> $this->db->f('typeid'),
+                                       'kildeid'                               
=> $this->db->f('kildeid'),
+                                       'order_id'                              
=> $this->db->f('pmwrkord_code'),
+                                       'belop'                                 
=> $this->db->f('belop'),
+                                       'fakturadato'                   => 
$this->db->f('fakturadato'),
+                                       'periode'                               
=> $this->db->f('periode'),
+                                       'forfallsdato'                  => 
$this->db->f('forfallsdato'),
+                                       'fakturanr'                             
=> $this->db->f('fakturanr'),
+                                       'spbudact_code'                 => 
$this->db->f('spbudact_code'),
+                                       'regtid'                                
=> $this->db->f('regtid'),
+                                       'artid'                                 
=> $this->db->f('artid'),
+                                       'godkjentbelop'                 => 
$this->db->f('belop'),
+                                       'spvend_code'                   => 
$this->db->f('spvend_code'),
+                                       'dima'                                  
=> $this->db->f('dima'),
+                                       'dimb'                                  
=> $this->db->f('dimb'),
+                                       'mvakode'                               
=> $this->db->f('mvakode'),
+                                       'dimd'                                  
=> $this->db->f('dimd'),
+                                       'oppsynsmannid'                 => 
$this->db->f('oppsynsmannid'),
+                                       'saksbehandlerid'               => 
$this->db->f('saksbehandlerid'),
+                                       'budsjettansvarligid'   => 
$this->db->f('budsjettansvarligid'),
+                                       'oppsynsigndato'                => 
$this->db->f('oppsynsigndato'),
+                                       'saksigndato'                   => 
$this->db->f('saksigndato'),
+                                       'budsjettsigndato'              => 
$this->db->f('budsjettsigndato'),
+                                       'merknad'                               
=> $this->db->f('merknad'),
+                                       'splitt'                                
=> $this->db->f('splitt'),
+                                       'utbetalingid'                  => 
$this->db->f('utbetalingid'),
+                                       'utbetalingsigndato'    => 
$this->db->f('utbetalingsigndato'),
+                                       'saksbehandler'                 => 
$this->db->f('saksbehandler')
+                               );
+                       }
+
+                       return $voucher;
+       }
+
+               protected function _delete_from_fm_ecobilag($bilagsnr)
+               {
+                       $bilagsnr = (int) $bilagsnr;
+                       $sql="DELETE FROM fm_ecobilag WHERE bilagsnr = 
$bilagsnr";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               protected function 
transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
+               {                       
+
+                       
if($this->config->config_data['invoice_export_method']=='ftp')
+                       {
+                               $ftp    = $this->phpftp_connect();      
+                               
+                               $basedir = 
$this->config->config_data['invoice_ftp_basedir'];
+                               if($basedir)
+                               {
+                                       $newfile = $basedir . '/' . 
basename($Filnavn);
+                               }
+                               else
+                               {
+                                       $newfile = basename($Filnavn);
+                               }
+
+                               if (ftp_put($ftp,$newfile, $Filnavn, 
FTP_BINARY))
+                               {
+                                       for 
($i=0;$i<count($tranfser_bilag);$i++)
+                                       {                               
+                                               
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice 
pre_transferred %1',basename($Filnavn)));
+                                       }
+                                       $transfer_ok = True;
+                               }
+                               else
+                               {
+                                       for 
($i=0;$i<count($tranfser_bilag);$i++)
+                                       {                               
+                                               
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to 
pre_transfere %1 to agresso',basename($Filnavn)));
+                                       }
+                                       $transfer_ok = False;
+                               }
+                               if(!$transfer_ok)
+                               {
+                                       unlink($Filnavn);
+                               }
+                       
+                               ftp_quit($ftp);
+                       }
+                       return  $transfer_ok;
+               }
+
+               protected function phpftp_connect() 
+               {
+                       $host = $this->config->config_data['invoice_ftp_host'];
+                       $user = $this->config->config_data['invoice_ftp_user'];
+                       $pass = $this->config->config_data['invoice_ftp_pw'];
+                       
+//                     echo "connecting to $host with $user and $pass\n <br>";
+                       $ftp = ftp_connect($host);
+                       if($ftp) 
+                       {
+                               if (ftp_login($ftp,$user,$pass)) 
+                               {
+                                       return $ftp;
+                               }
+                       }
+               }
+       }
+?>

Added: people/sigurdne/modules/property/trunk/inc/export/default/Ecolink
===================================================================
--- people/sigurdne/modules/property/trunk/inc/export/default/Ecolink           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/export/default/Ecolink   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,662 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage export
+       * @version $Id: Ecolink,v 1.10 2007/01/26 14:58:55 sigurdne Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class export_conv
+       {
+               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
+               function export_conv()
+               {
+                       $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+       //              $this->db                       = $GLOBALS['phpgw']->db;
+
+                       $this->soXport = CreateObject('property.soXport');      
+                       $this->config = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();
+                       $this->bocommon                 = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->db               = $this->bocommon->new_db();    
                
+               }
+
+               function select_periods_with_invoice_to_transfer()
+               {
+                       $sql= "SELECT DISTINCT periode from fm_ecobilag where 
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is 
not null) and utbetalingsigndato is not null ";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $periode[]      = $this->db->f('periode');
+                       }
+                       return $periode;
+               }
+
+               function log_end($batchid)
+               {
+                       $tid=date($this->soXport->datetimeformat);
+                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','End transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function log_error($batchid,$error_desr)
+               {
+                       $tid=date($this->datetimeformat);
+                       $sql= "insert into fm_ecologg 
(batchid,ecobilagid,status,melding,tid) values 
('$batchid',NULL,0,'$error_desr','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function increment_batchid()
+               {
+
+                       $this->db->query("update fm_idgenerator  set value = 
value + 1 where name = 'Ecobatchid'");
+                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'");
+                       $this->db->next_record();
+                       $bilagsnr = $this->db->f('value');
+                       return $bilagsnr;
+
+               }
+
+               function next_batchid()
+               {
+
+                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'");
+                       $this->db->next_record();
+                       $batchid = $this->db->f('value')+1;
+
+                       return $batchid;
+               }
+
+               //Lagre start melding
+               function log_start($batchid)
+               {
+                       $tid=date($this->soXport->datetimeformat);
+                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','Start transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               function select_invoice_roleback($day,$month,$year,$Filnavn)
+               {
+
+                       switch($GLOBALS['phpgw_info']['server']['db_type'])
+                       {
+                               case 'mssql':
+                                       $datepart_year          = 
"datepart(year,overftid)";
+                                       $datepart_month         = 
"datepart(month,overftid)";
+                                       $datepart_day           = 
"datepart(day,overftid)";
+                                       break;
+                               case 'mysql':
+                                       $datepart_year          = 
"YEAR(overftid)";
+                                       $datepart_month         = 
"MONTH(overftid)";
+                                       $datepart_day           = 
"DAYOFMONTH(overftid)";
+                                       break;
+                               case 'pgsql':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                               case 'postgres':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                       }
+
+
+                       $sql="select * from fm_ecobilagoverf where 
filnavn='$Filnavn' and $datepart_year=$year and $datepart_month=$month and 
$datepart_day= $day";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $i = 0;
+                       while ($this->db->next_record())
+                       {
+                               $invoice_roleback[$i]['id']     = 
$this->db->f('id');
+                               $invoice_roleback[$i]['bilagsnr']       = 
$this->db->f('bilagsnr');
+                               $invoice_roleback[$i]['kidnr']  = 
$this->db->f('kidnr');
+                               $invoice_roleback[$i]['typeid'] = 
$this->db->f('typeid');
+                               $invoice_roleback[$i]['kildeid']        = 
$this->db->f('kildeid');
+                               $invoice_roleback[$i]['pmwrkord_code']  = 
$this->db->f('pmwrkord_code');
+                               $invoice_roleback[$i]['belop']  = 
$this->db->f('belop');
+                               $invoice_roleback[$i]['fakturadato']    = 
$this->db->f('fakturadato');
+                               $invoice_roleback[$i]['periode']        = 
$this->db->f('periode');
+                               $invoice_roleback[$i]['forfallsdato']   = 
$this->db->f('forfallsdato');
+                               $invoice_roleback[$i]['fakturanr']      = 
$this->db->f('fakturanr');
+                               $invoice_roleback[$i]['spbudact_code']  = 
$this->db->f('spbudact_code');
+                               $invoice_roleback[$i]['regtid'] = 
$this->db->f('regtid');
+                               $invoice_roleback[$i]['artid']  = 
$this->db->f('artid');
+                               $invoice_roleback[$i]['godkjentbelop']  = 
$this->db->f('godkjentbelop');
+                               $invoice_roleback[$i]['spvend_code']    = 
$this->db->f('spvend_code');
+                               $invoice_roleback[$i]['dima']   = 
$this->db->f('dima');
+                               $invoice_roleback[$i]['loc1']   = 
$this->db->f('loc1');
+                               $invoice_roleback[$i]['dimb']   = 
$this->db->f('dimb');
+                               $invoice_roleback[$i]['mvakode']        = 
$this->db->f('mvakode');
+                               $invoice_roleback[$i]['dimd']   = 
$this->db->f('dimd');
+                               if($this->db->f('oppsynsmannid'))
+                               {
+                                       $invoice_roleback[$i]['oppsynsmannid']  
= $this->db->f('oppsynsmannid');
+                               }
+                               if($this->db->f('saksbehandlerid'))
+                               {
+                                       
$invoice_roleback[$i]['saksbehandlerid']        = 
$this->db->f('saksbehandlerid');
+                               }
+
+                               $invoice_roleback[$i]['budsjettansvarligid']    
= $this->db->f('budsjettansvarligid');
+
+                               if($this->db->f('oppsynsigndato'))
+                               {
+                                       $invoice_roleback[$i]['oppsynsigndato'] 
= $this->db->f('oppsynsigndato');
+                               }
+                               if($this->db->f('saksigndato'))
+                               {
+                                       $invoice_roleback[$i]['saksigndato']    
= $this->db->f('saksigndato');
+                               }
+
+                               $invoice_roleback[$i]['budsjettsigndato']       
= $this->db->f('budsjettsigndato');
+                               $invoice_roleback[$i]['merknad']        = 
$this->db->f('merknad');
+                               $invoice_roleback[$i]['splitt'] = 
$this->db->f('splitt');
+                               $invoice_roleback[$i]['ordrebelop']     = 
$this->db->f('ordrebelop');
+                               $invoice_roleback[$i]['utbetalingid']   = 
$this->db->f('utbetalingid');
+                               $invoice_roleback[$i]['utbetalingsigndato']     
= $this->db->f('utbetalingsigndato');
+                               $i++;
+                       }
+                       return $invoice_roleback;
+               }
+
+
+               //roleback function
+               function bilag_update_overf($BilagOverf)
+               {
+                       $values= array(
+                               $BilagOverf['pmwrkord_code'],
+                               $BilagOverf['bilagsnr'],
+                               $BilagOverf['splitt'],
+                               $BilagOverf['kildeid'],
+                               $BilagOverf['kidnr'],
+                               $BilagOverf[typeid],
+                               $BilagOverf['fakturadato'],
+                               $BilagOverf['forfallsdato'],
+                               $BilagOverf['regtid'],
+                               $BilagOverf['artid'],
+                               $BilagOverf['spvend_code'],
+                               $BilagOverf['dimb'],
+                               $BilagOverf['oppsynsmannid'],
+                               $BilagOverf['saksbehandlerid'],
+                               $BilagOverf['budsjettansvarligid'],
+                               $BilagOverf['fakturanr'],
+                               $BilagOverf['spbudact_code'],
+                               $BilagOverf['dima'],
+                               $BilagOverf['loc1'],
+                               $BilagOverf['dimd'],
+                               $BilagOverf['mvakode'],
+                               $BilagOverf['periode'],
+                               $BilagOverf['merknad'],
+                               $BilagOverf['utbetalingid'],
+                               $BilagOverf['oppsynsigndato'],
+                               $BilagOverf['saksigndato'],
+                               $BilagOverf['budsjettsigndato'],
+                               $BilagOverf['utbetalingsigndato'],
+                               );
+                       
+                       $values = $this->bocommon->validate_db_insert($values);
+
+                       $sql= "INSERT INTO fm_ecobilag 
(pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
+                       . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
+                       . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
+                       . " 
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,belop,godkjentbelop)"
+                       . " values ($values,"
+                       . $this->bocommon->moneyformat($BilagOverf['belop']) . 
","
+                       . 
$this->bocommon->moneyformat($BilagOverf['godkjentbelop']) . ")";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+
+               //Oppdater bel\xF8p p\xE5 arbeidsordre operator="-" ved 
tilbakerulling
+               function 
correct_actual_cost($pmwrkord_code,$Belop,$actual_cost_field,$operator)
+               {
+                       $Belop=$Belop/100;
+
+                       $sql="update fm_workorder set 
$actual_cost_field=$actual_cost_field $operator $Belop where 
id='$pmwrkord_code'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               // Hent leverand\xF8rklasse
+
+               function select_vendor_class($spvend_code)
+               {
+                       $sql= "select klasse from fm_vendor where 
id=$spvend_code";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $pmlabor_code = $this->db->f('klasse');
+
+                       return $pmlabor_code;
+               }
+
+               function overfor($download)
+               {
+                       //Generer batch ID
+                       $batchid = $this->soXport->next_batchid();
+                       if ($download=='on')
+                       {
+                               $this->increment_batchid();
+                               //Lagre melding
+                               $this->log_start($batchid);
+                       }
+
+                       //Velg ut alle perioder som har bilag som skal 
overf\xF8res
+
+                       $periode = 
$this->select_periods_with_invoice_to_transfer();
+               
+                       for ($i=0;$i<count($periode);$i++)
+                       {
+                               $receipt['message'][]= array('msg' => 
$this->OverforPeriode($batchid,$periode[$i],$download));
+                       }
+
+                       //Lagre melding
+                       if ($download=='on')
+                       {
+                               $this->log_end($batchid); //Lagre melding
+                       }
+
+                       return $receipt;
+               }
+               
+               function errorhandler($error_desr)
+               {
+                       $meld = $error_desr;
+               
+                       //Vis feilmelding
+//                     echo $meld;
+               
+                       //Lagre feilmelding
+                       $this->log_error($batchid,$error_desr);
+               }
+               
+               function RullTilbake($Filnavn,$Dato)
+               {                                                               
+                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       $dateformat = str_replace(".","",$dateformat);
+                       $dateformat = str_replace("-","",$dateformat);
+                       $dateformat = str_replace("/","",$dateformat);
+                       $y=strpos($dateformat,'y');
+                       $d=strpos($dateformat,'d');
+                       $m=strpos($dateformat,'m');
+       
+                       $dateparts = explode('/', $Dato);
+                       $day = $dateparts[$d];
+                       $month = $dateparts[$m];
+                       $year = $dateparts[$y];
+        /*             $date1 = mktime (2,0,0,$month,$day,$year);
+                       if ($date1)
+                       {
+                               $Dato=$date1;
+                       }
+       
+                       $Dato= date("M d Y",$Dato);
+       */
+                       
+                       
$BilagOverf=$this->select_invoice_roleback($day,$month,$year,$Filnavn);
+                       $this->db->transaction_begin();
+
+                       for ($i=0;$i<count($BilagOverf);$i++)
+                       {
+                               $this->bilag_update_overf($BilagOverf[$i]);
+                               
+               
+                               if($BilagOverf[$i]['pmwrkord_code'])
+                               {
+                                       if ($BilagOverf[$i]['artid']==1)
+                                       {
+                                               $Belop = sprintf("%01.2f", 
$BilagOverf[$i]['ordrebelop'])*100;
+                                       }
+                                       else
+                                       {
+                                               $Belop = sprintf("%01.2f", 
-$BilagOverf[$i]['ordrebelop'])*100;
+                                       }
+                               
+                                       if ($BilagOverf[$i]['dimd'] % 2 == 0)
+                                       {
+                                               
$actual_cost_field='act_mtrl_cost';
+                                       }
+                                       else
+                                       {
+                                               
$actual_cost_field='act_vendor_cost';
+                                       }
+               
+                                       $operator='-';
+
+                                       
$this->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
+                               }
+               
+                               //Slett fra avviks tabell
+                       //      
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
+               
+                               //Slett fra arkiv
+                               
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
+               
+                               $antall = $antall + 1;
+                       }
+               
+                       if($antall > 0)
+                       {               
+                               $fil_katalog = 
$this->config->config_data['export_path'];                       
+                       
+                               if(unlink ($fil_katalog. '/' . $Filnavn))
+                               {
+                                       $this->db->transaction_commit();
+                                       $receipt['message'][]= array('msg' => 
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
+                                       $receipt['message'][]= array('msg' => 
lang('File %1 is deleted',$Filnavn));
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $receipt['message'][]= array('msg' => 
'Noe gikk galt!');
+                               }                                               
        
+                       }
+                       else
+                       {
+                               $receipt['error'][]= array('msg' => lang('Sorry 
- None hits'));
+                       }
+                       return $receipt;
+               }
+                               
+               
+               function LagFilnavn ($batchid)
+               {       
+                       $fil_katalog = 
$this->config->config_data['export_path'];
+                       //Beregn l\xF8penr
+                       $StartLopeNr = ($batchid % 30) + 70;
+                       $LopeNr = $StartLopeNr;
+               
+                       do
+                       {
+                               //Konstruer filnavn
+                               $Filnavn = $fil_katalog . '/DTF1'. 
sprintf("%2d",$LopeNr) . '10.TXT';
+               
+                               //Sjekk om filen eksisterer
+                               If (!file_exists($Filnavn))
+                               {
+                                       return $Filnavn;
+                               }
+               
+                               //Genererer nytt l\xF8penr
+                               $batchid = $batchid + 1;
+                               $LopeNr = ($batchid % 30) + 70;
+                       }
+                       while  ($LopeNr != $StartLopeNr);
+               
+                       //Ingen l\xF8penr er ledige, gi feilmelding
+                       return False;
+               }
+               
+               function OverforPeriode($batchid,$periode,$download)
+               {
+                       $BilagId = 'NULL';
+       
+                       //Bestem filnavn
+                       
+                       $Filnavn = $this->LagFilnavn($batchid);
+                       if (!$Filnavn)
+                       {
+                               $message='LagFilnavn'.lang('Alle l\xF8penr for 
filnavn er i bruk!');
+                               $this->errorhandler($message);
+                               return $message;
+                       }
+
+                       //Test om filen kan opprettes og skrives til
+                       if (@fopen($Filnavn, "wb"))
+                       {
+                               unlink($Filnavn);
+                       }
+                       else
+                       {
+                               $message='kan ikke lagre til fil: '. $Filnavn 
.'<br>';
+                               return $message;
+                       }
+                       
+                       //Velg ut alle hoved bilag som skal overf\xF8res
+               
+                       $oRsBilag=$this->soXport->hoved_bilag($periode);
+                                                                       
+                       $this->db->transaction_begin();
+
+                       $bilag_count= count($oRsBilag);
+                       for ($k=0;$k<$bilag_count;$k++)
+                       {                               
+                               //Hent leverand\xF8rklasse
+                               
+                               $pmlabor_code 
=$this->select_vendor_class($oRsBilag[$k]['spvend_code']);
+                               
+                               //Bestem belops felt
+                               if ($oRsBilag[$k]['splitt']==0)
+                               {
+                                       //Bilaget er ikke splittet
+                                       if ($oRsBilag[$k]['godkjentbelop'] <> 
$oRsBilag[$k]['belop'])
+                                       {
+                                               $BelopFelt = 'godkjentbelop';   
                
+                                               //Logg til avviks tabell
+                                               if ($download=='on')
+                                               {
+//                                                     
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $BelopFelt = 'belop';
+                                       }
+                               }
+                               
+                               //Bilaget er splittet
+                               if ($oRsBilag[$k]['godkjentbelop'] == 
$oRsBilag[$k]['belop'])
+                               {
+                                       $BelopFelt = 'godkjentbelop';
+                               }
+                               else
+                               {
+                                        //Ikke lovlig
+                                       $message = lang('Avvik mellom 
fakturabel\xF8p og godkjent bel\xF8p p\xE5 splittet faktura!');
+                                       $this->errorhandler($message);
+                                       return $message;
+                               }
+               
+                               //Formater bel\xF8p
+                               if ($oRsBilag[$k]['artid'] == 2)
+                               {
+                                       $Belop = sprintf("%01.2f", 
$oRsBilag[$k][$BelopFelt]);
+                               }
+                               else
+                               {
+                                       $Belop = sprintf("%01.2f", 
-$oRsBilag[$k][$BelopFelt]);
+               
+                               }
+               
+                               $Belop =$Belop *100; 
+               //              $Belop = substr($Belop,0,strlen($Belop) - 3) + 
substr($Belop, -2);
+               
+                               //Skriv hovedbilag
+
+                               $periode_aar    = date("y") . 
sprintf("%02d",$periode);
+                               $f1per          = 
$periode_aar;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f1bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
+                               $f1bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f1bilart       = $oRsBilag[$k]['artid'];
+                               $f1belop        = $Belop;                       
                                
+                               $f1fordat       = 
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
+                               $f1tekst        = '';                           
                                
+                               $f1iper         = 
substr($periode_aar,2,2);//date(m,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f1dime         = $oRsBilag[$k]['spvend_code']; 
                                
+        
+                               $f3per          = 
$periode_aar;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f3bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
+                               $f3rkonto       = $oRsBilag[$k]['spvend_code'];
+                               $f3pnr          = 
substr($oRsBilag[$k]['bilagsnr'],-6);
+                               $f3klasse       = $pmlabor_code;                
                
+                               $f3bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f3bilart       = $oRsBilag[$k]['artid'];
+                               $f3belopr       = $Belop;                       
                                
+                               $f3fordat       = 
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
+                               $f3sakb         = 
$oRsBilag[$k]['saksbehandler'];
+                               $f3idkode       = $oRsBilag[$k]['kidnr'];
+                               $f3tekst        = '';
+               
+                               $buffer .= 'F3 7       1'. $f3per . $f3bilnr . 
sprintf("%6s",$f3rkonto) . sprintf("%6s",$f3pnr)
+                               . '     0'. sprintf("%-4s",$f3klasse). '   ' . 
sprintf("%6s",$f3bildat).sprintf("%2s",$f3bilart)
+                               . 'NOK       1000   
10005'.sprintf("%14s",$f3belopr).'               '.sprintf("%6s",$f3fordat)
+                               . sprintf("%6s",$f3fordat).'     0     0    0   
          001               '
+                               . sprintf("%-8s",$f3sakb).'       0     0     0 
    0     0 01  0           0'
+                               . sprintf("%-28s",$f3idkode).'  0'."\r\n"
+                               .'F112       
1'.sprintf("%4s",$f1per).sprintf("%6s",$f1bilnr).'    2001    2001     0        
   0     0'
+                               . 
sprintf("%2s",$f1bilart).'0'.sprintf("%6s",$f1bildat).sprintf("%6s",$f1fordat)
+                               .'NOK     1000   1000'.sprintf("%6s",$f1dime).' 
    0     0     0     0     0     0     0 0'
+                               . 
sprintf("%15s",$f1belop).sprintf("%15s",$f1tekst).sprintf("%2s",$f1iper).'0101  
            0'
+                               . sprintf("%6s",$f1bilnr).'  0                  
                               '."\r\n";
+               
+               
+                               //Velg ut alle underbilag
+                               
$oRsUnderbilag=$this->soXport->select_underbilag($oRsBilag[$k]['bilagsnr']);    
        
+
+                               $underbilag_count= count($oRsUnderbilag);
+                               for ($i=0;$i<$underbilag_count;$i++)
+                               {
+                                       $BilagId = $oRsUnderbilag[$i]['id'];
+                               
+                                       if ($oRsUnderbilag[$i]['artid'] == 2)
+                                       {               
+                                               $Belop = sprintf("%01.2f", 
-$oRsUnderbilag[$i][$BelopFelt]);
+                                       }
+                                       else
+                                       {
+                                               $Belop = sprintf("%01.2f", 
$oRsUnderbilag[$i][$BelopFelt]);
+                                       }
+                                       
+                                       $Belop =$Belop *100; 
+
+                                       //$Belop = 
substr($Belop,0,strlen($Belop) - 3) + substr($Belop, -2);
+
+       
+                                       if($oRsUnderbilag[$i]['pmwrkord_code'])
+                                       {
+                                               //Hent DIM C
+                                               $dimc = 
$this->soXport->select_dimc($oRsUnderbilag[$i]['pmwrkord_code']);
+               
+                                               //Oppdater bel\xF8p p\xE5 
arbeidsordre
+                                               if ($download=='on')
+                                               {
+                                                       if 
($oRsUnderbilag[$i]['dimd'] % 2 == 0)
+                                                       {
+                                                               
$actual_cost_field='act_mtrl_cost';
+                                                       }
+                                                       else
+                                                       {
+                                                               
$actual_cost_field='act_vendor_cost';
+                                                       }
+                                                       $operator='+';
+                                                       
$this->correct_actual_cost($oRsUnderbilag[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $dimc = '';
+                                       }
+               
+                                       //Overf\xF8r til fm_ecobilagoverf
+               
+                                       $oRsOverfBilag=$oRsUnderbilag[$i];
+                                       $oRsOverfBilag['filnavn']= 
basename($Filnavn);
+                                       
$oRsOverfBilag['ordrebelop']=$oRsUnderbilag[$i][$BelopFelt];
+                                       
$oRsOverfBilag['dima']=substr($oRsOverfBilag['dima'],0,6);
+               
+                                       //Kopier verdier
+                                       if ($download=='on')
+                                       {
+                                               
$this->soXport->add_OverfBilag($oRsOverfBilag);
+                                       }
+                                       //Skriv til fil
+                                       
+                                       $f1kto          = 
$oRsOverfBilag['spbudact_code'];
+                                       $f1dima         = 
substr($oRsOverfBilag['dima'],0,6);
+                                       $f1dimb         = 
$oRsOverfBilag['dimb'];
+                                       $f1dimc         = $dimc;
+                                       $f1dimd         = 
$oRsOverfBilag['dimd'];
+                                       $f1avgkod       = 
$oRsOverfBilag['mvakode'];
+                                       $f1belop        = $Belop;
+                                       $f1tekst        = 
'';//$oRsOverfBilag['merknad'];
+                                       
+                                       $buffer .='F1 2       1'. 
sprintf("%4s",$f1per).sprintf("%6s",$f1bilnr).sprintf("%8s",$f1kto).'       0'
+                                       
.sprintf("%6s",$f1dima).sprintf("%6s",$f1dimb).sprintf("%6s",$f1dimc).sprintf("%6s",$f1dimd).sprintf("%2s",$f1bilart).'0'
+                                       
.sprintf("%6s",$f1bildat).sprintf("%6s",$f1fordat).'NOK     1000   
1000'.sprintf("%6s",$f1dime).'     0     0     0     0     0     0     0'
+                                       
.sprintf("%2s",$f1avgkod).sprintf("%15s",$f1belop).sprintf("%15s",$f1tekst).sprintf("%2s",$f1iper).'0101
              0'
+                                       .sprintf("%6s",$f1bilnr).'  0           
                                      '."\r\n";
+
+                               
+                                       //Slett post i fm_ecobilag
+                                       if ($download=='on')
+                                       {
+                                               
$this->soXport->delete_from_fm_ecobilag($oRsUnderbilag[$i]['id']);              
+                                               //Logg transaksjon              
+                                               
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice tranferred'));
+                                       }
+               
+                                       $BilagId = 'NULL';
+               
+                                       $antall = $antall + 1;
+                               }
+                       }
+                               
+                       $f9per  = $periode_aar;
+                       $buffer .='F999       1'.sprintf("%4s",$f9per).'        
      0            0            0            0              0            0      
      0            0              0              0     0     0     0     0     
0     0     0     0     0                                               
'."\r\n";
+                                       
+                       //Fullf\xF8r transaksjon
+                       //g_db.SluttTransaksjon
+                       
+               
+                       if ($download=='on')
+                       {
+                               $message = 'periode: '.$periode_aar.' antall 
bilag/underbilag overf\xF8rt:'.$antall . ' , fil: ' . $Filnavn;
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+                               if(fclose($fp))
+                               {
+                                       $this->db->transaction_commit();
+
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $message = 'Noe gikk galt!';            
                
+                               }
+                       }
+                       else
+                       {
+                               $message = $buffer;
+                       }
+
+                       return $message;
+               }
+       }
+?>

Added: people/sigurdne/modules/property/trunk/inc/export/default/GABNr
===================================================================
--- people/sigurdne/modules/property/trunk/inc/export/default/GABNr             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/export/default/GABNr     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,175 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage export
+       * @version $Id: GABNr,v 1.10 2007/01/26 14:58:55 sigurdne Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class export_conv
+       {
+               function export_conv()
+               {
+                       $this->soXport          = 
CreateObject('property.soXport');     
+                       $this->config           = 
CreateObject('phpgwapi.config','property');
+                       $this->socommon         = 
CreateObject('property.socommon');
+                       $this->solocation       = 
CreateObject('property.solocation');
+                       $this->config->read_repository();
+                       
+                       $this->db    = $this->socommon->new_db();
+
+                       $this->join                     = $this->socommon->join;
+
+               }
+
+               function overfor($download)
+               {
+                       //Generer batch ID
+                       $batchid = $this->soXport->next_batchid();
+               
+                       $receipt['message'][]= array('msg' => 
$this->OverforGAB($batchid,$download));
+
+                       return $receipt;
+               }               
+               
+               
+               function LagFilnavn ($batchid)
+               {       
+                       $fil_katalog = 
$this->config->config_data['export_path'];
+                       //Beregn l\xF8penr
+                       $StartLopeNr = ($batchid % 30) + 70;
+                       $LopeNr = $StartLopeNr;
+               
+                       do
+                       {
+                               //Konstruer filnavn
+                               $Filnavn = $fil_katalog . '/GABNr'. 
sprintf("%2d",$LopeNr) . '10.TXT';
+               
+                               //Sjekk om filen eksisterer
+                               If (!file_exists($Filnavn))
+                               {
+                                       return $Filnavn;
+                               }
+               
+                               //Genererer nytt l\xF8penr
+                               $batchid = $batchid + 1;
+                               $LopeNr = ($batchid % 30) + 70;
+                       }
+                       while  ($LopeNr != $StartLopeNr);
+               
+                       //Ingen l\xF8penr er ledige, gi feilmelding
+                       return False;
+               }
+               
+               function OverforGAB($batchid,$download)
+               {
+                       //Bestem filnavn
+                       
+                       $Filnavn = $this->LagFilnavn($batchid);
+                       if (!$Filnavn)
+                       {
+                               $message='LagFilnavn'.lang('Alle l\xF8penr for 
filnavn er i bruk!');
+                               return $message;
+                       }
+
+                       //Test om filen kan opprettes og skrives til
+                       if (@fopen($Filnavn, "wb"))
+                       {
+                               unlink($Filnavn);
+                       }
+                       else
+                       {
+                               $message='kan ikke lagre til fil: '. $Filnavn;
+                               return $message;
+                       }
+                       
+                       //Velg ut alle GABNr som skal overf\xF8res
+               
+                       $sql = "SELECT 
loc1_name,gab_id,fm_gab_location.loc1,fm_gab_location.address FROM 
fm_gab_location $this->join fm_location1 on fm_gab_location.loc1 = 
fm_location1.loc1 WHERE owner = 'yes' AND ((fm_location1.category <> 99) OR 
(fm_location1.category IS NULL)) GROUP BY 
gab_id,fm_gab_location.loc1,loc1_name, fm_gab_location.address ORDER by gab_id 
asc";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $gab_list[] = array
+                               (
+                                       'gab_id' => $this->db->f('gab_id'),
+                                       'location_code' => $this->db->f('loc1'),
+                                       'address' => $this->db->f('address'),
+                                       'loc1_name' => 
$this->db->f('loc1_name'),
+                                       );
+                       }                                                       
                
+
+                       $cols_extra=array(0=>'loc1_name');
+                       
+                       $gab_count = count($gab_list);
+                       
+/*                     for ($i=0;$i<$gab_count;$i++)
+                       {
+                               
$location_data=$this->solocation->read_single($gab_list[$i]['location_code']);
+                               for ($j=0;$j<count($cols_extra);$j++)
+                               {
+                                       $gab_list[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
+                               }
+
+                       }
+*/
+                       $buffer = 'GABNr'. '    ' .'Objekt'.'   '.'Adresse' . 
"\r\n";
+
+                       $check_gab_id=array();
+                       
+                       for ($k=0;$k<$gab_count;$k++)
+                       {                               
+                               if (!$check_gab_id[$gab_list[$k]['gab_id']])
+                               {
+                                       
$check_gab_id[$gab_list[$k]['gab_id']]=True;
+                               
+                                       $buffer 
.=substr($gab_list[$k]['gab_id'],-20). '        ' 
.$gab_list[$k]['location_code']. '    ' .$gab_list[$k]['address']."\r\n";
+                               
+                                       $antall = $antall + 1;
+                               }
+                       }
+               
+//                     $buffer .= 'antall:'.'  '.$antall;
+
+                       if ($download=='on')
+                       {
+                               $message = 'Antall GABNr overf\xF8rt:'.$antall 
. ' ,Til fil: ' . $Filnavn;
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+                               fclose($fp);
+                       }
+                       else
+                       {
+                               $message = $buffer;
+                       }
+                       return $message;
+               }
+       }
+?>

Added: 
people/sigurdne/modules/property/trunk/inc/export/default/Kemner_kvittering
===================================================================
--- people/sigurdne/modules/property/trunk/inc/export/default/Kemner_kvittering 
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/export/default/Kemner_kvittering 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,249 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage export
+       * @version $Id: Kemner_kvittering,v 1.6 2007/01/26 14:58:55 sigurdne 
Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class export_conv
+       {
+               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
+               function export_conv()
+               {
+
+                       $this->soXport = CreateObject('property.soXport');      
+                       $this->config = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();                       
+                       $this->socommon                 = 
CreateObject('property.socommon');
+                       $this->db    = $this->socommon->new_db();
+                       $this->join                     = $this->socommon->join;
+
+               }
+
+               function overfor($download)
+               {
+                       //Generer batch ID
+                       $batchid = $this->soXport->next_batchid();
+
+                       //Velg ut alle perioder som har bilag som skal 
overf\xF8res
+
+                       $periode = 
$this->select_periods_with_invoice_to_transfer();
+               
+
+                       for ($i=0;$i<count($periode);$i++)
+                       {
+                               $receipt['message'][]= array('msg' => 
$this->OverforPeriode($batchid,$periode[$i],$download));
+                       }
+
+
+                       return $receipt;
+               }               
+
+               function select_periods_with_invoice_to_transfer()
+               {
+                       $sql= "SELECT DISTINCT periode from fm_ecobilag where 
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is 
not null) and utbetalingsigndato is not null ";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $periode[]      = $this->db->f('periode');
+                       }
+                       return $periode;
+               }
+
+               function errorhandler($error_desr)
+               {
+                       $meld = $error_desr;
+               
+                       //Vis feilmelding
+                       echo $meld;
+
+               }
+               
+               
+               function LagFilnavn ($batchid)
+               {       
+                       $fil_katalog = 
$this->config->config_data['export_path'];
+                       //Beregn l\xF8penr
+                       $StartLopeNr = ($batchid % 30) + 70;
+                       $LopeNr = $StartLopeNr;
+               
+                       do
+                       {
+                               //Konstruer filnavn
+                               $Filnavn = $fil_katalog . '/kemner_kvitt'. 
sprintf("%2d",$LopeNr) . '10.TXT';
+               
+                               //Sjekk om filen eksisterer
+                               If (!file_exists($Filnavn))
+                               {
+                                       return $Filnavn;
+                               }
+               
+                               //Genererer nytt l\xF8penr
+                               $batchid = $batchid + 1;
+                               $LopeNr = ($batchid % 30) + 70;
+                       }
+                       while  ($LopeNr != $StartLopeNr);
+               
+                       //Ingen l\xF8penr er ledige, gi feilmelding
+                       return False;
+               }
+               
+               function OverforPeriode($batchid,$periode,$download)
+               {
+//     echo 'periode :' . $periode . '<BR>';           
+                       $BilagId = 'NULL';
+                       $sum=0;
+                       //Bestem filnavn
+                       
+                       $Filnavn = $this->LagFilnavn($batchid);
+                       if (!$Filnavn)
+                       {
+                               $message='LagFilnavn'.lang('Alle l\xF8penr for 
filnavn er i bruk!');
+                               $this->errorhandler($message);
+                               return $message;
+                       }
+
+                       //Test om filen kan opprettes og skrives til
+                       if (@fopen($Filnavn, "wb"))
+                       {
+                               unlink($Filnavn);
+                       }
+                       else
+                       {
+                               $message='kan ikke lagre til fil: '. $Filnavn 
.'<br>';
+                               return $message;
+                       }
+                       
+                       //Velg ut alle hoved bilag som skal overf\xF8res
+               
+                       $oRsBilag=$this->soXport->hoved_bilag($periode);
+                                                                       
+                       $buffer = 'kidnr'. '    ' .'belop'.'    '.'dato'."\r\n";
+
+                       for ($k=0;$k<count($oRsBilag);$k++)
+                       {                               
+               
+               
+                               //Bestem belops felt
+                               if ($oRsBilag[$k]['splitt']==0)
+                               {
+                                       //Bilaget er ikke splittet
+                                       if ($oRsBilag[$k]['godkjentbelop'] <> 
$oRsBilag[$k]['belop'])
+                                       {
+                                               $BelopFelt = 'godkjentbelop';   
                
+                                               //Logg til avviks tabell
+                                               if ($download=='on')
+                                               {
+//                                                     
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $BelopFelt = 'belop';
+                                       }
+                               }
+                               
+                               //Bilaget er splittet
+                               if ($oRsBilag[$k]['godkjentbelop'] == 
$oRsBilag[$k]['belop'])
+                               {
+                                       $BelopFelt = 'godkjentbelop';
+                               }
+                               else
+                               {
+                                        //Ikke lovlig
+                                       $message = lang('Avvik mellom 
fakturabel\xF8p og godkjent bel\xF8p p\xE5 splittet faktura!');
+                                       $this->errorhandler($message);
+                                       return $message;
+                               }
+               
+                               //Formater bel\xF8p
+                               if ($oRsBilag[$k]['artid'] == 1)
+                               {
+                                       $Belop = sprintf("%01.2f", 
$oRsBilag[$k][$BelopFelt]);
+       //      echo 'Belop :' . $Belop . '<BR>';               
+                               }
+                               else
+                               {
+                                       $Belop = sprintf("%01.2f", 
-$oRsBilag[$k][$BelopFelt]);
+               
+                               }
+               
+                               $Belop =$Belop *100; 
+               //              $Belop = substr($Belop,0,strlen($Belop) - 3) + 
substr($Belop, -2);
+               //echo 'Belop :' . $Belop . '<BR>';             
+               
+                               //Skriv hovedbilag
+
+                               $f1per          = 
$periode;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f1bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
+                               $f1bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f1bilart       = $oRsBilag[$k]['artid'];
+                               $f1belop        = $Belop;                       
                                
+                               $f1fordat       = 
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
+                               $f1tekst        = '';                           
                                
+                               $f1iper         = 
substr($periode,2,2);//date(m,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f1dime         = $oRsBilag[$k]['spvend_code']; 
                                
+        
+                               $f3per          = 
$periode;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f3bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
+                               $f3rkonto       = $oRsBilag[$k]['spvend_code'];
+                               $f3pnr          = 
substr($oRsBilag[$k]['bilagsnr'],-6);
+                               $f3klasse       = $pmlabor_code;                
                
+                               $f3bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
+                               $f3bilart       = $oRsBilag[$k]['artid'];
+                               $f3belopr       = $Belop;                       
                                
+                               $f3fordat       = 
date(dmY,strtotime($oRsBilag[$k]['forfallsdato']));
+                               $f3sakb         = 
$oRsBilag[$k]['saksbehandler'];
+                               $f3idkode       = $oRsBilag[$k]['kidnr'];
+                               $f3tekst        = '';
+               
+                               $buffer .=substr($f3idkode,-20). '      ' 
.sprintf("%010s",$f3belopr).' 
'.substr($f3fordat,0,2).'.'.substr($f3fordat,2,2).'.'.substr($f3fordat,-4)."\r\n";
+                               $sum = $sum + $Belop;
+                               
+                               $antall = $antall + 1;
+                       }
+               
+                       $buffer .= sprintf("%20s",'Sum:').'     
'.sprintf("%010s",$sum);
+
+                       if ($download=='on')
+                       {
+                               $message = 'Periode: '.$periode.' antall 
bilag/underbilag overf\xF8rt:'.$antall . ' , fil: ' . $Filnavn . '<br>';
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+                               fclose($fp);
+                       }
+                       else
+                       {
+                               $message = $buffer;
+                       }
+                       return $message;
+               }
+       }
+?>

Added: people/sigurdne/modules/property/trunk/inc/hook_config.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/hook_config.inc.php              
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/hook_config.inc.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,82 @@
+<?php
+       /**
+       * Property - configuration hook
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2000-2009 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package phpgroupware
+       * @subpackage property
+       * @category hooks
+       * @version $Id$
+       */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+
+       /**
+       * Get HTML checkbox with groups that are candidates for simplified tts 
interface
+       *
+       * @param $config
+       * @return string HTML checkboxes to be placed in a table
+       */
+       function fmttssimple_group($config)
+       {
+               $groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+               $groups_assigned = isset($config['fmttssimple_group']) ? 
$config['fmttssimple_group'] : array();
+               $out = '';
+               foreach ( $groups as $group => $label)
+               {
+                       $checked = '';
+                       if ( in_array($group, $groups_assigned))
+                       {
+                               $checked = ' checked';
+                       }
+
+                       $out .=  <<<HTML
+                               <tr><td><input type="checkbox" 
name="newsettings[fmttssimple_group][]" value="{$group}" 
{$checked}><label>{$label}</label></td></tr>
+HTML;
+               }
+               return $out;
+       }
+
+       /**
+       * Get HTML checkbox with groups that are candidates for the field 
finnish date at tts
+       *
+       * @param $config
+       * @return string HTML checkboxes to be placed in a table
+       */
+       function fmtts_group_finnish_date($config)
+       {
+               $groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+               $groups_assigned = isset($config['fmtts_group_finnish_date']) ? 
$config['fmtts_group_finnish_date'] : array();
+               $out = '';
+               foreach ( $groups as $group => $label)
+               {
+                       $checked = '';
+                       if ( in_array($group, $groups_assigned))
+                       {
+                               $checked = ' checked';
+                       }
+
+                       $out .=  <<<HTML
+                               <tr><td><input type="checkbox" 
name="newsettings[fmtts_group_finnish_date][]" value="{$group}" 
{$checked}><label>{$label}</label></td></tr>
+HTML;
+               }
+               return $out;
+       }
+
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/hook_config.inc.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/inc/hook_home.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/hook_home.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/hook_home.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc. 
http://www.fsf.org/
        * This file is part of phpGroupWare.
        *
        * phpGroupWare is free software; you can redistribute it and/or modify
@@ -27,45 +27,743 @@
        * @version $Id$
        */
 
-       if 
($GLOBALS['phpgw_info']['user']['preferences']['property']['mainscreen_show_new_updated'])
-       {
+
+       $accound_id = $GLOBALS['phpgw_info']['user']['account_id'];
                $save_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
                $GLOBALS['phpgw_info']['flags']['currentapp'] = 'property';
+       $maxmatches = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+       $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 
5;
 
-               $GLOBALS['phpgw']->translation->add_app('property');
+       $prefs = $GLOBALS['phpgw_info']['user']['preferences'];
 
+
+       if ( isset($prefs['property']['mainscreen_show_new_updated_tts'])
+               && $prefs['property']['mainscreen_show_new_updated_tts'] == 
'yes')
+       {
+
+               $default_status         = 
isset($prefs['property']['tts_status']) ? $prefs['property']['tts_status'] : '';
+               $tts = CreateObject('property.sotts');
+               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => array($default_status, 'O')));
+               $total_records = $tts->total_records;
+
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title'         => 
isset($prefs['property']['mainscreen_tts_title']) && 
$prefs['property']['mainscreen_tts_title']? 
"{$prefs['property']['mainscreen_tts_title']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
                $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
                $GLOBALS['portal_order'][] = $app_id;
+               }
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
 
-               $GLOBALS['phpgw']->portalbox->set_params(array('app_id' => 
$app_id,
-                                                                               
                                'title' => lang('property')));
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
 
-               $GLOBALS['HTTP_POST_VARS']['filter'] = phpgw::get_var('filter') 
= 'open';
-               $property = CreateObject('property.uitts');
+               $category_name = array(); // caching
 
-               $GLOBALS['phpgw']->portalbox->draw($property->index());
+               $portalbox->data = array();
+               foreach ($tickets as $ticket)
+               {
+                       if(!$ticket['subject'])
+                       {
+                               if(!isset($category_name[$ticket['cat_id']]))
+                               {
+                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
+                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
+                               }
+                               else
+                               {
+                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
+                               }
+                       }
 
-               unset($property);
-               $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
+                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']}",
+                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
+                       );
+               }
+
+               echo "\n".'<!-- BEGIN ticket info 
-->'."\n".$portalbox->draw()."\n".'<!-- END ticket info -->'."\n";
+
+               unset($tts);
+               unset($portalbox);
+               unset($category_name);
+               unset($default_status);
        }
 
 
-/*
-       
if($GLOBALS['phpgw_info']['user']['preferences']['property']['mainscreen_show_new_updated'])
+       if ( isset($prefs['property']['mainscreen_show_new_updated_tts_2'])
+               && $prefs['property']['mainscreen_show_new_updated_tts_2'] == 
'yes')
        {
-               $property = CreateObject('property.uitts');
-               $property->bo->start = 0;
-               $property->bo->limit = 5;
-               $property->start = 0;
-               $property->limit = 5;
-               $extra_data = '<td>'."\n".$property->index(false).'</td>'."\n";
 
+               $default_status         = 
isset($prefs['property']['tts_status_2']) ? $prefs['property']['tts_status_2'] 
: '';
+               $tts = CreateObject('property.sotts');
+               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => $default_status));
+               $total_records = $tts->total_records;
+
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title'         => 
isset($prefs['property']['mainscreen_tts_title_2']) && 
$prefs['property']['mainscreen_tts_title_2']? 
"{$prefs['property']['mainscreen_tts_title_2']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
                $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
+                       $GLOBALS['portal_order'][] = $app_id;
+               }
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
+
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
+
+               $category_name = array(); // caching
+
+               $portalbox->data = array();
+               foreach ($tickets as $ticket)
+               {
+                       if(!$ticket['subject'])
+                       {
+                               if(!isset($category_name[$ticket['cat_id']]))
+                               {
+                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
+                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
+                               }
+                               else
+                               {
+                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
+                               }
+       }
+
+                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']}",
+                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
+                       );
+               }
+
+               echo "\n".'<!-- BEGIN ticket info 
-->'."\n".$portalbox->draw()."\n".'<!-- END ticket info -->'."\n";
+
+               unset($tts);
+               unset($portalbox);
+               unset($category_name);
+               unset($default_status);
+       }
+
+
+       if ( isset($prefs['property']['mainscreen_show_new_updated_tts_3'])
+               && $prefs['property']['mainscreen_show_new_updated_tts_3'] == 
'yes')
+       {
+
+               $default_status         = 
isset($prefs['property']['tts_status_3']) ? $prefs['property']['tts_status_3'] 
: '';
+               $tts = CreateObject('property.sotts');
+               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => $default_status));
+               $total_records = $tts->total_records;
+
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title'         => 
isset($prefs['property']['mainscreen_tts_title_3']) && 
$prefs['property']['mainscreen_tts_title_3']? 
"{$prefs['property']['mainscreen_tts_title_3']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
                $GLOBALS['portal_order'][] = $app_id;
+               }
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
 
-               $GLOBALS['phpgw']->portalbox->set_params(array('app_id' => 
$app_id,
-                                                                               
                                'title' => lang('property')));
-               $GLOBALS['phpgw']->portalbox->draw($extra_data);
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
        }
-*/
 
+               $category_name = array(); // caching
+
+               $portalbox->data = array();
+               foreach ($tickets as $ticket)
+               {
+                       if(!$ticket['subject'])
+                       {
+                               if(!isset($category_name[$ticket['cat_id']]))
+                               {
+                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
+                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
+                               }
+                               else
+                               {
+                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
+                               }
+                       }
+                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']}",
+                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
+                       );
+               }
+
+               echo "\n".'<!-- BEGIN ticket info 
-->'."\n".$portalbox->draw()."\n".'<!-- END ticket info -->'."\n";
+
+               unset($tts);
+               unset($portalbox);
+               unset($category_name);
+               unset($default_status);
+       }
+
+       // ticket initiated by user
+       if ( isset($prefs['property']['mainscreen_show_new_updated_tts_4'])
+               && $prefs['property']['mainscreen_show_new_updated_tts_4'] == 
'yes')
+       {
+
+               $default_status         = 
isset($prefs['property']['tts_status_4']) ? $prefs['property']['tts_status_4'] 
: '';
+               $tts = CreateObject('property.sotts');
+               $tickets = $tts->read(array('owner_id' => $accound_id, 
'status_id' => $default_status));
+               $total_records = $tts->total_records;
+
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title'         => 
isset($prefs['property']['mainscreen_tts_title_4']) && 
$prefs['property']['mainscreen_tts_title_4']? 
"{$prefs['property']['mainscreen_tts_title_4']} ({$total_records})" : 
lang('Helpdesk') . " ({$total_records})",
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
+                       $GLOBALS['portal_order'][] = $app_id;
+               }
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
+
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
+
+                               $status = array();
+                               $status['X'] = array
+                               (
+                                       'name'                  => 
lang('closed'),
+                               );
+                               $status['O'] = array
+                               (
+                                       'name'                  => lang('open'),
+                               );
+
+                               $custom_status  = 
execMethod('property.botts.get_custom_status');
+
+                               foreach($custom_status as $custom)
+                               {
+                                       $status["C{$custom['id']}"] = array
+                                       (
+                                               'status'                        
=> $custom['name'],
+                                       );
+                               }
+
+               $category_name = array(); // caching
+
+               $portalbox->data = array();
+               foreach ($tickets as $ticket)
+               {
+                       if(!$ticket['subject'])
+                       {
+                               if(!isset($category_name[$ticket['cat_id']]))
+                               {
+                                       $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
+                                       $category_name[$ticket['cat_id']] = 
$ticket['subject'];
+                               }
+                               else
+                               {
+                                       $ticket['subject'] = 
$category_name[$ticket['cat_id']];
+                               }
+                       }
+                       $location = 
execMethod('property.bolocation.read_single', array('location_code' => 
$ticket['location_code'], 'extra' => array('view' => true))); 
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$location['loc1_name']} :: 
{$ticket['subject']} :: {$status[$ticket['status']]['name']}",
+                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uitts.view', 'id' => $ticket['id']))
+                       );
+               }
+
+               echo "\n".'<!-- BEGIN ticket info 
-->'."\n".$portalbox->draw()."\n".'<!-- END ticket info -->'."\n";
+
+               unset($tts);
+               unset($portalbox);
+               unset($category_name);
+               unset($default_status);
+       }
+
+       if ( isset($prefs['property']['mainscreen_workorder_1'])
+               && $prefs['property']['mainscreen_workorder_1'] == 'yes')
+       {
+
+               $default_status         = 
isset($prefs['property']['workorder_status_mainscreen_1']) ? 
$prefs['property']['workorder_status_mainscreen_1'] : '';
+               $obj = CreateObject('property.soworkorder');
+               $workorders = $obj->read(array('filter' => $accound_id, 
'status_id' => $default_status));
+               $total_records = $obj->total_records;
+
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title' => 
isset($prefs['property']['mainscreen_workorders_1_title']) && 
$prefs['property']['mainscreen_workorders_1_title']? 
"{$prefs['property']['mainscreen_workorders_1_title']} ({$total_records})" : 
lang('workorder') . '::' . lang('list') . ' ' . 1 . "::Status: 
{$default_status} ({$total_records})",
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
+                       $GLOBALS['portal_order'][] = $app_id;
+               }
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
+
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
+
+               $portalbox->data = array();
+               foreach ($workorders as $workorder)
+               {
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$workorder['address']} :: 
{$workorder['title']}",
+                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uiworkorder.edit', 'id' => 
$workorder['workorder_id']))
+                       );
+               }
+
+               echo "\n".'<!-- BEGIN workorder 1 info 
-->'."\n".$portalbox->draw()."\n".'<!-- END workorder 1 info -->'."\n";
+
+               unset($obj);
+               unset($portalbox);
+               unset($default_status);
+       }
+       if ( isset($prefs['property']['mainscreen_workorder_2'])
+               && $prefs['property']['mainscreen_workorder_2'] == 'yes')
+       {
+
+               $default_status         = 
isset($prefs['property']['workorder_status_mainscreen_2']) ? 
$prefs['property']['workorder_status_mainscreen_2'] : '';
+               $obj = CreateObject('property.soworkorder');
+               $workorders = $obj->read(array('filter' => $accound_id, 
'status_id' => $default_status));
+               $total_records = $obj->total_records;
+
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title' => 
isset($prefs['property']['mainscreen_workorders_2_title']) && 
$prefs['property']['mainscreen_workorders_2_title']? 
"{$prefs['property']['mainscreen_workorders_2_title']} ({$total_records})" : 
lang('workorder') . '::' . lang('list') . ' ' . 2 . "::Status: 
{$default_status} ({$total_records})",
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
+                       $GLOBALS['portal_order'][] = $app_id;
+               }
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
+
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
+
+               $portalbox->data = array();
+               foreach ($workorders as $workorder)
+               {
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$workorder['address']} :: 
{$workorder['title']}",
+                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uiworkorder.edit', 'id' => 
$workorder['workorder_id']))
+                       );
+               }
+
+               echo "\n".'<!-- BEGIN workorder 2 info 
-->'."\n".$portalbox->draw()."\n".'<!-- END workorder 2 info -->'."\n";
+
+               unset($obj);
+               unset($portalbox);
+               unset($default_status);
+       }
+
+       if ( isset($prefs['property']['mainscreen_showapprovals_request'])
+               && $prefs['property']['mainscreen_showapprovals_request'] == 
'yes' )
+       {
+               $title = 
isset($prefs['property']['mainscreen_showapprovals_request_title']) && 
$prefs['property']['mainscreen_showapprovals_request_title']? 
"{$prefs['property']['mainscreen_showapprovals_request_title']} 
({$total_records})" : lang('approvals request') . " ({$total_records})";
+       
+               //TODO Make listbox css compliant
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title' => $title,
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
+                       $GLOBALS['portal_order'][] = $app_id;
+               }
+
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
+
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
+
+               $action_params = array
+               (
+                       'appname'                       => 'property',
+                       'location'                      => '.project',
+               //      'id'                            => $id,
+                       'responsible'           => '',
+                       'responsible_type'  => 'user',
+                       'action'                        => 'approval',
+                       'deadline'                      => '',
+                       'created_by'            => $accound_id
+               );
+
+               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+               $portalbox->data = array();
+               foreach ($pending_approvals as $entry)
+               {
+                       $responsible = $entry['responsible'] ? 
$GLOBALS['phpgw']->accounts->get($entry['responsible'])->__toString() : '';
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$responsible}: Prosjekt venter på 
godkjenning: {$entry['item_id']}",
+                               'link' => $entry['url']
+                       );
+               }
+               $action_params = array
+               (
+                       'appname'                       => 'property',
+                       'location'                      => '.project.workorder',
+               //      'id'                            => $id,
+                       'responsible'           => '',
+                       'responsible_type'  => 'user',
+                       'action'                        => 'approval',
+                       'deadline'                      => '',
+                       'created_by'            => $accound_id
+               );
+
+               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+               foreach ($pending_approvals as $entry)
+               {
+                       $responsible = $entry['responsible'] ? 
$GLOBALS['phpgw']->accounts->get($entry['responsible'])->__toString() : '';
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$responsible}: Ordre venter på 
godkjenning: {$entry['item_id']}",
+                               'link' => $entry['url']
+                       );
+               }
+               $action_params = array
+               (
+                       'appname'                       => 'property',
+                       'location'                      => '.ticket',
+               //      'id'                            => $id,
+                       'responsible'           => '',
+                       'responsible_type'  => 'user',
+                       'action'                        => 'approval',
+                       'deadline'                      => '',
+                       'created_by'            => $accound_id
+               );
+
+               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+               foreach ($pending_approvals as $entry)
+               {
+                       $responsible = $entry['responsible'] ? 
$GLOBALS['phpgw']->accounts->get($entry['responsible'])->__toString() : '';
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$responsible}: Melding venter på 
godkjenning: {$entry['item_id']}",
+                               'link' => $entry['url']
+                       );
+               }
+               
+               echo "\n".'<!-- BEGIN approval info 
-->'."\n".$portalbox->draw()."\n".'<!-- END approval info -->'."\n";
+               unset($portalbox);
+               unset($pending_approvals);
+       }
+
+       if ( isset($prefs['property']['mainscreen_showapprovals'])
+               && $prefs['property']['mainscreen_showapprovals'] == 'yes' )
+       {
+               $title = 
isset($prefs['property']['mainscreen_showapprovals_title']) && 
$prefs['property']['mainscreen_showapprovals_title']? 
"{$prefs['property']['mainscreen_showapprovals_title']} ({$total_records})" : 
lang('approvals') . " ({$total_records})";  
+               //TODO Make listbox css compliant
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title' => $title,
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
+                       $GLOBALS['portal_order'][] = $app_id;
+               }
+
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
+
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
+
+               $action_params = array
+               (
+                       'appname'                       => 'property',
+                       'location'                      => '.project',
+               //      'id'                            => $id,
+                       'responsible'           => $accound_id,
+                       'responsible_type'  => 'user',
+                       'action'                        => 'approval',
+                       'deadline'                      => '',
+                       'created_by'            => '',
+               );
+
+               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+               $portalbox->data = array();
+               foreach ($pending_approvals as $entry)
+               {
+                       $portalbox->data[] = array
+                       (
+                               'text' => 'Prosjekt venter på godkjenning: ' . 
$entry['item_id'],
+                               'link' => $entry['url']
+                       );
+               }
+               
+//             echo "\n".'<!-- BEGIN approval info 
-->'."\n".$portalbox->draw()."\n".'<!-- END approval info -->'."\n";
+
+               $action_params = array
+               (
+                       'appname'                       => 'property',
+                       'location'                      => '.project.workorder',
+               //      'id'                            => $id,
+                       'responsible'           => $accound_id,
+                       'responsible_type'  => 'user',
+                       'action'                        => 'approval',
+                       'deadline'                      => '',
+                       'created_by'            => '',
+               );
+
+               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+//             $portalbox->data = array();
+               foreach ($pending_approvals as $entry)
+               {
+                       $portalbox->data[] = array
+                       (
+                               'text' => 'Ordre venter på godkjenning: ' . 
$entry['item_id'],
+                               'link' => $entry['url']
+                       );
+               }
+
+               $action_params = array
+               (
+                       'appname'                       => 'property',
+                       'location'                      => '.ticket',
+               //      'id'                            => $id,
+                       'responsible'           => $accound_id,
+                       'responsible_type'  => 'user',
+                       'action'                        => 'approval',
+                       'deadline'                      => '',
+                       'created_by'            => '',
+               );
+
+               $pending_approvals = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+//             $portalbox->data = array();
+               foreach ($pending_approvals as $entry)
+               {
+                       $portalbox->data[] = array
+                       (
+                               'text' => 'Melding venter på godkjenning: ' . 
$entry['item_id'],
+                               'link' => $entry['url']
+                       );
+               }
+               
+               echo "\n".'<!-- BEGIN approval info 
-->'."\n".$portalbox->draw()."\n".'<!-- END approval info -->'."\n";
+               unset($portalbox);
+               unset($pending_approvals);
+       }
+
+       if ( isset($prefs['property']['mainscreen_showvendor_reminder'])
+               && $prefs['property']['mainscreen_showvendor_reminder']  == 
'yes' )
+       {
+
+               $title = lang('vendor reminder');
+               $title = 
isset($prefs['property']['mainscreen_showvendor_reminder_title']) && 
$prefs['property']['mainscreen_showvendor_reminder_title']? 
"{$prefs['property']['mainscreen_showvendor_reminder_title']} 
({$total_records})" : lang('approvals') . " ({$total_records})";        
+               //TODO Make listbox css compliant
+               $portalbox = CreateObject('phpgwapi.listbox', array
+               (
+                       'title' => $title,
+                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
+                       'width' => '100%',
+                       'outerborderwidth'      => '0',
+                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
+               ));
+
+               $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+               if( !isset($GLOBALS['portal_order']) ||!in_array($app_id, 
$GLOBALS['portal_order']) )
+               {
+                       $GLOBALS['portal_order'][] = $app_id;
+               }
+
+               $var = array
+               (
+                       'up'    => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'down'  => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'close' => array('url'  => '/set_box.php', 'app'        
=> $app_id),
+                       'question'      => array('url'  => '/set_box.php', 
'app'        => $app_id),
+                       'edit'  => array('url'  => '/set_box.php', 'app'        
=> $app_id)
+               );
+
+               foreach ( $var as $key => $value )
+               {
+//                     $portalbox->set_controls($key,$value);
+               }
+
+               $action_params = array
+               (
+                       'appname'                       => 'property',
+                       'location'                      => '.project.workorder',
+               //      'id'                            => $id,
+                       'responsible'           => '',
+                       'responsible_type'  => 'vendor',
+                       'action'                        => 'remind',
+                       'deadline'                      => '',
+                       'created_by'            => $accound_id,
+               );
+
+               $pending_reminder = 
execMethod('property.sopending_action.get_pending_action', $action_params);
+
+               $portalbox->data = array();
+               foreach ($pending_reminder as $entry)
+               {
+                       $sql='SELECT org_name FROM fm_vendor where id=' . 
(int)$entry['responsible'];
+                       $GLOBALS['phpgw']->db;
+                       $GLOBALS['phpgw']->db->query($sql);
+                       $GLOBALS['phpgw']->db->next_record();
+                       $vendor_name =  
$GLOBALS['phpgw']->db->f('org_name',true);
+
+                       $portalbox->data[] = array
+                       (
+                               'text' => "påminning nr {$entry['reminder']} 
til leverandør {$vendor_name}- ordre nr: {$entry['item_id']}",
+                               'link' => $entry['url']
+                       );
+               }
+               
+               echo "\n".'<!-- BEGIN reminder info 
-->'."\n".$portalbox->draw()."\n".'<!-- END reminder info -->'."\n";
+               unset($pending_reminder);
+               unset($portalbox);
+       }
+       
+       $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
+       $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] = 
$maxmatches;
+

Modified: people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -36,21 +36,77 @@
        create_select_box('Choose property 
filter','property_filter',$select_property_filter,'Filter by owner or owner 
type');
 
        $yes_and_no = array(
-               'true' => 'Yes',
-               ''     => 'No'
+               'yes' => 'Yes',
+               'no'     => 'No'
        );
-       create_select_box('show new/updated tickets on main 
screen','mainscreen_show_new_updated',$yes_and_no,'Dont think this is working - 
yet');
 
        create_select_box('Group filters in single 
query','group_filters',$yes_and_no,'Group filters - means that one has to hit 
the search button to apply the filter');
 
-       $tts_status = array(
-               ''              => lang('Open'),
-               'closed'        => lang('Closed'),
-               'all'           => lang('All')
-       );
+       $status_list_tts = execMethod('property.botts._get_status_list');
+       $status_list_workorder = 
execMethod('property.soworkorder.select_status_list');
+       $status_list_project = 
execMethod('property.soproject.select_status_list');
 
-       create_select_box('Default ticket status','tts_status',$tts_status,'The 
default status when entering the helpdesk');
+       if ($status_list_tts)
+       {
+               foreach ( $status_list_tts as $entry )
+               {
+                       $_status_tts[$entry['id']] = $entry['name'];
+               }
+       }
 
+       if ($status_list_workorder)
+       {
+               foreach ( $status_list_workorder as $entry )
+               {
+                       $_status_workorder[$entry['id']] = $entry['name'];
+               }
+       }
+
+       if ($status_list_project)
+       {
+               foreach ( $status_list_project as $entry )
+               {
+                       $_status_project[$entry['id']] = $entry['name'];
+               }
+       }
+
+
+       create_select_box('show new/updated tickets on main 
screen','mainscreen_show_new_updated_tts',$yes_and_no,'Link to tickets you are 
assigned to');
+       create_select_box('Default ticket 
status','tts_status',$_status_tts,'The default status when entering the 
helpdesk and mainscreen');
+       create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title');
+
+       create_select_box('show new/updated tickets on main screen 
2','mainscreen_show_new_updated_tts_2',$yes_and_no,'Link to tickets you are 
assigned to');
+       create_select_box('Default ticket status 
2','tts_status_2',$_status_tts,'The default status when entering the helpdesk 
and mainscreen');
+       create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title_2');
+
+       create_select_box('show new/updated tickets on main screen 
3','mainscreen_show_new_updated_tts_3',$yes_and_no,'Link to tickets you are 
assigned to');
+       create_select_box('Default ticket status 
3','tts_status_3',$_status_tts,'The default status when entering the helpdesk 
and mainscreen');
+       create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title_3');
+
+       create_select_box('show tickets on main screen initiated by 
user','mainscreen_show_new_updated_tts_4',$yes_and_no,'Link to tickets you have 
started');
+       create_select_box('Default ticket status 
4','tts_status_4',$_status_tts,'The default status when entering the helpdesk 
and mainscreen');
+       create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title_4');
+
+       create_select_box('show pending vendor reminders on main 
screen','mainscreen_showvendor_reminder',$yes_and_no,'Reminder issued to 
vendors');
+       create_input_box('Custom title on pending vendor 
reminders','mainscreen_showvendor_reminder_title');
+
+       create_select_box('show your pending request for approvals on main 
screen','mainscreen_showapprovals_request',$yes_and_no,'Your requests for 
Approvals waiting decisions');
+       create_input_box('Custom title on pending request for 
approvals','mainscreen_showapprovals_request_title');
+
+       create_select_box('show pending approvals on main 
screen','mainscreen_showapprovals',$yes_and_no,'Approvals waiting for your 
decisions');
+       create_input_box('Custom title on pending 
approvals','mainscreen_showapprovals_title');
+
+       create_select_box('Default updated ticket status when creating 
project','tts_status_create_project',$_status_tts,'The default status when 
entering the helpdesk and mainscreen');
+       create_select_box('Autocreate project from 
ticket','auto_create_project_from_ticket',$yes_and_no);
+       
+       create_select_box('your workorders on main screen - list 
1','mainscreen_workorder_1',$yes_and_no,'Link to your workorders');
+       create_select_box('Default workorder status 
1','workorder_status_mainscreen_1',$_status_workorder,'The default status for 
list 1 when entering the mainscreen');
+       create_input_box('Custom title on workorders on main screen - list 
1','mainscreen_workorders_1_title');
+
+       create_select_box('your workorders on main screen - list 
2','mainscreen_workorder_2',$yes_and_no,'Link to your workorders');
+       create_select_box('Default workorder status 
2','workorder_status_mainscreen_2',$_status_workorder,'The default status for 
list 2 when entering the mainscreen');
+       create_input_box('Custom title workorders on main screen - list 
2','mainscreen_workorders_2_title');
+
        create_select_box('show quick link for changing status for 
tickets','tts_status_link',$yes_and_no,'Enables to set status wihout entering 
the ticket');
 
        $acc = & $GLOBALS['phpgw']->accounts;
@@ -126,6 +182,7 @@
        create_select_box('Default Degree Request residential 
environment','default_environment',$degree);
 
        create_select_box('Send order receipt as email 
','order_email_rcpt',$yes_and_no,'Send the order as BCC to the user');
+       create_select_box('Notify owner of project/order on 
change','notify_project_owner',$yes_and_no,'By email');
 
        $default_start_page = array(
                'location'   => lang('Location'),
@@ -136,21 +193,10 @@
                );
        create_select_box('Default start 
page','default_start_page',$default_start_page,'Select your start-submodule');
 
-       $soworkorder= CreateObject('property.soworkorder');
        $socommon= CreateObject('property.socommon');
 
-       $status_list= $soworkorder->select_status_list();
-
        $district_list= $socommon->select_district_list();
 
-       if ($status_list)
-       {
-               foreach ( $status_list as $entry )
-               {
-                       $_status[$entry['id']] = $entry['name'];
-               }
-       }
-
        $cats->app_name = 'property.project';
 
        $cat_data       = $cats->formatted_xslt_list(array('globals' => true, 
'link_data' =>array()));
@@ -174,11 +220,13 @@
 
        unset($soworkorder);
        unset($socommon);
-       create_select_box('Default project 
status','project_status',$_status,'The default status for your projects and 
workorders');
+       create_select_box('Default project 
status','project_status',$_status_project,'The default status for your 
projects');
+       create_select_box('Default workorder 
status','workorder_status',$_status_workorder,'The default status for your 
workorders');
        create_select_box('Default project 
categories','project_category',$_categories_project,'The default category for 
your projects and workorders');
        create_select_box('Default 
district-filter','default_district',$_districts,'Your default district-filter 
');
 
        create_input_box('Your Cellphone','cellphone');
+       create_input_box('RessursNr','ressursnr');
 
        create_select_box('Workorder Approval 
From','approval_from',$_accounts,'If you need approval from your supervisor for 
projects/workorders');
 
@@ -208,4 +256,29 @@
        create_input_box('Height of textarea','textarearows','Height of 
textarea in forms');
 
        create_select_box('show horisontal 
menues','horisontal_menus',array('no' => 'No','yes' => 'Yes'),'Horisontal 
menues are shown in top of page');
+       create_select_box('remove navbar','nonavbar',array('no' => 'No','yes' 
=> 'Yes'),'Navigation bar is removed');
        create_select_box('Tabel export format','export_format',array('excel' 
=> 'Excel','csv' => 'CSV', 'ods' => 'ODS'),'Choose which format to export from 
the system for tables');
+
+       $default = 'Fra: __organisation__';
+       $default .= "\n" . 'Saksbehandler: __user_name__, ressursnr: 
__ressursnr__';
+       $default .= "\n";
+       $default .= "\n" . '__location__';
+       $default .= "\n";
+       $default .= "\n" . '[b]Beskrivelse av oppdraget:[/b]';
+       $default .= "\n" . '__order_description__';
+       $default .= "\n";
+       $default .= "\n" . '[b]Kontakt på bygget:[/b]';
+       $default .= "\n";
+       $default .= "\n" . '__contact_name__';
+       $default .= "\n" . '__contact_email__';
+       $default .= "\n" . '__contact_phone__';
+       $default .= "\n";
+       $default .= "\n" . '[b]Faktura må merkes med ordrenummer: __order_id__ 
og ressursnr.: __ressursnr__[/b]';
+       $default .= "\n";       
+       $default .= "\n" . 'Med hilsen';
+       $default .= "\n" . '__user_name__';
+       $default .= "\n" . '__user_phone__';
+       $default .= "\n" . '__user_email__';
+       $default .= "\n" . '__organisation__';
+
+       create_text_area('order 
email','order_email_template',10,60,'',$default);

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_LGPL.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_LGPL.txt               
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_LGPL.txt       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,165 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_LGPL.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/FAQ.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/FAQ.htm           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/FAQ.htm   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,339 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>FAQ</title>
+<link type="text/css" rel="stylesheet" href="fpdf.css">
+<style type="text/css">
+ul {list-style-type:none; margin:0; padding:0}
+ul#answers li {margin-top:1.8em}
+.question {font-weight:bold; color:#900000}
+</style>
+</head>
+<body>
+<h1>FAQ</h1>
+<ul>
+<li><b>1.</b> <a href='#q1'>What's exactly the license of FPDF? Are there any 
usage restrictions?</a></li>
+<li><b>2.</b> <a href='#q2'>When I try to create a PDF, a lot of weird 
characters show on the screen. Why?</a></li>
+<li><b>3.</b> <a href='#q3'>I try to generate a PDF and IE displays a blank 
page. What happens?</a></li>
+<li><b>4.</b> <a href='#q4'>I can't make line breaks work. I put \n in the 
string printed by MultiCell but it doesn't work.</a></li>
+<li><b>5.</b> <a href='#q5'>I try to display a variable in the Header method 
but nothing prints.</a></li>
+<li><b>6.</b> <a href='#q6'>I defined the Header and Footer methods in my PDF 
class but nothing appears.</a></li>
+<li><b>7.</b> <a href='#q7'>Accented characters are replaced by some strange 
characters like é.</a></li>
+<li><b>8.</b> <a href='#q8'>I try to display the Euro symbol but it doesn't 
work.</a></li>
+<li><b>9.</b> <a href='#q9'>I get the following error when I try to generate a 
PDF: Some data has already been output, can't send PDF file</a></li>
+<li><b>10.</b> <a href='#q10'>I draw a frame with very precise dimensions, but 
when printed I notice some differences.</a></li>
+<li><b>11.</b> <a href='#q11'>I'd like to use the whole surface of the page, 
but when printed I always have some margins. How can I get rid of them?</a></li>
+<li><b>12.</b> <a href='#q12'>How can I put a background in my PDF?</a></li>
+<li><b>13.</b> <a href='#q13'>How can I set a specific header or footer on the 
first page?</a></li>
+<li><b>14.</b> <a href='#q14'>I'd like to use extensions provided by different 
scripts. How can I combine them?</a></li>
+<li><b>15.</b> <a href='#q15'>How can I send the PDF by email?</a></li>
+<li><b>16.</b> <a href='#q16'>What's the limit of the file sizes I can 
generate with FPDF?</a></li>
+<li><b>17.</b> <a href='#q17'>Can I modify a PDF with FPDF?</a></li>
+<li><b>18.</b> <a href='#q18'>I'd like to make a search engine in PHP and 
index PDF files. Can I do it with FPDF?</a></li>
+<li><b>19.</b> <a href='#q19'>Can I convert an HTML page to PDF with 
FPDF?</a></li>
+<li><b>20.</b> <a href='#q20'>Can I concatenate PDF files with FPDF?</a></li>
+</ul>
+
+<ul id='answers'>
+<li id='q1'>
+<p><b>1.</b> <span class='question'>What's exactly the license of FPDF? Are 
there any usage restrictions?</span></p>
+FPDF is released under a permissive license: there is no usage restriction. 
You may embed it
+freely in your application (commercial or not), with or without modifications.
+</li>
+
+<li id='q2'>
+<p><b>2.</b> <span class='question'>When I try to create a PDF, a lot of weird 
characters show on the screen. Why?</span></p>
+These "weird" characters are in fact the actual content of your PDF. This 
behavior is a bug of
+IE6. When it first receives an HTML page, then a PDF from the same URL, it 
displays it directly
+without launching Acrobat. This happens frequently during the development 
stage: on the least
+script error, an HTML page is sent, and after correction, the PDF arrives.
+<br>
+To solve the problem, simply quit and restart IE. You can also go to another 
URL and come
+back.
+<br>
+To avoid this kind of inconvenience during the development, you can generate 
the PDF directly
+to a file and open it through the explorer.
+</li>
+
+<li id='q3'>
+<p><b>3.</b> <span class='question'>I try to generate a PDF and IE displays a 
blank page. What happens?</span></p>
+First of all, check that you send nothing to the browser after the PDF (not 
even a space or a
+carriage return). You can put an exit statement just after the call to the 
Output() method to
+be sure. If it still doesn't work, it means you're a victim of the "blank page 
syndrome". IE
+used in conjunction with the Acrobat plug-in suffers from many bugs. To avoid 
these problems
+in a reliable manner, two main techniques exist:
+<br>
+<br>
+- Disable the plug-in and use Acrobat as a helper application. To do this, 
launch Acrobat, go
+to the Edit menu, Preferences, Internet, and uncheck "Display PDF in browser". 
Then, the next
+time you load a PDF in IE, it displays the dialog box "Open it" or "Save it to 
disk". Uncheck
+the option "Always ask before opening this type of file" and choose Open. From 
now on, PDF files
+will open automatically in an external Acrobat window.
+<br>
+The drawback of the method is that you need to alter the client configuration, 
which you can do
+in an intranet environment but not for the Internet.
+<br>
+<br>
+- Use a redirection technique. It consists in generating the PDF in a 
temporary file on the server
+and redirect the client to it. For example, at the end of the script, you can 
put the following:
+<div class="doc-source">
+<pre><code>//Determine a temporary file name in the current directory
+$file = basename(tempnam('.', 'tmp'));
+rename($file, $file.'.pdf');
+$file .= '.pdf';
+//Save PDF to file
+$pdf-&gt;Output($file, 'F');
+//Redirect
+header('Location: '.$file);</code></pre>
+</div>
+This method turns the dynamic PDF into a static one and avoids all troubles. 
But you have to do
+some cleaning in order to delete the temporary files. For example:
+<div class="doc-source">
+<pre><code>function CleanFiles($dir)
+{
+    //Delete temporary files
+    $t = time();
+    $h = opendir($dir);
+    while($file=readdir($h))
+    {
+        if(substr($file,0,3)=='tmp' and substr($file,-4)=='.pdf')
+        {
+            $path = $dir.'/'.$file;
+            if($t-filemtime($path)&gt;3600)
+                @unlink($path);
+        }
+    }
+    closedir($h);
+}</code></pre>
+</div>
+This function deletes all files of the form tmp*.pdf older than an hour in the 
specified
+directory. You may call it where you want, for example in the script which 
generates the PDF.
+</li>
+
+<li id='q4'>
+<p><b>4.</b> <span class='question'>I can't make line breaks work. I put \n in 
the string printed by MultiCell but it doesn't work.</span></p>
+You have to enclose your string with double quotes, not single ones.
+</li>
+
+<li id='q5'>
+<p><b>5.</b> <span class='question'>I try to display a variable in the Header 
method but nothing prints.</span></p>
+You have to use the <code>global</code> keyword to access global variables, 
for example:
+<div class="doc-source">
+<pre><code>function Header()
+{
+    global $title;
+
+    $this-&gt;SetFont('Arial', 'B', 15);
+    $this-&gt;Cell(0, 10, $title, 1, 1, 'C');
+}
+
+$title = 'My title';</code></pre>
+</div>
+Alternatively, you can use an object property:
+<div class="doc-source">
+<pre><code>function Header()
+{
+    $this-&gt;SetFont('Arial', 'B', 15);
+    $this-&gt;Cell(0, 10, $this-&gt;title, 1, 1, 'C');
+}
+
+$pdf-&gt;title = 'My title';</code></pre>
+</div>
+</li>
+
+<li id='q6'>
+<p><b>6.</b> <span class='question'>I defined the Header and Footer methods in 
my PDF class but nothing appears.</span></p>
+You have to create an object from the PDF class, not FPDF:
+<div class="doc-source">
+<pre><code>$pdf = new PDF();</code></pre>
+</div>
+</li>
+
+<li id='q7'>
+<p><b>7.</b> <span class='question'>Accented characters are replaced by some 
strange characters like é.</span></p>
+Don't use UTF-8 encoding. Standard FPDF fonts use ISO-8859-1 or Windows-1252.
+It is possible to perform a conversion to ISO-8859-1 with utf8_decode():
+<div class="doc-source">
+<pre><code>$str = utf8_decode($str);</code></pre>
+</div>
+But some characters such as Euro won't be translated correctly. If the iconv 
extension is available, the
+right way to do it is the following:
+<div class="doc-source">
+<pre><code>$str = iconv('UTF-8', 'windows-1252', $str);</code></pre>
+</div>
+</li>
+
+<li id='q8'>
+<p><b>8.</b> <span class='question'>I try to display the Euro symbol but it 
doesn't work.</span></p>
+The standard fonts have the Euro character at position 128. You can define a 
constant like this
+for convenience:
+<div class="doc-source">
+<pre><code>define('EURO', chr(128));</code></pre>
+</div>
+</li>
+
+<li id='q9'>
+<p><b>9.</b> <span class='question'>I get the following error when I try to 
generate a PDF: Some data has already been output, can't send PDF 
file</span></p>
+You must send nothing to the browser except the PDF itself: no HTML, no space, 
no carriage return.
+You may have this other message just before:<br>
+<br>
+<b>Warning:</b> Cannot modify header information - headers already sent by 
(output started at script.php:X)<br>
+<br>
+It means that script.php outputs something at line X. Go to this line and fix 
it.
+In case the warning doesn't show, add this at the very beginning of your 
script:
+<div class="doc-source">
+<pre><code>ob_end_clean();</code></pre>
+</div>
+If you still don't see it, disable zlib.output_compression in your php.ini.
+</li>
+
+<li id='q10'>
+<p><b>10.</b> <span class='question'>I draw a frame with very precise 
dimensions, but when printed I notice some differences.</span></p>
+To respect dimensions, select "None" for the Page Scaling setting instead of 
"Shrink to Printable Area" in the print dialog box.
+</li>
+
+<li id='q11'>
+<p><b>11.</b> <span class='question'>I'd like to use the whole surface of the 
page, but when printed I always have some margins. How can I get rid of 
them?</span></p>
+Printers have physical margins (different depending on the models); it is 
therefore impossible to remove
+them and print on the whole surface of the paper.
+</li>
+
+<li id='q12'>
+<p><b>12.</b> <span class='question'>How can I put a background in my 
PDF?</span></p>
+For a picture, call Image() in the Header() method, before any other output. 
To set a background color, use Rect().
+</li>
+
+<li id='q13'>
+<p><b>13.</b> <span class='question'>How can I set a specific header or footer 
on the first page?</span></p>
+Simply test the page number:
+<div class="doc-source">
+<pre><code>function Header()
+{
+    if($this-&gt;PageNo()==1)
+    {
+        //First page
+        ...
+    }
+    else
+    {
+        //Other pages
+        ...
+    }
+}</code></pre>
+</div>
+</li>
+
+<li id='q14'>
+<p><b>14.</b> <span class='question'>I'd like to use extensions provided by 
different scripts. How can I combine them?</span></p>
+Use an inheritance chain. If you have two classes, say A in a.php:
+<div class="doc-source">
+<pre><code>require('fpdf.php');
+
+class A extends FPDF
+{
+...
+}</code></pre>
+</div>
+and B in b.php:
+<div class="doc-source">
+<pre><code>require('fpdf.php');
+
+class B extends FPDF
+{
+...
+}</code></pre>
+</div>
+then make B extend A:
+<div class="doc-source">
+<pre><code>require('a.php');
+
+class B extends A
+{
+...
+}</code></pre>
+</div>
+and make your own class extend B:
+<div class="doc-source">
+<pre><code>require('b.php');
+
+class PDF extends B
+{
+...
+}
+
+$pdf = new PDF();</code></pre>
+</div>
+</li>
+
+<li id='q15'>
+<p><b>15.</b> <span class='question'>How can I send the PDF by 
email?</span></p>
+As any other file, but an easy way is to use <a 
href="http://phpmailer.codeworxtech.com";>PHPMailer</a> and
+its in-memory attachment:
+<div class="doc-source">
+<pre><code>$mail = new PHPMailer();
+...
+$doc = $pdf-&gt;Output('', 'S');
+$mail-&gt;AddStringAttachment($doc, 'doc.pdf', 'base64', 'application/pdf');
+$mail-&gt;Send();</code></pre>
+</div>
+</li>
+
+<li id='q16'>
+<p><b>16.</b> <span class='question'>What's the limit of the file sizes I can 
generate with FPDF?</span></p>
+There is no particular limit. There are some constraints, however:
+<br>
+<br>
+- The maximum memory size allocated to PHP scripts is usually 8MB. For very 
big documents,
+especially with images, this limit may be reached (the file being built into 
memory). The
+parameter is configured in the php.ini file.
+<br>
+<br>
+- The maximum execution time allocated defaults to 30 seconds. This limit can 
of course be easily
+reached. It is configured in php.ini and may be altered dynamically with 
set_time_limit().
+<br>
+<br>
+- Browsers generally have a 5 minute time-out. If you send the PDF directly to 
the browser and
+reach the limit, it will be lost. It is therefore advised for very big 
documents to
+generate them in a file, and to send some data to the browser from time to 
time (with a call
+to flush() to force the output). When the document is finished, you can send a 
redirection to
+it or create a link.
+<br>
+Remark: even if the browser times out, the script may continue to run on the 
server.
+</li>
+
+<li id='q17'>
+<p><b>17.</b> <span class='question'>Can I modify a PDF with FPDF?</span></p>
+It is possible to import pages from an existing PDF document thanks to the 
FPDI extension:<br>
+<br>
+<a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/"; 
target="_blank">http://www.setasign.de/products/pdf-php-solutions/fpdi/</a><br>
+<br>
+You can then add some content to them.
+</li>
+
+<li id='q18'>
+<p><b>18.</b> <span class='question'>I'd like to make a search engine in PHP 
and index PDF files. Can I do it with FPDF?</span></p>
+No. But a GPL C utility does exist, pdftotext, which is able to extract the 
textual content from
+a PDF. It is provided with the Xpdf package:<br>
+<br>
+<a href="http://www.foolabs.com/xpdf/"; 
target="_blank">http://www.foolabs.com/xpdf/</a>
+</li>
+
+<li id='q19'>
+<p><b>19.</b> <span class='question'>Can I convert an HTML page to PDF with 
FPDF?</span></p>
+Not real-world pages. But a GPL C utility does exist, htmldoc, which allows to 
do it and gives good results:<br>
+<br>
+<a href="http://www.htmldoc.org"; target="_blank">http://www.htmldoc.org</a>
+</li>
+
+<li id='q20'>
+<p><b>20.</b> <span class='question'>Can I concatenate PDF files with 
FPDF?</span></p>
+Not directly, but it is possible to use <a 
href="http://www.setasign.de/products/pdf-php-solutions/fpdi/demos/concatenate-fake/";
 target="_blank">FPDI</a>
+to perform this task. Some free command-line tools also exist:<br>
+<br>
+<a href="http://thierry.schmit.free.fr/spip/spip.php?article15&amp;lang=en"; 
target="_blank">mbtPdfAsm</a><br>
+<a href="http://www.accesspdf.com/pdftk/"; target="_blank">pdftk</a>
+</li>
+</ul>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/acceptpagebreak.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/acceptpagebreak.htm
                           (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/acceptpagebreak.htm
   2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>AcceptPageBreak</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>AcceptPageBreak</h1>
+<code><b>boolean</b> AcceptPageBreak()</code>
+<h2>Description</h2>
+Whenever a page break condition is met, the method is called, and the break is 
issued or not
+depending on the returned value. The default implementation returns a value 
according to the
+mode selected by SetAutoPageBreak().
+<br>
+This method is called automatically and should not be called directly by the 
application.
+<h2>Example</h2>
+The method is overriden in an inherited class in order to obtain a 3 column 
layout:
+<div class="doc-source">
+<pre><code>class PDF extends FPDF
+{
+var $col=0;
+
+function SetCol($col)
+{
+    //Move position to a column
+    $this-&gt;col=$col;
+    $x=10+$col*65;
+    $this-&gt;SetLeftMargin($x);
+    $this-&gt;SetX($x);
+}
+
+function AcceptPageBreak()
+{
+    if($this-&gt;col&lt;2)
+    {
+        //Go to next column
+        $this-&gt;SetCol($this-&gt;col+1);
+        $this-&gt;SetY(10);
+        return false;
+    }
+    else
+    {
+        //Go back to first column and issue page break
+        $this-&gt;SetCol(0);
+        return true;
+    }
+}
+}
+
+$pdf=new PDF();
+$pdf-&gt;AddPage();
+$pdf-&gt;SetFont('Arial','',12);
+for($i=1;$i&lt;=300;$i++)
+    $pdf-&gt;Cell(0,5,&quot;Line $i&quot;,0,1);
+$pdf-&gt;Output();</code></pre>
+</div>
+<h2>See also</h2>
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addfont.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addfont.htm   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addfont.htm   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>AddFont</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>AddFont</h1>
+<code>AddFont(<b>string</b> family [, <b>string</b> style [, <b>string</b> 
file]])</code>
+<h2>Description</h2>
+Imports a TrueType or Type1 font and makes it available. It is necessary to 
generate a font
+definition file first with the makefont.php utility.
+<br>
+The definition file (and the font file itself when embedding) must be present 
in the font directory.
+If it is not found, the error "Could not include font definition file" is 
generated.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>family</code></dt>
+<dd>
+Font family. The name can be chosen arbitrarily. If it is a standard family 
name, it will
+override the corresponding font.
+</dd>
+<dt><code>style</code></dt>
+<dd>
+Font style. Possible values are (case insensitive):
+<ul>
+<li>empty string: regular</li>
+<li><code>B</code>: bold</li>
+<li><code>I</code>: italic</li>
+<li><code>BI</code> or <code>IB</code>: bold italic</li>
+</ul>
+The default value is regular.
+</dd>
+<dt><code>file</code></dt>
+<dd>
+The font definition file.
+<br>
+By default, the name is built from the family and style, in lower case with no 
space.
+</dd>
+</dl>
+<h2>Example</h2>
+<div class="doc-source">
+<pre><code>$pdf-&gt;AddFont('Comic','I');</code></pre>
+</div>
+is equivalent to:
+<div class="doc-source">
+<pre><code>$pdf-&gt;AddFont('Comic','I','comici.php');</code></pre>
+</div>
+<h2>See also</h2>
+<a href="setfont.htm">SetFont()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addlink.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addlink.htm   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addlink.htm   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>AddLink</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>AddLink</h1>
+<code><b>int</b> AddLink()</code>
+<h2>Description</h2>
+Creates a new internal link and returns its identifier. An internal link is a 
clickable area
+which directs to another place within the document.
+<br>
+The identifier can then be passed to Cell(), Write(), Image() or Link(). The 
destination is
+defined with SetLink().
+<h2>See also</h2>
+<a href="cell.htm">Cell()</a>,
+<a href="write.htm">Write()</a>,
+<a href="image.htm">Image()</a>,
+<a href="link.htm">Link()</a>,
+<a href="setlink.htm">SetLink()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addpage.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addpage.htm   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/addpage.htm   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>AddPage</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>AddPage</h1>
+<code>AddPage([<b>string</b> orientation ,[ <b>mixed</b> format]])</code>
+<h2>Description</h2>
+Adds a new page to the document. If a page is already present, the Footer() 
method is called
+first to output the footer. Then the page is added, the current position set 
to the top-left
+corner according to the left and top margins, and Header() is called to 
display the header.
+<br>
+The font which was set before calling is automatically restored. There is no 
need to call
+SetFont() again if you want to continue with the same font. The same is true 
for colors and
+line width.
+<br>
+The origin of the coordinate system is at the top-left corner and increasing 
ordinates go
+downwards.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>orientation</code></dt>
+<dd>
+Page orientation. Possible values are (case insensitive):
+<ul>
+<li><code>P</code> or <code>Portrait</code></li>
+<li><code>L</code> or <code>Landscape</code></li>
+</ul>
+The default value is the one passed to the constructor.
+</dd>
+<dt><code>format</code></dt>
+<dd>
+Page format. It can be either one of the following values (case insensitive):
+<ul>
+<li><code>A3</code></li>
+<li><code>A4</code></li>
+<li><code>A5</code></li>
+<li><code>Letter</code></li>
+<li><code>Legal</code></li>
+</ul>
+or an array containing the width and the height (expressed in user unit).<br>
+<br>
+The default value is the one passed to the constructor.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="fpdf.htm">FPDF()</a>,
+<a href="header.htm">Header()</a>,
+<a href="footer.htm">Footer()</a>,
+<a href="setmargins.htm">SetMargins()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/aliasnbpages.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/aliasnbpages.htm  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/aliasnbpages.htm  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>AliasNbPages</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>AliasNbPages</h1>
+<code>AliasNbPages([<b>string</b> alias])</code>
+<h2>Description</h2>
+Defines an alias for the total number of pages. It will be substituted as the 
document is
+closed.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>alias</code></dt>
+<dd>
+The alias. Default value: <code>{nb}</code>.
+</dd>
+</dl>
+<h2>Example</h2>
+<div class="doc-source">
+<pre><code>class PDF extends FPDF
+{
+function Footer()
+{
+    //Go to 1.5 cm from bottom
+    $this-&gt;SetY(-15);
+    //Select Arial italic 8
+    $this-&gt;SetFont('Arial','I',8);
+    //Print current and total page numbers
+    $this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo().'/{nb}',0,0,'C');
+}
+}
+
+$pdf=new PDF();
+$pdf-&gt;AliasNbPages();</code></pre>
+</div>
+<h2>See also</h2>
+<a href="pageno.htm">PageNo()</a>,
+<a href="footer.htm">Footer()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/cell.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/cell.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/cell.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,104 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Cell</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Cell</h1>
+<code>Cell(<b>float</b> w [, <b>float</b> h [, <b>string</b> txt [, 
<b>mixed</b> border [, <b>int</b> ln [, <b>string</b> align [, <b>boolean</b> 
fill [, <b>mixed</b> link]]]]]]])</code>
+<h2>Description</h2>
+Prints a cell (rectangular area) with optional borders, background color and 
character string.
+The upper-left corner of the cell corresponds to the current position. The 
text can be aligned
+or centered. After the call, the current position moves to the right or to the 
next line. It is
+possible to put a link on the text.
+<br>
+If automatic page breaking is enabled and the cell goes beyond the limit, a 
page break is
+done before outputting.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>w</code></dt>
+<dd>
+Cell width. If <code>0</code>, the cell extends up to the right margin.
+</dd>
+<dt><code>h</code></dt>
+<dd>
+Cell height.
+Default value: <code>0</code>.
+</dd>
+<dt><code>txt</code></dt>
+<dd>
+String to print.
+Default value: empty string.
+</dd>
+<dt><code>border</code></dt>
+<dd>
+Indicates if borders must be drawn around the cell. The value can be either a 
number:
+<ul>
+<li><code>0</code>: no border</li>
+<li><code>1</code>: frame</li>
+</ul>
+or a string containing some or all of the following characters (in any order):
+<ul>
+<li><code>L</code>: left</li>
+<li><code>T</code>: top</li>
+<li><code>R</code>: right</li>
+<li><code>B</code>: bottom</li>
+</ul>
+Default value: <code>0</code>.
+</dd>
+<dt><code>ln</code></dt>
+<dd>
+Indicates where the current position should go after the call. Possible values 
are:
+<ul>
+<li><code>0</code>: to the right</li>
+<li><code>1</code>: to the beginning of the next line</li>
+<li><code>2</code>: below</li>
+</ul>
+Putting <code>1</code> is equivalent to putting <code>0</code> and calling 
Ln() just after.
+Default value: <code>0</code>.
+</dd>
+<dt><code>align</code></dt>
+<dd>
+Allows to center or align the text. Possible values are:
+<ul>
+<li><code>L</code> or empty string: left align (default value)</li>
+<li><code>C</code>: center</li>
+<li><code>R</code>: right align</li>
+</ul>
+</dd>
+<dt><code>fill</code></dt>
+<dd>
+Indicates if the cell background must be painted (<code>true</code>) or 
transparent (<code>false</code>).
+Default value: <code>false</code>.
+</dd>
+<dt><code>link</code></dt>
+<dd>
+URL or identifier returned by AddLink().
+</dd>
+</dl>
+<h2>Example</h2>
+<div class="doc-source">
+<pre><code>//Set font
+$pdf-&gt;SetFont('Arial','B',16);
+//Move to 8 cm to the right
+$pdf-&gt;Cell(80);
+//Centered text in a framed 20*10 mm cell and line break
+$pdf-&gt;Cell(20,10,'Title',1,1,'C');</code></pre>
+</div>
+<h2>See also</h2>
+<a href="setfont.htm">SetFont()</a>,
+<a href="setdrawcolor.htm">SetDrawColor()</a>,
+<a href="setfillcolor.htm">SetFillColor()</a>,
+<a href="settextcolor.htm">SetTextColor()</a>,
+<a href="setlinewidth.htm">SetLineWidth()</a>,
+<a href="addlink.htm">AddLink()</a>,
+<a href="ln.htm">Ln()</a>,
+<a href="multicell.htm">MultiCell()</a>,
+<a href="write.htm">Write()</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/close.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/close.htm     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/close.htm     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Close</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Close</h1>
+<code>Close()</code>
+<h2>Description</h2>
+Terminates the PDF document. It is not necessary to call this method 
explicitly because Output()
+does it automatically.
+<br>
+If the document contains no page, AddPage() is called to prevent from getting 
an invalid document.
+<h2>See also</h2>
+<a href="output.htm">Output()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/error.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/error.htm     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/error.htm     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Error</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Error</h1>
+<code>Error(<b>string</b> msg)</code>
+<h2>Description</h2>
+This method is automatically called in case of fatal error; it simply outputs 
the message
+and halts the execution. An inherited class may override it to customize the 
error handling
+but should always halt the script, or the resulting document would probably be 
invalid.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>msg</code></dt>
+<dd>
+The error message.
+</dd>
+</dl>
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/footer.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/footer.htm    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/footer.htm    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Footer</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Footer</h1>
+<code>Footer()</code>
+<h2>Description</h2>
+This method is used to render the page footer. It is automatically called by 
AddPage() and
+Close() and should not be called directly by the application. The 
implementation in FPDF is
+empty, so you have to subclass it and override the method if you want a 
specific processing.
+<h2>Example</h2>
+<div class="doc-source">
+<pre><code>class PDF extends FPDF
+{
+function Footer()
+{
+    //Go to 1.5 cm from bottom
+    $this-&gt;SetY(-15);
+    //Select Arial italic 8
+    $this-&gt;SetFont('Arial','I',8);
+    //Print centered page number
+    $this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo(),0,0,'C');
+}
+}</code></pre>
+</div>
+<h2>See also</h2>
+<a href="header.htm">Header()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/fpdf.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/fpdf.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/fpdf.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>FPDF</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>FPDF</h1>
+<code>FPDF([<b>string</b> orientation [, <b>string</b> unit [, <b>mixed</b> 
format]]])</code>
+<h2>Description</h2>
+This is the class constructor. It allows to set up the page format, the 
orientation and the
+unit of measure used in all methods (except for font sizes).
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>orientation</code></dt>
+<dd>
+Default page orientation. Possible values are (case insensitive):
+<ul>
+<li><code>P</code> or <code>Portrait</code></li>
+<li><code>L</code> or <code>Landscape</code></li>
+</ul>
+Default value is <code>P</code>.
+</dd>
+<dt><code>unit</code></dt>
+<dd>
+User unit. Possible values are:
+<ul>
+<li><code>pt</code>: point</li>
+<li><code>mm</code>: millimeter</li>
+<li><code>cm</code>: centimeter</li>
+<li><code>in</code>: inch</li>
+</ul>
+A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 
cm). This
+is a very common unit in typography; font sizes are expressed in that unit.
+<br>
+<br>
+Default value is <code>mm</code>.
+</dd>
+<dt><code>format</code></dt>
+<dd>
+The format used for pages. It can be either one of the following values (case 
insensitive):
+<ul>
+<li><code>A3</code></li>
+<li><code>A4</code></li>
+<li><code>A5</code></li>
+<li><code>Letter</code></li>
+<li><code>Legal</code></li>
+</ul>
+or an array containing the width and the height (expressed in the unit given 
by <code>unit</code>).<br>
+<br>
+Default value is <code>A4</code>.
+</dd>
+</dl>
+<h2>Example</h2>
+Example with a custom 100x150 mm page format:
+<div class="doc-source">
+<pre><code>$pdf = new FPDF('P', 'mm', array(100,150));</code></pre>
+</div>
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getstringwidth.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getstringwidth.htm
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getstringwidth.htm
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>GetStringWidth</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>GetStringWidth</h1>
+<code><b>float</b> GetStringWidth(<b>string</b> s)</code>
+<h2>Description</h2>
+Returns the length of a string in user unit. A font must be selected.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>s</code></dt>
+<dd>
+The string whose length is to be computed.
+</dd>
+</dl>
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getx.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getx.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/getx.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>GetX</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>GetX</h1>
+<code><b>float</b> GetX()</code>
+<h2>Description</h2>
+Returns the abscissa of the current position.
+<h2>See also</h2>
+<a href="setx.htm">SetX()</a>,
+<a href="gety.htm">GetY()</a>,
+<a href="sety.htm">SetY()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/gety.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/gety.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/gety.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>GetY</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>GetY</h1>
+<code><b>float</b> GetY()</code>
+<h2>Description</h2>
+Returns the ordinate of the current position.
+<h2>See also</h2>
+<a href="sety.htm">SetY()</a>,
+<a href="getx.htm">GetX()</a>,
+<a href="setx.htm">SetX()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/header.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/header.htm    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/header.htm    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Header</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Header</h1>
+<code>Header()</code>
+<h2>Description</h2>
+This method is used to render the page header. It is automatically called by 
AddPage() and
+should not be called directly by the application. The implementation in FPDF 
is empty, so
+you have to subclass it and override the method if you want a specific 
processing.
+<h2>Example</h2>
+<div class="doc-source">
+<pre><code>class PDF extends FPDF
+{
+function Header()
+{
+    //Select Arial bold 15
+    $this-&gt;SetFont('Arial','B',15);
+    //Move to the right
+    $this-&gt;Cell(80);
+    //Framed title
+    $this-&gt;Cell(30,10,'Title',1,0,'C');
+    //Line break
+    $this-&gt;Ln(20);
+}
+}</code></pre>
+</div>
+<h2>See also</h2>
+<a href="footer.htm">Footer()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/image.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/image.htm     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/image.htm     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,86 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Image</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Image</h1>
+<code>Image(<b>string</b> file [, <b>float</b> x [, <b>float</b> y [, 
<b>float</b> w [, <b>float</b> h [, <b>string</b> type [, <b>mixed</b> 
link]]]]]])</code>
+<h2>Description</h2>
+Puts an image. The size it will take on the page can be specified in different 
ways:
+<ul>
+<li>explicit width and height (expressed in user unit)</li>
+<li>one explicit dimension, the other being calculated automatically in order 
to keep the original proportions</li>
+<li>no explicit dimension, in which case the image is put at 72 dpi</li>
+</ul>
+Supported formats are JPEG, PNG and GIF. The GD extension is required for GIF.
+<br>
+<br>
+For JPEGs, all flavors are allowed:
+<ul>
+<li>gray scales</li>
+<li>true colors (24 bits)</li>
+<li>CMYK (32 bits)</li>
+</ul>
+For PNGs, are allowed:
+<ul>
+<li>gray scales on at most 8 bits (256 levels)</li>
+<li>indexed colors</li>
+<li>true colors (24 bits)</li>
+</ul>
+but are not supported:
+<ul>
+<li>Interlacing</li>
+<li>Alpha channel</li>
+</ul>
+For GIFs: in case of an animated GIF, only the first frame is used.<br>
+<br>
+If a transparent color is defined, it is taken into account.<br>
+<br>
+The format can be specified explicitly or inferred from the file extension.<br>
+It is possible to put a link on the image.<br>
+<br>
+Remark: if an image is used several times, only one copy is embedded in the 
file.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>file</code></dt>
+<dd>
+Path or URL of the image.
+</dd>
+<dt><code>x</code></dt>
+<dd>
+Abscissa of the upper-left corner. If not specified or equal to 
<code>null</code>, the current abscissa
+is used.
+</dd>
+<dt><code>y</code></dt>
+<dd>
+Ordinate of the upper-left corner. If not specified or equal to 
<code>null</code>, the current ordinate
+is used; moreover, a page break is triggered first if necessary (in case 
automatic page breaking is enabled)
+and, after the call, the current ordinate is moved to the bottom of the image.
+</dd>
+<dt><code>w</code></dt>
+<dd>
+Width of the image in the page. If not specified or equal to zero, it is 
automatically calculated.
+</dd>
+<dt><code>h</code></dt>
+<dd>
+Height of the image in the page. If not specified or equal to zero, it is 
automatically calculated.
+</dd>
+<dt><code>type</code></dt>
+<dd>
+Image format. Possible values are (case insensitive): <code>JPG</code>, 
<code>JPEG</code>, <code>PNG</code> and <code>GIF</code>.
+If not specified, the type is inferred from the file extension.
+</dd>
+<dt><code>link</code></dt>
+<dd>
+URL or identifier returned by AddLink().
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="addlink.htm">AddLink()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/index.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/index.htm     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/index.htm     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>FPDF 1.6 Reference Manual</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>FPDF 1.6 Reference Manual</h1>
+<a href="acceptpagebreak.htm">AcceptPageBreak</a> - accept or not automatic 
page break<br>
+<a href="addfont.htm">AddFont</a> - add a new font<br>
+<a href="addlink.htm">AddLink</a> - create an internal link<br>
+<a href="addpage.htm">AddPage</a> - add a new page<br>
+<a href="aliasnbpages.htm">AliasNbPages</a> - define an alias for number of 
pages<br>
+<a href="cell.htm">Cell</a> - print a cell<br>
+<a href="close.htm">Close</a> - terminate the document<br>
+<a href="error.htm">Error</a> - fatal error<br>
+<a href="footer.htm">Footer</a> - page footer<br>
+<a href="fpdf.htm">FPDF</a> - constructor<br>
+<a href="getstringwidth.htm">GetStringWidth</a> - compute string length<br>
+<a href="getx.htm">GetX</a> - get current x position<br>
+<a href="gety.htm">GetY</a> - get current y position<br>
+<a href="header.htm">Header</a> - page header<br>
+<a href="image.htm">Image</a> - output an image<br>
+<a href="line.htm">Line</a> - draw a line<br>
+<a href="link.htm">Link</a> - put a link<br>
+<a href="ln.htm">Ln</a> - line break<br>
+<a href="multicell.htm">MultiCell</a> - print text with line breaks<br>
+<a href="output.htm">Output</a> - save or send the document<br>
+<a href="pageno.htm">PageNo</a> - page number<br>
+<a href="rect.htm">Rect</a> - draw a rectangle<br>
+<a href="setauthor.htm">SetAuthor</a> - set the document author<br>
+<a href="setautopagebreak.htm">SetAutoPageBreak</a> - set the automatic page 
breaking mode<br>
+<a href="setcompression.htm">SetCompression</a> - turn compression on or 
off<br>
+<a href="setcreator.htm">SetCreator</a> - set document creator<br>
+<a href="setdisplaymode.htm">SetDisplayMode</a> - set display mode<br>
+<a href="setdrawcolor.htm">SetDrawColor</a> - set drawing color<br>
+<a href="setfillcolor.htm">SetFillColor</a> - set filling color<br>
+<a href="setfont.htm">SetFont</a> - set font<br>
+<a href="setfontsize.htm">SetFontSize</a> - set font size<br>
+<a href="setkeywords.htm">SetKeywords</a> - associate keywords with 
document<br>
+<a href="setleftmargin.htm">SetLeftMargin</a> - set left margin<br>
+<a href="setlinewidth.htm">SetLineWidth</a> - set line width<br>
+<a href="setlink.htm">SetLink</a> - set internal link destination<br>
+<a href="setmargins.htm">SetMargins</a> - set margins<br>
+<a href="setrightmargin.htm">SetRightMargin</a> - set right margin<br>
+<a href="setsubject.htm">SetSubject</a> - set document subject<br>
+<a href="settextcolor.htm">SetTextColor</a> - set text color<br>
+<a href="settitle.htm">SetTitle</a> - set document title<br>
+<a href="settopmargin.htm">SetTopMargin</a> - set top margin<br>
+<a href="setx.htm">SetX</a> - set current x position<br>
+<a href="setxy.htm">SetXY</a> - set current x and y positions<br>
+<a href="sety.htm">SetY</a> - set current y position<br>
+<a href="text.htm">Text</a> - print a string<br>
+<a href="write.htm">Write</a> - print flowing text<br>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/line.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/line.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/line.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Line</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Line</h1>
+<code>Line(<b>float</b> x1, <b>float</b> y1, <b>float</b> x2, <b>float</b> 
y2)</code>
+<h2>Description</h2>
+Draws a line between two points.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>x1</code></dt>
+<dd>
+Abscissa of first point.
+</dd>
+<dt><code>y1</code></dt>
+<dd>
+Ordinate of first point.
+</dd>
+<dt><code>x2</code></dt>
+<dd>
+Abscissa of second point.
+</dd>
+<dt><code>y2</code></dt>
+<dd>
+Ordinate of second point.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setlinewidth.htm">SetLineWidth()</a>,
+<a href="setdrawcolor.htm">SetDrawColor()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/link.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/link.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/link.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Link</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Link</h1>
+<code>Link(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h, 
<b>mixed</b> link)</code>
+<h2>Description</h2>
+Puts a link on a rectangular area of the page. Text or image links are 
generally put via Cell(),
+Write() or Image(), but this method can be useful for instance to define a 
clickable area inside
+an image.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>x</code></dt>
+<dd>
+Abscissa of the upper-left corner of the rectangle.
+</dd>
+<dt><code>y</code></dt>
+<dd>
+Ordinate of the upper-left corner of the rectangle.
+</dd>
+<dt><code>w</code></dt>
+<dd>
+Width of the rectangle.
+</dd>
+<dt><code>h</code></dt>
+<dd>
+Height of the rectangle.
+</dd>
+<dt><code>link</code></dt>
+<dd>
+URL or identifier returned by AddLink().
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="addlink.htm">AddLink()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="write.htm">Write()</a>,
+<a href="image.htm">Image()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/ln.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/ln.htm        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/ln.htm        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Ln</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Ln</h1>
+<code>Ln([<b>float</b> h])</code>
+<h2>Description</h2>
+Performs a line break. The current abscissa goes back to the left margin and 
the ordinate
+increases by the amount passed in parameter.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>h</code></dt>
+<dd>
+The height of the break.
+<br>
+By default, the value equals the height of the last printed cell.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="cell.htm">Cell()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/multicell.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/multicell.htm 
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/multicell.htm 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,76 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>MultiCell</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>MultiCell</h1>
+<code>MultiCell(<b>float</b> w, <b>float</b> h, <b>string</b> txt [, 
<b>mixed</b> border [, <b>string</b> align [, <b>boolean</b> fill]]])</code>
+<h2>Description</h2>
+This method allows printing text with line breaks. They can be automatic (as 
soon as the
+text reaches the right border of the cell) or explicit (via the \n character). 
As many cells
+as necessary are output, one below the other.
+<br>
+Text can be aligned, centered or justified. The cell block can be framed and 
the background
+painted.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>w</code></dt>
+<dd>
+Width of cells. If <code>0</code>, they extend up to the right margin of the 
page.
+</dd>
+<dt><code>h</code></dt>
+<dd>
+Height of cells.
+</dd>
+<dt><code>txt</code></dt>
+<dd>
+String to print.
+</dd>
+<dt><code>border</code></dt>
+<dd>
+Indicates if borders must be drawn around the cell block. The value can be 
either a number:
+<ul>
+<li><code>0</code>: no border</li>
+<li><code>1</code>: frame</li>
+</ul>
+or a string containing some or all of the following characters (in any order):
+<ul>
+<li><code>L</code>: left</li>
+<li><code>T</code>: top</li>
+<li><code>R</code>: right</li>
+<li><code>B</code>: bottom</li>
+</ul>
+Default value: <code>0</code>.
+</dd>
+<dt><code>align</code></dt>
+<dd>
+Sets the text alignment. Possible values are:
+<ul>
+<li><code>L</code>: left alignment</li>
+<li><code>C</code>: center</li>
+<li><code>R</code>: right alignment</li>
+<li><code>J</code>: justification (default value)</li>
+</ul>
+</dd>
+<dt><code>fill</code></dt>
+<dd>
+Indicates if the cell background must be painted (<code>true</code>) or 
transparent (<code>false</code>).
+Default value: <code>false</code>.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setfont.htm">SetFont()</a>,
+<a href="setdrawcolor.htm">SetDrawColor()</a>,
+<a href="setfillcolor.htm">SetFillColor()</a>,
+<a href="settextcolor.htm">SetTextColor()</a>,
+<a href="setlinewidth.htm">SetLineWidth()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="write.htm">Write()</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/output.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/output.htm    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/output.htm    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Output</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Output</h1>
+<code><b>string</b> Output([<b>string</b> name, <b>string</b> dest])</code>
+<h2>Description</h2>
+Send the document to a given destination: browser, file or string. In the case 
of browser, the
+plug-in may be used (if present) or a download ("Save as" dialog box) may be 
forced.
+<br>
+The method first calls Close() if necessary to terminate the document.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>name</code></dt>
+<dd>
+The name of the file. If not specified, the document will be sent to the 
browser
+(destination <code>I</code>) with the name <code>doc.pdf</code>.
+</dd>
+<dt><code>dest</code></dt>
+<dd>
+Destination where to send the document. It can take one of the following 
values:
+<ul>
+<li><code>I</code>: send the file inline to the browser. The plug-in is used 
if available.
+The name given by <code>name</code> is used when one selects the "Save as" 
option on the
+link generating the PDF.</li>
+<li><code>D</code>: send to the browser and force a file download with the 
name given by
+<code>name</code>.</li>
+<li><code>F</code>: save to a local file with the name given by 
<code>name</code> (may include a path).</li>
+<li><code>S</code>: return the document as a string. <code>name</code> is 
ignored.</li>
+</ul>
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="close.htm">Close()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/pageno.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/pageno.htm    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/pageno.htm    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>PageNo</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>PageNo</h1>
+<code><b>int</b> PageNo()</code>
+<h2>Description</h2>
+Returns the current page number.
+<h2>See also</h2>
+<a href="aliasnbpages.htm">AliasNbPages()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/rect.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/rect.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/rect.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Rect</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Rect</h1>
+<code>Rect(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h [, 
<b>string</b> style])</code>
+<h2>Description</h2>
+Outputs a rectangle. It can be drawn (border only), filled (with no border) or 
both.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>x</code></dt>
+<dd>
+Abscissa of upper-left corner.
+</dd>
+<dt><code>y</code></dt>
+<dd>
+Ordinate of upper-left corner.
+</dd>
+<dt><code>w</code></dt>
+<dd>
+Width.
+</dd>
+<dt><code>h</code></dt>
+<dd>
+Height.
+</dd>
+<dt><code>style</code></dt>
+<dd>
+Style of rendering. Possible values are:
+<ul>
+<li><code>D</code> or empty string: draw. This is the default value.</li>
+<li><code>F</code>: fill</li>
+<li><code>DF</code> or <code>FD</code>: draw and fill</li>
+</ul>
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setlinewidth.htm">SetLineWidth()</a>,
+<a href="setdrawcolor.htm">SetDrawColor()</a>,
+<a href="setfillcolor.htm">SetFillColor()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setauthor.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setauthor.htm 
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setauthor.htm 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetAuthor</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetAuthor</h1>
+<code>SetAuthor(<b>string</b> author [, <b>boolean</b> isUTF8])</code>
+<h2>Description</h2>
+Defines the author of the document.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>author</code></dt>
+<dd>
+The name of the author.
+</dd>
+<dt><code>isUTF8</code></dt>
+<dd>
+Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 
(<code>true</code>).<br>
+Default value: <code>false</code>.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setcreator.htm">SetCreator()</a>,
+<a href="setkeywords.htm">SetKeywords()</a>,
+<a href="setsubject.htm">SetSubject()</a>,
+<a href="settitle.htm">SetTitle()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setautopagebreak.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setautopagebreak.htm
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setautopagebreak.htm
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetAutoPageBreak</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetAutoPageBreak</h1>
+<code>SetAutoPageBreak(<b>boolean</b> auto [, <b>float</b> margin])</code>
+<h2>Description</h2>
+Enables or disables the automatic page breaking mode. When enabling, the 
second parameter is
+the distance from the bottom of the page that defines the triggering limit. By 
default, the
+mode is on and the margin is 2 cm.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>auto</code></dt>
+<dd>
+Boolean indicating if mode should be on or off.
+</dd>
+<dt><code>margin</code></dt>
+<dd>
+Distance from the bottom of the page.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="cell.htm">Cell()</a>,
+<a href="multicell.htm">MultiCell()</a>,
+<a href="acceptpagebreak.htm">AcceptPageBreak()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcompression.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcompression.htm
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcompression.htm
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetCompression</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetCompression</h1>
+<code>SetCompression(<b>boolean</b> compress)</code>
+<h2>Description</h2>
+Activates or deactivates page compression. When activated, the internal 
representation of
+each page is compressed, which leads to a compression ratio of about 2 for the 
resulting
+document.
+<br>
+Compression is on by default.
+<br>
+<br>
+<strong>Note:</strong> the Zlib extension is required for this feature. If not 
present, compression
+will be turned off.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>compress</code></dt>
+<dd>
+Boolean indicating if compression must be enabled.
+</dd>
+</dl>
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcreator.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcreator.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setcreator.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetCreator</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetCreator</h1>
+<code>SetCreator(<b>string</b> creator [, <b>boolean</b> isUTF8])</code>
+<h2>Description</h2>
+Defines the creator of the document. This is typically the name of the 
application that
+generates the PDF.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>creator</code></dt>
+<dd>
+The name of the creator.
+</dd>
+<dt><code>isUTF8</code></dt>
+<dd>
+Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 
(<code>true</code>).<br>
+Default value: <code>false</code>.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setauthor.htm">SetAuthor()</a>,
+<a href="setkeywords.htm">SetKeywords()</a>,
+<a href="setsubject.htm">SetSubject()</a>,
+<a href="settitle.htm">SetTitle()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdisplaymode.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdisplaymode.htm
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdisplaymode.htm
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetDisplayMode</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetDisplayMode</h1>
+<code>SetDisplayMode(<b>mixed</b> zoom [, <b>string</b> layout])</code>
+<h2>Description</h2>
+Defines the way the document is to be displayed by the viewer. The zoom level 
can be set: pages can be
+displayed entirely on screen, occupy the full width of the window, use real 
size, be scaled by a
+specific zooming factor or use viewer default (configured in the Preferences 
menu of Acrobat).
+The page layout can be specified too: single at once, continuous display, two 
columns or viewer
+default.
+<br>
+By default, documents use the full width mode with continuous display.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>zoom</code></dt>
+<dd>
+The zoom to use. It can be one of the following string values:
+<ul>
+<li><code>fullpage</code>: displays the entire page on screen</li>
+<li><code>fullwidth</code>: uses maximum width of window</li>
+<li><code>real</code>: uses real size (equivalent to 100% zoom)</li>
+<li><code>default</code>: uses viewer default mode</li>
+</ul>
+or a number indicating the zooming factor to use.
+</dd>
+<dt><code>layout</code></dt>
+<dd>
+The page layout. Possible values are:
+<ul>
+<li><code>single</code>: displays one page at once</li>
+<li><code>continuous</code>: displays pages continuously</li>
+<li><code>two</code>: displays two pages on two columns</li>
+<li><code>default</code>: uses viewer default mode</li>
+</ul>
+Default value is <code>continuous</code>.
+</dd>
+</dl>
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdrawcolor.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdrawcolor.htm  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setdrawcolor.htm  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetDrawColor</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetDrawColor</h1>
+<code>SetDrawColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
+<h2>Description</h2>
+Defines the color used for all drawing operations (lines, rectangles and cell 
borders). It
+can be expressed in RGB components or gray scale. The method can be called 
before the first
+page is created and the value is retained from page to page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>r</code></dt>
+<dd>
+If <code>g</code> et <code>b</code> are given, red component; if not, 
indicates the gray level.
+Value between 0 and 255.
+</dd>
+<dt><code>g</code></dt>
+<dd>
+Green component (between 0 and 255).
+</dd>
+<dt><code>b</code></dt>
+<dd>
+Blue component (between 0 and 255).
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setfillcolor.htm">SetFillColor()</a>,
+<a href="settextcolor.htm">SetTextColor()</a>,
+<a href="line.htm">Line()</a>,
+<a href="rect.htm">Rect()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="multicell.htm">MultiCell()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfillcolor.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfillcolor.htm  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfillcolor.htm  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetFillColor</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetFillColor</h1>
+<code>SetFillColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
+<h2>Description</h2>
+Defines the color used for all filling operations (filled rectangles and cell 
backgrounds).
+It can be expressed in RGB components or gray scale. The method can be called 
before the first
+page is created and the value is retained from page to page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>r</code></dt>
+<dd>
+If <code>g</code> and <code>b</code> are given, red component; if not, 
indicates the gray level.
+Value between 0 and 255.
+</dd>
+<dt><code>g</code></dt>
+<dd>
+Green component (between 0 and 255).
+</dd>
+<dt><code>b</code></dt>
+<dd>
+Blue component (between 0 and 255).
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setdrawcolor.htm">SetDrawColor()</a>,
+<a href="settextcolor.htm">SetTextColor()</a>,
+<a href="rect.htm">Rect()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="multicell.htm">MultiCell()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfont.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfont.htm   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfont.htm   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,92 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetFont</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetFont</h1>
+<code>SetFont(<b>string</b> family [, <b>string</b> style [, <b>float</b> 
size]])</code>
+<h2>Description</h2>
+Sets the font used to print character strings. It is mandatory to call this 
method
+at least once before printing text or the resulting document would not be 
valid.
+<br>
+The font can be either a standard one or a font added via the AddFont() 
method. Standard fonts
+use Windows encoding cp1252 (Western Europe).
+<br>
+The method can be called before the first page is created and the font is 
retained from page
+to page.
+<br>
+If you just wish to change the current font size, it is simpler to call 
SetFontSize().
+<br>
+<br>
+<strong>Note:</strong> the font metric files must be accessible. They are 
searched successively in:
+<ul>
+<li>The directory defined by the <code>FPDF_FONTPATH</code> constant (if this 
constant is defined)</li>
+<li>The <code>font</code> directory located in the directory containing 
<code>fpdf.php</code> (if it exists)</li>
+<li>The directories accessible through <code>include()</code></li>
+</ul>
+Example defining <code>FPDF_FONTPATH</code> (note the mandatory trailing 
slash):
+<div class="doc-source">
+<pre><code>define('FPDF_FONTPATH','/home/www/font/');
+require('fpdf.php');</code></pre>
+</div>
+If the file corresponding to the requested font is not found, the error "Could 
not include
+font metric file" is issued.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>family</code></dt>
+<dd>
+Family font. It can be either a name defined by AddFont() or one of the 
standard families (case
+insensitive):
+<ul>
+<li><code>Courier</code> (fixed-width)</li>
+<li><code>Helvetica</code> or <code>Arial</code> (synonymous; sans serif)</li>
+<li><code>Times</code> (serif)</li>
+<li><code>Symbol</code> (symbolic)</li>
+<li><code>ZapfDingbats</code> (symbolic)</li>
+</ul>
+It is also possible to pass an empty string. In that case, the current family 
is retained.
+</dd>
+<dt><code>style</code></dt>
+<dd>
+Font style. Possible values are (case insensitive):
+<ul>
+<li>empty string: regular</li>
+<li><code>B</code>: bold</li>
+<li><code>I</code>: italic</li>
+<li><code>U</code>: underline</li>
+</ul>
+or any combination. The default value is regular.
+Bold and italic styles do not apply to <code>Symbol</code> and 
<code>ZapfDingbats</code>.
+</dd>
+<dt><code>size</code></dt>
+<dd>
+Font size in points.
+<br>
+The default value is the current size. If no size has been specified since the 
beginning of
+the document, the value taken is 12.
+</dd>
+</dl>
+<h2>Example</h2>
+<div class="doc-source">
+<pre><code>//Times regular 12
+$pdf-&gt;SetFont('Times');
+//Arial bold 14
+$pdf-&gt;SetFont('Arial','B',14);
+//Removes bold
+$pdf-&gt;SetFont('');
+//Times bold, italic and underlined 14
+$pdf-&gt;SetFont('Times','BIU');</code></pre>
+</div>
+<h2>See also</h2>
+<a href="addfont.htm">AddFont()</a>,
+<a href="setfontsize.htm">SetFontSize()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="multicell.htm">MultiCell()</a>,
+<a href="write.htm">Write()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfontsize.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfontsize.htm   
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setfontsize.htm   
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetFontSize</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetFontSize</h1>
+<code>SetFontSize(<b>float</b> size)</code>
+<h2>Description</h2>
+Defines the size of the current font.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>size</code></dt>
+<dd>
+The size (in points).
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setfont.htm">SetFont()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setkeywords.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setkeywords.htm   
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setkeywords.htm   
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetKeywords</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetKeywords</h1>
+<code>SetKeywords(<b>string</b> keywords [, <b>boolean</b> isUTF8])</code>
+<h2>Description</h2>
+Associates keywords with the document, generally in the form 'keyword1 
keyword2 ...'.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>keywords</code></dt>
+<dd>
+The list of keywords.
+</dd>
+<dt><code>isUTF8</code></dt>
+<dd>
+Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 
(<code>true</code>).<br>
+Default value: <code>false</code>.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setauthor.htm">SetAuthor()</a>,
+<a href="setcreator.htm">SetCreator()</a>,
+<a href="setsubject.htm">SetSubject()</a>,
+<a href="settitle.htm">SetTitle()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setleftmargin.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setleftmargin.htm 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setleftmargin.htm 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetLeftMargin</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetLeftMargin</h1>
+<code>SetLeftMargin(<b>float</b> margin)</code>
+<h2>Description</h2>
+Defines the left margin. The method can be called before creating the first 
page.
+<br>
+If the current abscissa gets out of page, it is brought back to the margin.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>margin</code></dt>
+<dd>
+The margin.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="settopmargin.htm">SetTopMargin()</a>,
+<a href="setrightmargin.htm">SetRightMargin()</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>,
+<a href="setmargins.htm">SetMargins()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlinewidth.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlinewidth.htm  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlinewidth.htm  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetLineWidth</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetLineWidth</h1>
+<code>SetLineWidth(<b>float</b> width)</code>
+<h2>Description</h2>
+Defines the line width. By default, the value equals 0.2 mm. The method can be 
called before
+the first page is created and the value is retained from page to page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>width</code></dt>
+<dd>
+The width.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="line.htm">Line()</a>,
+<a href="rect.htm">Rect()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="multicell.htm">MultiCell()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlink.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlink.htm   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setlink.htm   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetLink</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetLink</h1>
+<code>SetLink(<b>int</b> link [, <b>float</b> y [, <b>int</b> page]])</code>
+<h2>Description</h2>
+Defines the page and position a link points to.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>link</code></dt>
+<dd>
+The link identifier returned by AddLink().
+</dd>
+<dt><code>y</code></dt>
+<dd>
+Ordinate of target position; <code>-1</code> indicates the current position.
+The default value is <code>0</code> (top of page).
+</dd>
+<dt><code>page</code></dt>
+<dd>
+Number of target page; <code>-1</code> indicates the current page. This is the 
default value.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="addlink.htm">AddLink()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setmargins.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setmargins.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setmargins.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetMargins</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetMargins</h1>
+<code>SetMargins(<b>float</b> left, <b>float</b> top [, <b>float</b> 
right])</code>
+<h2>Description</h2>
+Defines the left, top and right margins. By default, they equal 1 cm. Call 
this method to change
+them.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>left</code></dt>
+<dd>
+Left margin.
+</dd>
+<dt><code>top</code></dt>
+<dd>
+Top margin.
+</dd>
+<dt><code>right</code></dt>
+<dd>
+Right margin. Default value is the left one.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setleftmargin.htm">SetLeftMargin()</a>,
+<a href="settopmargin.htm">SetTopMargin()</a>,
+<a href="setrightmargin.htm">SetRightMargin()</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setrightmargin.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setrightmargin.htm
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setrightmargin.htm
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetRightMargin</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetRightMargin</h1>
+<code>SetRightMargin(<b>float</b> margin)</code>
+<h2>Description</h2>
+Defines the right margin. The method can be called before creating the first 
page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>margin</code></dt>
+<dd>
+The margin.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setleftmargin.htm">SetLeftMargin()</a>,
+<a href="settopmargin.htm">SetTopMargin()</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>,
+<a href="setmargins.htm">SetMargins()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setsubject.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setsubject.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setsubject.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetSubject</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetSubject</h1>
+<code>SetSubject(<b>string</b> subject [, <b>boolean</b> isUTF8])</code>
+<h2>Description</h2>
+Defines the subject of the document.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>subject</code></dt>
+<dd>
+The subject.
+</dd>
+<dt><code>isUTF8</code></dt>
+<dd>
+Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 
(<code>true</code>).<br>
+Default value: <code>false</code>.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setauthor.htm">SetAuthor()</a>,
+<a href="setcreator.htm">SetCreator()</a>,
+<a href="setkeywords.htm">SetKeywords()</a>,
+<a href="settitle.htm">SetTitle()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settextcolor.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settextcolor.htm  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settextcolor.htm  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetTextColor</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetTextColor</h1>
+<code>SetTextColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
+<h2>Description</h2>
+Defines the color used for text. It can be expressed in RGB components or gray 
scale. The
+method can be called before the first page is created and the value is 
retained from page to
+page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>r</code></dt>
+<dd>
+If <code>g</code> et <code>b</code> are given, red component; if not, 
indicates the gray level.
+Value between 0 and 255.
+</dd>
+<dt><code>g</code></dt>
+<dd>
+Green component (between 0 and 255).
+</dd>
+<dt><code>b</code></dt>
+<dd>
+Blue component (between 0 and 255).
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setdrawcolor.htm">SetDrawColor()</a>,
+<a href="setfillcolor.htm">SetFillColor()</a>,
+<a href="text.htm">Text()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="multicell.htm">MultiCell()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settitle.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settitle.htm  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settitle.htm  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetTitle</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetTitle</h1>
+<code>SetTitle(<b>string</b> title [, <b>boolean</b> isUTF8])</code>
+<h2>Description</h2>
+Defines the title of the document.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>title</code></dt>
+<dd>
+The title.
+</dd>
+<dt><code>isUTF8</code></dt>
+<dd>
+Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 
(<code>true</code>).<br>
+Default value: <code>false</code>.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setauthor.htm">SetAuthor()</a>,
+<a href="setcreator.htm">SetCreator()</a>,
+<a href="setkeywords.htm">SetKeywords()</a>,
+<a href="setsubject.htm">SetSubject()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settopmargin.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settopmargin.htm  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/settopmargin.htm  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetTopMargin</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetTopMargin</h1>
+<code>SetTopMargin(<b>float</b> margin)</code>
+<h2>Description</h2>
+Defines the top margin. The method can be called before creating the first 
page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>margin</code></dt>
+<dd>
+The margin.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setleftmargin.htm">SetLeftMargin()</a>,
+<a href="setrightmargin.htm">SetRightMargin()</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>,
+<a href="setmargins.htm">SetMargins()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setx.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setx.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setx.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetX</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetX</h1>
+<code>SetX(<b>float</b> x)</code>
+<h2>Description</h2>
+Defines the abscissa of the current position. If the passed value is negative, 
it is relative
+to the right of the page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>x</code></dt>
+<dd>
+The value of the abscissa.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="getx.htm">GetX()</a>,
+<a href="gety.htm">GetY()</a>,
+<a href="sety.htm">SetY()</a>,
+<a href="setxy.htm">SetXY()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setxy.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setxy.htm     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/setxy.htm     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetXY</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetXY</h1>
+<code>SetXY(<b>float</b> x, <b>float</b> y)</code>
+<h2>Description</h2>
+Defines the abscissa and ordinate of the current position. If the passed 
values are negative,
+they are relative respectively to the right and bottom of the page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>x</code></dt>
+<dd>
+The value of the abscissa.
+</dd>
+<dt><code>y</code></dt>
+<dd>
+The value of the ordinate.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setx.htm">SetX()</a>,
+<a href="sety.htm">SetY()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/sety.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/sety.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/sety.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>SetY</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>SetY</h1>
+<code>SetY(<b>float</b> y)</code>
+<h2>Description</h2>
+Moves the current abscissa back to the left margin and sets the ordinate. If 
the passed value
+is negative, it is relative to the bottom of the page.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>y</code></dt>
+<dd>
+The value of the ordinate.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="getx.htm">GetX()</a>,
+<a href="gety.htm">GetY()</a>,
+<a href="setx.htm">SetX()</a>,
+<a href="setxy.htm">SetXY()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/text.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/text.htm      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/text.htm      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Text</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Text</h1>
+<code>Text(<b>float</b> x, <b>float</b> y, <b>string</b> txt)</code>
+<h2>Description</h2>
+Prints a character string. The origin is on the left of the first character, 
on the baseline.
+This method allows to place a string precisely on the page, but it is usually 
easier to use
+Cell(), MultiCell() or Write() which are the standard methods to print text.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>x</code></dt>
+<dd>
+Abscissa of the origin.
+</dd>
+<dt><code>y</code></dt>
+<dd>
+Ordinate of the origin.
+</dd>
+<dt><code>txt</code></dt>
+<dd>
+String to print.
+</dd>
+</dl>
+<h2>See also</h2>
+<a href="setfont.htm">SetFont()</a>,
+<a href="settextcolor.htm">SetTextColor()</a>,
+<a href="cell.htm">Cell()</a>,
+<a href="multicell.htm">MultiCell()</a>,
+<a href="write.htm">Write()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/write.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/write.htm     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/doc/write.htm     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Write</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Write</h1>
+<code>Write(<b>float</b> h, <b>string</b> txt [, <b>mixed</b> link])</code>
+<h2>Description</h2>
+This method prints text from the current position. When the right margin is 
reached (or the \n
+character is met) a line break occurs and text continues from the left margin. 
Upon method exit,
+the current position is left just at the end of the text.
+<br>
+It is possible to put a link on the text.
+<h2>Parameters</h2>
+<dl class="param">
+<dt><code>h</code></dt>
+<dd>
+Line height.
+</dd>
+<dt><code>txt</code></dt>
+<dd>
+String to print.
+</dd>
+<dt><code>link</code></dt>
+<dd>
+URL or identifier returned by AddLink().
+</dd>
+</dl>
+<h2>Example</h2>
+<div class="doc-source">
+<pre><code>//Begin with regular font
+$pdf-&gt;SetFont('Arial','',14);
+$pdf-&gt;Write(5,'Visit ');
+//Then put a blue underlined link
+$pdf-&gt;SetTextColor(0,0,255);
+$pdf-&gt;SetFont('','U');
+$pdf-&gt;Write(5,'www.fpdf.org','http://www.fpdf.org');</code></pre>
+</div>
+<h2>See also</h2>
+<a href="setfont.htm">SetFont()</a>,
+<a href="settextcolor.htm">SetTextColor()</a>,
+<a href="addlink.htm">AddLink()</a>,
+<a href="multicell.htm">MultiCell()</a>,
+<a href="setautopagebreak.htm">SetAutoPageBreak()</a>.
+<hr style="margin-top:1.5em">
+<div style="text-align:center"><a href="index.htm">Index</a></div>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/courier.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/courier.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/courier.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,7 @@
+<?php
+for($i=0;$i<=255;$i++)
+       $fpdf_charwidths['courier'][chr($i)]=600;
+$fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];
+$fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];
+$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/courier.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helvetica.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helvetica.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helvetica.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helvetica']=array(
+       
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,'
 
'=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
+       
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
+       
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
+       
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+       
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
+       
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helvetica.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticab.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticab.php   
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticab.php   
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helveticaB']=array(
+       
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,'
 
'=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
+       
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
+       
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
+       
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+       
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
+       
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticab.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticabi.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticabi.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticabi.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helveticaBI']=array(
+       
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,'
 
'=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
+       
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
+       
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
+       
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+       
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
+       
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticabi.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticai.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticai.php   
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticai.php   
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helveticaI']=array(
+       
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,'
 
'=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
+       
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
+       
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
+       
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+       
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
+       
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/helveticai.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1250.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1250.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1250.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,251 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!82 U+201A quotesinglbase
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!89 U+2030 perthousand
+!8A U+0160 Scaron
+!8B U+2039 guilsinglleft
+!8C U+015A Sacute
+!8D U+0164 Tcaron
+!8E U+017D Zcaron
+!8F U+0179 Zacute
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!99 U+2122 trademark
+!9A U+0161 scaron
+!9B U+203A guilsinglright
+!9C U+015B sacute
+!9D U+0165 tcaron
+!9E U+017E zcaron
+!9F U+017A zacute
+!A0 U+00A0 space
+!A1 U+02C7 caron
+!A2 U+02D8 breve
+!A3 U+0141 Lslash
+!A4 U+00A4 currency
+!A5 U+0104 Aogonek
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AA U+015E Scedilla
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+017B Zdotaccent
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+02DB ogonek
+!B3 U+0142 lslash
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+00B8 cedilla
+!B9 U+0105 aogonek
+!BA U+015F scedilla
+!BB U+00BB guillemotright
+!BC U+013D Lcaron
+!BD U+02DD hungarumlaut
+!BE U+013E lcaron
+!BF U+017C zdotaccent
+!C0 U+0154 Racute
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+0102 Abreve
+!C4 U+00C4 Adieresis
+!C5 U+0139 Lacute
+!C6 U+0106 Cacute
+!C7 U+00C7 Ccedilla
+!C8 U+010C Ccaron
+!C9 U+00C9 Eacute
+!CA U+0118 Eogonek
+!CB U+00CB Edieresis
+!CC U+011A Ecaron
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+010E Dcaron
+!D0 U+0110 Dcroat
+!D1 U+0143 Nacute
+!D2 U+0147 Ncaron
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+0150 Ohungarumlaut
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+0158 Rcaron
+!D9 U+016E Uring
+!DA U+00DA Uacute
+!DB U+0170 Uhungarumlaut
+!DC U+00DC Udieresis
+!DD U+00DD Yacute
+!DE U+0162 Tcommaaccent
+!DF U+00DF germandbls
+!E0 U+0155 racute
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+0103 abreve
+!E4 U+00E4 adieresis
+!E5 U+013A lacute
+!E6 U+0107 cacute
+!E7 U+00E7 ccedilla
+!E8 U+010D ccaron
+!E9 U+00E9 eacute
+!EA U+0119 eogonek
+!EB U+00EB edieresis
+!EC U+011B ecaron
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+010F dcaron
+!F0 U+0111 dcroat
+!F1 U+0144 nacute
+!F2 U+0148 ncaron
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+0151 ohungarumlaut
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+0159 rcaron
+!F9 U+016F uring
+!FA U+00FA uacute
+!FB U+0171 uhungarumlaut
+!FC U+00FC udieresis
+!FD U+00FD yacute
+!FE U+0163 tcommaaccent
+!FF U+02D9 dotaccent

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1251.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1251.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1251.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,255 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0402 afii10051
+!81 U+0403 afii10052
+!82 U+201A quotesinglbase
+!83 U+0453 afii10100
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!88 U+20AC Euro
+!89 U+2030 perthousand
+!8A U+0409 afii10058
+!8B U+2039 guilsinglleft
+!8C U+040A afii10059
+!8D U+040C afii10061
+!8E U+040B afii10060
+!8F U+040F afii10145
+!90 U+0452 afii10099
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!99 U+2122 trademark
+!9A U+0459 afii10106
+!9B U+203A guilsinglright
+!9C U+045A afii10107
+!9D U+045C afii10109
+!9E U+045B afii10108
+!9F U+045F afii10193
+!A0 U+00A0 space
+!A1 U+040E afii10062
+!A2 U+045E afii10110
+!A3 U+0408 afii10057
+!A4 U+00A4 currency
+!A5 U+0490 afii10050
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+0401 afii10023
+!A9 U+00A9 copyright
+!AA U+0404 afii10053
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+0407 afii10056
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+0406 afii10055
+!B3 U+0456 afii10103
+!B4 U+0491 afii10098
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+0451 afii10071
+!B9 U+2116 afii61352
+!BA U+0454 afii10101
+!BB U+00BB guillemotright
+!BC U+0458 afii10105
+!BD U+0405 afii10054
+!BE U+0455 afii10102
+!BF U+0457 afii10104
+!C0 U+0410 afii10017
+!C1 U+0411 afii10018
+!C2 U+0412 afii10019
+!C3 U+0413 afii10020
+!C4 U+0414 afii10021
+!C5 U+0415 afii10022
+!C6 U+0416 afii10024
+!C7 U+0417 afii10025
+!C8 U+0418 afii10026
+!C9 U+0419 afii10027
+!CA U+041A afii10028
+!CB U+041B afii10029
+!CC U+041C afii10030
+!CD U+041D afii10031
+!CE U+041E afii10032
+!CF U+041F afii10033
+!D0 U+0420 afii10034
+!D1 U+0421 afii10035
+!D2 U+0422 afii10036
+!D3 U+0423 afii10037
+!D4 U+0424 afii10038
+!D5 U+0425 afii10039
+!D6 U+0426 afii10040
+!D7 U+0427 afii10041
+!D8 U+0428 afii10042
+!D9 U+0429 afii10043
+!DA U+042A afii10044
+!DB U+042B afii10045
+!DC U+042C afii10046
+!DD U+042D afii10047
+!DE U+042E afii10048
+!DF U+042F afii10049
+!E0 U+0430 afii10065
+!E1 U+0431 afii10066
+!E2 U+0432 afii10067
+!E3 U+0433 afii10068
+!E4 U+0434 afii10069
+!E5 U+0435 afii10070
+!E6 U+0436 afii10072
+!E7 U+0437 afii10073
+!E8 U+0438 afii10074
+!E9 U+0439 afii10075
+!EA U+043A afii10076
+!EB U+043B afii10077
+!EC U+043C afii10078
+!ED U+043D afii10079
+!EE U+043E afii10080
+!EF U+043F afii10081
+!F0 U+0440 afii10082
+!F1 U+0441 afii10083
+!F2 U+0442 afii10084
+!F3 U+0443 afii10085
+!F4 U+0444 afii10086
+!F5 U+0445 afii10087
+!F6 U+0446 afii10088
+!F7 U+0447 afii10089
+!F8 U+0448 afii10090
+!F9 U+0449 afii10091
+!FA U+044A afii10092
+!FB U+044B afii10093
+!FC U+044C afii10094
+!FD U+044D afii10095
+!FE U+044E afii10096
+!FF U+044F afii10097

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1252.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1252.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1252.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,251 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!82 U+201A quotesinglbase
+!83 U+0192 florin
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!88 U+02C6 circumflex
+!89 U+2030 perthousand
+!8A U+0160 Scaron
+!8B U+2039 guilsinglleft
+!8C U+0152 OE
+!8E U+017D Zcaron
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!98 U+02DC tilde
+!99 U+2122 trademark
+!9A U+0161 scaron
+!9B U+203A guilsinglright
+!9C U+0153 oe
+!9E U+017E zcaron
+!9F U+0178 Ydieresis
+!A0 U+00A0 space
+!A1 U+00A1 exclamdown
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+00A4 currency
+!A5 U+00A5 yen
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AA U+00AA ordfeminine
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+00B8 cedilla
+!B9 U+00B9 onesuperior
+!BA U+00BA ordmasculine
+!BB U+00BB guillemotright
+!BC U+00BC onequarter
+!BD U+00BD onehalf
+!BE U+00BE threequarters
+!BF U+00BF questiondown
+!C0 U+00C0 Agrave
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+00C3 Atilde
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+00C6 AE
+!C7 U+00C7 Ccedilla
+!C8 U+00C8 Egrave
+!C9 U+00C9 Eacute
+!CA U+00CA Ecircumflex
+!CB U+00CB Edieresis
+!CC U+00CC Igrave
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+00CF Idieresis
+!D0 U+00D0 Eth
+!D1 U+00D1 Ntilde
+!D2 U+00D2 Ograve
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+00D5 Otilde
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+00D8 Oslash
+!D9 U+00D9 Ugrave
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+00DD Yacute
+!DE U+00DE Thorn
+!DF U+00DF germandbls
+!E0 U+00E0 agrave
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+00E3 atilde
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+00E6 ae
+!E7 U+00E7 ccedilla
+!E8 U+00E8 egrave
+!E9 U+00E9 eacute
+!EA U+00EA ecircumflex
+!EB U+00EB edieresis
+!EC U+00EC igrave
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+00EF idieresis
+!F0 U+00F0 eth
+!F1 U+00F1 ntilde
+!F2 U+00F2 ograve
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+00F5 otilde
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+00F8 oslash
+!F9 U+00F9 ugrave
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+00FD yacute
+!FE U+00FE thorn
+!FF U+00FF ydieresis

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1253.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1253.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1253.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,239 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!82 U+201A quotesinglbase
+!83 U+0192 florin
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!89 U+2030 perthousand
+!8B U+2039 guilsinglleft
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!99 U+2122 trademark
+!9B U+203A guilsinglright
+!A0 U+00A0 space
+!A1 U+0385 dieresistonos
+!A2 U+0386 Alphatonos
+!A3 U+00A3 sterling
+!A4 U+00A4 currency
+!A5 U+00A5 yen
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+2015 afii00208
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+0384 tonos
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+0388 Epsilontonos
+!B9 U+0389 Etatonos
+!BA U+038A Iotatonos
+!BB U+00BB guillemotright
+!BC U+038C Omicrontonos
+!BD U+00BD onehalf
+!BE U+038E Upsilontonos
+!BF U+038F Omegatonos
+!C0 U+0390 iotadieresistonos
+!C1 U+0391 Alpha
+!C2 U+0392 Beta
+!C3 U+0393 Gamma
+!C4 U+0394 Delta
+!C5 U+0395 Epsilon
+!C6 U+0396 Zeta
+!C7 U+0397 Eta
+!C8 U+0398 Theta
+!C9 U+0399 Iota
+!CA U+039A Kappa
+!CB U+039B Lambda
+!CC U+039C Mu
+!CD U+039D Nu
+!CE U+039E Xi
+!CF U+039F Omicron
+!D0 U+03A0 Pi
+!D1 U+03A1 Rho
+!D3 U+03A3 Sigma
+!D4 U+03A4 Tau
+!D5 U+03A5 Upsilon
+!D6 U+03A6 Phi
+!D7 U+03A7 Chi
+!D8 U+03A8 Psi
+!D9 U+03A9 Omega
+!DA U+03AA Iotadieresis
+!DB U+03AB Upsilondieresis
+!DC U+03AC alphatonos
+!DD U+03AD epsilontonos
+!DE U+03AE etatonos
+!DF U+03AF iotatonos
+!E0 U+03B0 upsilondieresistonos
+!E1 U+03B1 alpha
+!E2 U+03B2 beta
+!E3 U+03B3 gamma
+!E4 U+03B4 delta
+!E5 U+03B5 epsilon
+!E6 U+03B6 zeta
+!E7 U+03B7 eta
+!E8 U+03B8 theta
+!E9 U+03B9 iota
+!EA U+03BA kappa
+!EB U+03BB lambda
+!EC U+03BC mu
+!ED U+03BD nu
+!EE U+03BE xi
+!EF U+03BF omicron
+!F0 U+03C0 pi
+!F1 U+03C1 rho
+!F2 U+03C2 sigma1
+!F3 U+03C3 sigma
+!F4 U+03C4 tau
+!F5 U+03C5 upsilon
+!F6 U+03C6 phi
+!F7 U+03C7 chi
+!F8 U+03C8 psi
+!F9 U+03C9 omega
+!FA U+03CA iotadieresis
+!FB U+03CB upsilondieresis
+!FC U+03CC omicrontonos
+!FD U+03CD upsilontonos
+!FE U+03CE omegatonos

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1254.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1254.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1254.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,249 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!82 U+201A quotesinglbase
+!83 U+0192 florin
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!88 U+02C6 circumflex
+!89 U+2030 perthousand
+!8A U+0160 Scaron
+!8B U+2039 guilsinglleft
+!8C U+0152 OE
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!98 U+02DC tilde
+!99 U+2122 trademark
+!9A U+0161 scaron
+!9B U+203A guilsinglright
+!9C U+0153 oe
+!9F U+0178 Ydieresis
+!A0 U+00A0 space
+!A1 U+00A1 exclamdown
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+00A4 currency
+!A5 U+00A5 yen
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AA U+00AA ordfeminine
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+00B8 cedilla
+!B9 U+00B9 onesuperior
+!BA U+00BA ordmasculine
+!BB U+00BB guillemotright
+!BC U+00BC onequarter
+!BD U+00BD onehalf
+!BE U+00BE threequarters
+!BF U+00BF questiondown
+!C0 U+00C0 Agrave
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+00C3 Atilde
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+00C6 AE
+!C7 U+00C7 Ccedilla
+!C8 U+00C8 Egrave
+!C9 U+00C9 Eacute
+!CA U+00CA Ecircumflex
+!CB U+00CB Edieresis
+!CC U+00CC Igrave
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+00CF Idieresis
+!D0 U+011E Gbreve
+!D1 U+00D1 Ntilde
+!D2 U+00D2 Ograve
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+00D5 Otilde
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+00D8 Oslash
+!D9 U+00D9 Ugrave
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+0130 Idotaccent
+!DE U+015E Scedilla
+!DF U+00DF germandbls
+!E0 U+00E0 agrave
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+00E3 atilde
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+00E6 ae
+!E7 U+00E7 ccedilla
+!E8 U+00E8 egrave
+!E9 U+00E9 eacute
+!EA U+00EA ecircumflex
+!EB U+00EB edieresis
+!EC U+00EC igrave
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+00EF idieresis
+!F0 U+011F gbreve
+!F1 U+00F1 ntilde
+!F2 U+00F2 ograve
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+00F5 otilde
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+00F8 oslash
+!F9 U+00F9 ugrave
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+0131 dotlessi
+!FE U+015F scedilla
+!FF U+00FF ydieresis

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1255.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1255.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1255.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,233 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!82 U+201A quotesinglbase
+!83 U+0192 florin
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!88 U+02C6 circumflex
+!89 U+2030 perthousand
+!8B U+2039 guilsinglleft
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!98 U+02DC tilde
+!99 U+2122 trademark
+!9B U+203A guilsinglright
+!A0 U+00A0 space
+!A1 U+00A1 exclamdown
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+20AA afii57636
+!A5 U+00A5 yen
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AA U+00D7 multiply
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD sfthyphen
+!AE U+00AE registered
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 middot
+!B8 U+00B8 cedilla
+!B9 U+00B9 onesuperior
+!BA U+00F7 divide
+!BB U+00BB guillemotright
+!BC U+00BC onequarter
+!BD U+00BD onehalf
+!BE U+00BE threequarters
+!BF U+00BF questiondown
+!C0 U+05B0 afii57799
+!C1 U+05B1 afii57801
+!C2 U+05B2 afii57800
+!C3 U+05B3 afii57802
+!C4 U+05B4 afii57793
+!C5 U+05B5 afii57794
+!C6 U+05B6 afii57795
+!C7 U+05B7 afii57798
+!C8 U+05B8 afii57797
+!C9 U+05B9 afii57806
+!CB U+05BB afii57796
+!CC U+05BC afii57807
+!CD U+05BD afii57839
+!CE U+05BE afii57645
+!CF U+05BF afii57841
+!D0 U+05C0 afii57842
+!D1 U+05C1 afii57804
+!D2 U+05C2 afii57803
+!D3 U+05C3 afii57658
+!D4 U+05F0 afii57716
+!D5 U+05F1 afii57717
+!D6 U+05F2 afii57718
+!D7 U+05F3 gereshhebrew
+!D8 U+05F4 gershayimhebrew
+!E0 U+05D0 afii57664
+!E1 U+05D1 afii57665
+!E2 U+05D2 afii57666
+!E3 U+05D3 afii57667
+!E4 U+05D4 afii57668
+!E5 U+05D5 afii57669
+!E6 U+05D6 afii57670
+!E7 U+05D7 afii57671
+!E8 U+05D8 afii57672
+!E9 U+05D9 afii57673
+!EA U+05DA afii57674
+!EB U+05DB afii57675
+!EC U+05DC afii57676
+!ED U+05DD afii57677
+!EE U+05DE afii57678
+!EF U+05DF afii57679
+!F0 U+05E0 afii57680
+!F1 U+05E1 afii57681
+!F2 U+05E2 afii57682
+!F3 U+05E3 afii57683
+!F4 U+05E4 afii57684
+!F5 U+05E5 afii57685
+!F6 U+05E6 afii57686
+!F7 U+05E7 afii57687
+!F8 U+05E8 afii57688
+!F9 U+05E9 afii57689
+!FA U+05EA afii57690
+!FD U+200E afii299
+!FE U+200F afii300

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1257.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1257.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1257.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,244 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!82 U+201A quotesinglbase
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!89 U+2030 perthousand
+!8B U+2039 guilsinglleft
+!8D U+00A8 dieresis
+!8E U+02C7 caron
+!8F U+00B8 cedilla
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!99 U+2122 trademark
+!9B U+203A guilsinglright
+!9D U+00AF macron
+!9E U+02DB ogonek
+!A0 U+00A0 space
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+00A4 currency
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00D8 Oslash
+!A9 U+00A9 copyright
+!AA U+0156 Rcommaaccent
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+00C6 AE
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+00F8 oslash
+!B9 U+00B9 onesuperior
+!BA U+0157 rcommaaccent
+!BB U+00BB guillemotright
+!BC U+00BC onequarter
+!BD U+00BD onehalf
+!BE U+00BE threequarters
+!BF U+00E6 ae
+!C0 U+0104 Aogonek
+!C1 U+012E Iogonek
+!C2 U+0100 Amacron
+!C3 U+0106 Cacute
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+0118 Eogonek
+!C7 U+0112 Emacron
+!C8 U+010C Ccaron
+!C9 U+00C9 Eacute
+!CA U+0179 Zacute
+!CB U+0116 Edotaccent
+!CC U+0122 Gcommaaccent
+!CD U+0136 Kcommaaccent
+!CE U+012A Imacron
+!CF U+013B Lcommaaccent
+!D0 U+0160 Scaron
+!D1 U+0143 Nacute
+!D2 U+0145 Ncommaaccent
+!D3 U+00D3 Oacute
+!D4 U+014C Omacron
+!D5 U+00D5 Otilde
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+0172 Uogonek
+!D9 U+0141 Lslash
+!DA U+015A Sacute
+!DB U+016A Umacron
+!DC U+00DC Udieresis
+!DD U+017B Zdotaccent
+!DE U+017D Zcaron
+!DF U+00DF germandbls
+!E0 U+0105 aogonek
+!E1 U+012F iogonek
+!E2 U+0101 amacron
+!E3 U+0107 cacute
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+0119 eogonek
+!E7 U+0113 emacron
+!E8 U+010D ccaron
+!E9 U+00E9 eacute
+!EA U+017A zacute
+!EB U+0117 edotaccent
+!EC U+0123 gcommaaccent
+!ED U+0137 kcommaaccent
+!EE U+012B imacron
+!EF U+013C lcommaaccent
+!F0 U+0161 scaron
+!F1 U+0144 nacute
+!F2 U+0146 ncommaaccent
+!F3 U+00F3 oacute
+!F4 U+014D omacron
+!F5 U+00F5 otilde
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+0173 uogonek
+!F9 U+0142 lslash
+!FA U+015B sacute
+!FB U+016B umacron
+!FC U+00FC udieresis
+!FD U+017C zdotaccent
+!FE U+017E zcaron
+!FF U+02D9 dotaccent

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1258.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1258.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp1258.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,247 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!82 U+201A quotesinglbase
+!83 U+0192 florin
+!84 U+201E quotedblbase
+!85 U+2026 ellipsis
+!86 U+2020 dagger
+!87 U+2021 daggerdbl
+!88 U+02C6 circumflex
+!89 U+2030 perthousand
+!8B U+2039 guilsinglleft
+!8C U+0152 OE
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!98 U+02DC tilde
+!99 U+2122 trademark
+!9B U+203A guilsinglright
+!9C U+0153 oe
+!9F U+0178 Ydieresis
+!A0 U+00A0 space
+!A1 U+00A1 exclamdown
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+00A4 currency
+!A5 U+00A5 yen
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AA U+00AA ordfeminine
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+00B8 cedilla
+!B9 U+00B9 onesuperior
+!BA U+00BA ordmasculine
+!BB U+00BB guillemotright
+!BC U+00BC onequarter
+!BD U+00BD onehalf
+!BE U+00BE threequarters
+!BF U+00BF questiondown
+!C0 U+00C0 Agrave
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+0102 Abreve
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+00C6 AE
+!C7 U+00C7 Ccedilla
+!C8 U+00C8 Egrave
+!C9 U+00C9 Eacute
+!CA U+00CA Ecircumflex
+!CB U+00CB Edieresis
+!CC U+0300 gravecomb
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+00CF Idieresis
+!D0 U+0110 Dcroat
+!D1 U+00D1 Ntilde
+!D2 U+0309 hookabovecomb
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+01A0 Ohorn
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+00D8 Oslash
+!D9 U+00D9 Ugrave
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+01AF Uhorn
+!DE U+0303 tildecomb
+!DF U+00DF germandbls
+!E0 U+00E0 agrave
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+0103 abreve
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+00E6 ae
+!E7 U+00E7 ccedilla
+!E8 U+00E8 egrave
+!E9 U+00E9 eacute
+!EA U+00EA ecircumflex
+!EB U+00EB edieresis
+!EC U+0301 acutecomb
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+00EF idieresis
+!F0 U+0111 dcroat
+!F1 U+00F1 ntilde
+!F2 U+0323 dotbelowcomb
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+01A1 ohorn
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+00F8 oslash
+!F9 U+00F9 ugrave
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+01B0 uhorn
+!FE U+20AB dong
+!FF U+00FF ydieresis

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp874.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp874.map
                           (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/cp874.map
   2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,225 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+20AC Euro
+!85 U+2026 ellipsis
+!91 U+2018 quoteleft
+!92 U+2019 quoteright
+!93 U+201C quotedblleft
+!94 U+201D quotedblright
+!95 U+2022 bullet
+!96 U+2013 endash
+!97 U+2014 emdash
+!A0 U+00A0 space
+!A1 U+0E01 kokaithai
+!A2 U+0E02 khokhaithai
+!A3 U+0E03 khokhuatthai
+!A4 U+0E04 khokhwaithai
+!A5 U+0E05 khokhonthai
+!A6 U+0E06 khorakhangthai
+!A7 U+0E07 ngonguthai
+!A8 U+0E08 chochanthai
+!A9 U+0E09 chochingthai
+!AA U+0E0A chochangthai
+!AB U+0E0B sosothai
+!AC U+0E0C chochoethai
+!AD U+0E0D yoyingthai
+!AE U+0E0E dochadathai
+!AF U+0E0F topatakthai
+!B0 U+0E10 thothanthai
+!B1 U+0E11 thonangmonthothai
+!B2 U+0E12 thophuthaothai
+!B3 U+0E13 nonenthai
+!B4 U+0E14 dodekthai
+!B5 U+0E15 totaothai
+!B6 U+0E16 thothungthai
+!B7 U+0E17 thothahanthai
+!B8 U+0E18 thothongthai
+!B9 U+0E19 nonuthai
+!BA U+0E1A bobaimaithai
+!BB U+0E1B poplathai
+!BC U+0E1C phophungthai
+!BD U+0E1D fofathai
+!BE U+0E1E phophanthai
+!BF U+0E1F fofanthai
+!C0 U+0E20 phosamphaothai
+!C1 U+0E21 momathai
+!C2 U+0E22 yoyakthai
+!C3 U+0E23 roruathai
+!C4 U+0E24 ruthai
+!C5 U+0E25 lolingthai
+!C6 U+0E26 luthai
+!C7 U+0E27 wowaenthai
+!C8 U+0E28 sosalathai
+!C9 U+0E29 sorusithai
+!CA U+0E2A sosuathai
+!CB U+0E2B hohipthai
+!CC U+0E2C lochulathai
+!CD U+0E2D oangthai
+!CE U+0E2E honokhukthai
+!CF U+0E2F paiyannoithai
+!D0 U+0E30 saraathai
+!D1 U+0E31 maihanakatthai
+!D2 U+0E32 saraaathai
+!D3 U+0E33 saraamthai
+!D4 U+0E34 saraithai
+!D5 U+0E35 saraiithai
+!D6 U+0E36 sarauethai
+!D7 U+0E37 saraueethai
+!D8 U+0E38 sarauthai
+!D9 U+0E39 sarauuthai
+!DA U+0E3A phinthuthai
+!DF U+0E3F bahtthai
+!E0 U+0E40 saraethai
+!E1 U+0E41 saraaethai
+!E2 U+0E42 saraothai
+!E3 U+0E43 saraaimaimuanthai
+!E4 U+0E44 saraaimaimalaithai
+!E5 U+0E45 lakkhangyaothai
+!E6 U+0E46 maiyamokthai
+!E7 U+0E47 maitaikhuthai
+!E8 U+0E48 maiekthai
+!E9 U+0E49 maithothai
+!EA U+0E4A maitrithai
+!EB U+0E4B maichattawathai
+!EC U+0E4C thanthakhatthai
+!ED U+0E4D nikhahitthai
+!EE U+0E4E yamakkanthai
+!EF U+0E4F fongmanthai
+!F0 U+0E50 zerothai
+!F1 U+0E51 onethai
+!F2 U+0E52 twothai
+!F3 U+0E53 threethai
+!F4 U+0E54 fourthai
+!F5 U+0E55 fivethai
+!F6 U+0E56 sixthai
+!F7 U+0E57 seventhai
+!F8 U+0E58 eightthai
+!F9 U+0E59 ninethai
+!FA U+0E5A angkhankhuthai
+!FB U+0E5B khomutthai

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-1.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-1.map
                              (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-1.map
      2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+00A1 exclamdown
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+00A4 currency
+!A5 U+00A5 yen
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AA U+00AA ordfeminine
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+00B8 cedilla
+!B9 U+00B9 onesuperior
+!BA U+00BA ordmasculine
+!BB U+00BB guillemotright
+!BC U+00BC onequarter
+!BD U+00BD onehalf
+!BE U+00BE threequarters
+!BF U+00BF questiondown
+!C0 U+00C0 Agrave
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+00C3 Atilde
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+00C6 AE
+!C7 U+00C7 Ccedilla
+!C8 U+00C8 Egrave
+!C9 U+00C9 Eacute
+!CA U+00CA Ecircumflex
+!CB U+00CB Edieresis
+!CC U+00CC Igrave
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+00CF Idieresis
+!D0 U+00D0 Eth
+!D1 U+00D1 Ntilde
+!D2 U+00D2 Ograve
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+00D5 Otilde
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+00D8 Oslash
+!D9 U+00D9 Ugrave
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+00DD Yacute
+!DE U+00DE Thorn
+!DF U+00DF germandbls
+!E0 U+00E0 agrave
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+00E3 atilde
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+00E6 ae
+!E7 U+00E7 ccedilla
+!E8 U+00E8 egrave
+!E9 U+00E9 eacute
+!EA U+00EA ecircumflex
+!EB U+00EB edieresis
+!EC U+00EC igrave
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+00EF idieresis
+!F0 U+00F0 eth
+!F1 U+00F1 ntilde
+!F2 U+00F2 ograve
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+00F5 otilde
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+00F8 oslash
+!F9 U+00F9 ugrave
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+00FD yacute
+!FE U+00FE thorn
+!FF U+00FF ydieresis

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-11.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-11.map
                             (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-11.map
     2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,248 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+0E01 kokaithai
+!A2 U+0E02 khokhaithai
+!A3 U+0E03 khokhuatthai
+!A4 U+0E04 khokhwaithai
+!A5 U+0E05 khokhonthai
+!A6 U+0E06 khorakhangthai
+!A7 U+0E07 ngonguthai
+!A8 U+0E08 chochanthai
+!A9 U+0E09 chochingthai
+!AA U+0E0A chochangthai
+!AB U+0E0B sosothai
+!AC U+0E0C chochoethai
+!AD U+0E0D yoyingthai
+!AE U+0E0E dochadathai
+!AF U+0E0F topatakthai
+!B0 U+0E10 thothanthai
+!B1 U+0E11 thonangmonthothai
+!B2 U+0E12 thophuthaothai
+!B3 U+0E13 nonenthai
+!B4 U+0E14 dodekthai
+!B5 U+0E15 totaothai
+!B6 U+0E16 thothungthai
+!B7 U+0E17 thothahanthai
+!B8 U+0E18 thothongthai
+!B9 U+0E19 nonuthai
+!BA U+0E1A bobaimaithai
+!BB U+0E1B poplathai
+!BC U+0E1C phophungthai
+!BD U+0E1D fofathai
+!BE U+0E1E phophanthai
+!BF U+0E1F fofanthai
+!C0 U+0E20 phosamphaothai
+!C1 U+0E21 momathai
+!C2 U+0E22 yoyakthai
+!C3 U+0E23 roruathai
+!C4 U+0E24 ruthai
+!C5 U+0E25 lolingthai
+!C6 U+0E26 luthai
+!C7 U+0E27 wowaenthai
+!C8 U+0E28 sosalathai
+!C9 U+0E29 sorusithai
+!CA U+0E2A sosuathai
+!CB U+0E2B hohipthai
+!CC U+0E2C lochulathai
+!CD U+0E2D oangthai
+!CE U+0E2E honokhukthai
+!CF U+0E2F paiyannoithai
+!D0 U+0E30 saraathai
+!D1 U+0E31 maihanakatthai
+!D2 U+0E32 saraaathai
+!D3 U+0E33 saraamthai
+!D4 U+0E34 saraithai
+!D5 U+0E35 saraiithai
+!D6 U+0E36 sarauethai
+!D7 U+0E37 saraueethai
+!D8 U+0E38 sarauthai
+!D9 U+0E39 sarauuthai
+!DA U+0E3A phinthuthai
+!DF U+0E3F bahtthai
+!E0 U+0E40 saraethai
+!E1 U+0E41 saraaethai
+!E2 U+0E42 saraothai
+!E3 U+0E43 saraaimaimuanthai
+!E4 U+0E44 saraaimaimalaithai
+!E5 U+0E45 lakkhangyaothai
+!E6 U+0E46 maiyamokthai
+!E7 U+0E47 maitaikhuthai
+!E8 U+0E48 maiekthai
+!E9 U+0E49 maithothai
+!EA U+0E4A maitrithai
+!EB U+0E4B maichattawathai
+!EC U+0E4C thanthakhatthai
+!ED U+0E4D nikhahitthai
+!EE U+0E4E yamakkanthai
+!EF U+0E4F fongmanthai
+!F0 U+0E50 zerothai
+!F1 U+0E51 onethai
+!F2 U+0E52 twothai
+!F3 U+0E53 threethai
+!F4 U+0E54 fourthai
+!F5 U+0E55 fivethai
+!F6 U+0E56 sixthai
+!F7 U+0E57 seventhai
+!F8 U+0E58 eightthai
+!F9 U+0E59 ninethai
+!FA U+0E5A angkhankhuthai
+!FB U+0E5B khomutthai

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-15.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-15.map
                             (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-15.map
     2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+00A1 exclamdown
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+20AC Euro
+!A5 U+00A5 yen
+!A6 U+0160 Scaron
+!A7 U+00A7 section
+!A8 U+0161 scaron
+!A9 U+00A9 copyright
+!AA U+00AA ordfeminine
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+017D Zcaron
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+017E zcaron
+!B9 U+00B9 onesuperior
+!BA U+00BA ordmasculine
+!BB U+00BB guillemotright
+!BC U+0152 OE
+!BD U+0153 oe
+!BE U+0178 Ydieresis
+!BF U+00BF questiondown
+!C0 U+00C0 Agrave
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+00C3 Atilde
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+00C6 AE
+!C7 U+00C7 Ccedilla
+!C8 U+00C8 Egrave
+!C9 U+00C9 Eacute
+!CA U+00CA Ecircumflex
+!CB U+00CB Edieresis
+!CC U+00CC Igrave
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+00CF Idieresis
+!D0 U+00D0 Eth
+!D1 U+00D1 Ntilde
+!D2 U+00D2 Ograve
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+00D5 Otilde
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+00D8 Oslash
+!D9 U+00D9 Ugrave
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+00DD Yacute
+!DE U+00DE Thorn
+!DF U+00DF germandbls
+!E0 U+00E0 agrave
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+00E3 atilde
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+00E6 ae
+!E7 U+00E7 ccedilla
+!E8 U+00E8 egrave
+!E9 U+00E9 eacute
+!EA U+00EA ecircumflex
+!EB U+00EB edieresis
+!EC U+00EC igrave
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+00EF idieresis
+!F0 U+00F0 eth
+!F1 U+00F1 ntilde
+!F2 U+00F2 ograve
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+00F5 otilde
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+00F8 oslash
+!F9 U+00F9 ugrave
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+00FD yacute
+!FE U+00FE thorn
+!FF U+00FF ydieresis

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-16.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-16.map
                             (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-16.map
     2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+0104 Aogonek
+!A2 U+0105 aogonek
+!A3 U+0141 Lslash
+!A4 U+20AC Euro
+!A5 U+201E quotedblbase
+!A6 U+0160 Scaron
+!A7 U+00A7 section
+!A8 U+0161 scaron
+!A9 U+00A9 copyright
+!AA U+0218 Scommaaccent
+!AB U+00AB guillemotleft
+!AC U+0179 Zacute
+!AD U+00AD hyphen
+!AE U+017A zacute
+!AF U+017B Zdotaccent
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+010C Ccaron
+!B3 U+0142 lslash
+!B4 U+017D Zcaron
+!B5 U+201D quotedblright
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+017E zcaron
+!B9 U+010D ccaron
+!BA U+0219 scommaaccent
+!BB U+00BB guillemotright
+!BC U+0152 OE
+!BD U+0153 oe
+!BE U+0178 Ydieresis
+!BF U+017C zdotaccent
+!C0 U+00C0 Agrave
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+0102 Abreve
+!C4 U+00C4 Adieresis
+!C5 U+0106 Cacute
+!C6 U+00C6 AE
+!C7 U+00C7 Ccedilla
+!C8 U+00C8 Egrave
+!C9 U+00C9 Eacute
+!CA U+00CA Ecircumflex
+!CB U+00CB Edieresis
+!CC U+00CC Igrave
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+00CF Idieresis
+!D0 U+0110 Dcroat
+!D1 U+0143 Nacute
+!D2 U+00D2 Ograve
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+0150 Ohungarumlaut
+!D6 U+00D6 Odieresis
+!D7 U+015A Sacute
+!D8 U+0170 Uhungarumlaut
+!D9 U+00D9 Ugrave
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+0118 Eogonek
+!DE U+021A Tcommaaccent
+!DF U+00DF germandbls
+!E0 U+00E0 agrave
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+0103 abreve
+!E4 U+00E4 adieresis
+!E5 U+0107 cacute
+!E6 U+00E6 ae
+!E7 U+00E7 ccedilla
+!E8 U+00E8 egrave
+!E9 U+00E9 eacute
+!EA U+00EA ecircumflex
+!EB U+00EB edieresis
+!EC U+00EC igrave
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+00EF idieresis
+!F0 U+0111 dcroat
+!F1 U+0144 nacute
+!F2 U+00F2 ograve
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+0151 ohungarumlaut
+!F6 U+00F6 odieresis
+!F7 U+015B sacute
+!F8 U+0171 uhungarumlaut
+!F9 U+00F9 ugrave
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+0119 eogonek
+!FE U+021B tcommaaccent
+!FF U+00FF ydieresis

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-2.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-2.map
                              (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-2.map
      2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+0104 Aogonek
+!A2 U+02D8 breve
+!A3 U+0141 Lslash
+!A4 U+00A4 currency
+!A5 U+013D Lcaron
+!A6 U+015A Sacute
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+0160 Scaron
+!AA U+015E Scedilla
+!AB U+0164 Tcaron
+!AC U+0179 Zacute
+!AD U+00AD hyphen
+!AE U+017D Zcaron
+!AF U+017B Zdotaccent
+!B0 U+00B0 degree
+!B1 U+0105 aogonek
+!B2 U+02DB ogonek
+!B3 U+0142 lslash
+!B4 U+00B4 acute
+!B5 U+013E lcaron
+!B6 U+015B sacute
+!B7 U+02C7 caron
+!B8 U+00B8 cedilla
+!B9 U+0161 scaron
+!BA U+015F scedilla
+!BB U+0165 tcaron
+!BC U+017A zacute
+!BD U+02DD hungarumlaut
+!BE U+017E zcaron
+!BF U+017C zdotaccent
+!C0 U+0154 Racute
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+0102 Abreve
+!C4 U+00C4 Adieresis
+!C5 U+0139 Lacute
+!C6 U+0106 Cacute
+!C7 U+00C7 Ccedilla
+!C8 U+010C Ccaron
+!C9 U+00C9 Eacute
+!CA U+0118 Eogonek
+!CB U+00CB Edieresis
+!CC U+011A Ecaron
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+010E Dcaron
+!D0 U+0110 Dcroat
+!D1 U+0143 Nacute
+!D2 U+0147 Ncaron
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+0150 Ohungarumlaut
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+0158 Rcaron
+!D9 U+016E Uring
+!DA U+00DA Uacute
+!DB U+0170 Uhungarumlaut
+!DC U+00DC Udieresis
+!DD U+00DD Yacute
+!DE U+0162 Tcommaaccent
+!DF U+00DF germandbls
+!E0 U+0155 racute
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+0103 abreve
+!E4 U+00E4 adieresis
+!E5 U+013A lacute
+!E6 U+0107 cacute
+!E7 U+00E7 ccedilla
+!E8 U+010D ccaron
+!E9 U+00E9 eacute
+!EA U+0119 eogonek
+!EB U+00EB edieresis
+!EC U+011B ecaron
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+010F dcaron
+!F0 U+0111 dcroat
+!F1 U+0144 nacute
+!F2 U+0148 ncaron
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+0151 ohungarumlaut
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+0159 rcaron
+!F9 U+016F uring
+!FA U+00FA uacute
+!FB U+0171 uhungarumlaut
+!FC U+00FC udieresis
+!FD U+00FD yacute
+!FE U+0163 tcommaaccent
+!FF U+02D9 dotaccent

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-4.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-4.map
                              (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-4.map
      2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+0104 Aogonek
+!A2 U+0138 kgreenlandic
+!A3 U+0156 Rcommaaccent
+!A4 U+00A4 currency
+!A5 U+0128 Itilde
+!A6 U+013B Lcommaaccent
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+0160 Scaron
+!AA U+0112 Emacron
+!AB U+0122 Gcommaaccent
+!AC U+0166 Tbar
+!AD U+00AD hyphen
+!AE U+017D Zcaron
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+0105 aogonek
+!B2 U+02DB ogonek
+!B3 U+0157 rcommaaccent
+!B4 U+00B4 acute
+!B5 U+0129 itilde
+!B6 U+013C lcommaaccent
+!B7 U+02C7 caron
+!B8 U+00B8 cedilla
+!B9 U+0161 scaron
+!BA U+0113 emacron
+!BB U+0123 gcommaaccent
+!BC U+0167 tbar
+!BD U+014A Eng
+!BE U+017E zcaron
+!BF U+014B eng
+!C0 U+0100 Amacron
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+00C3 Atilde
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+00C6 AE
+!C7 U+012E Iogonek
+!C8 U+010C Ccaron
+!C9 U+00C9 Eacute
+!CA U+0118 Eogonek
+!CB U+00CB Edieresis
+!CC U+0116 Edotaccent
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+012A Imacron
+!D0 U+0110 Dcroat
+!D1 U+0145 Ncommaaccent
+!D2 U+014C Omacron
+!D3 U+0136 Kcommaaccent
+!D4 U+00D4 Ocircumflex
+!D5 U+00D5 Otilde
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+00D8 Oslash
+!D9 U+0172 Uogonek
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+0168 Utilde
+!DE U+016A Umacron
+!DF U+00DF germandbls
+!E0 U+0101 amacron
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+00E3 atilde
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+00E6 ae
+!E7 U+012F iogonek
+!E8 U+010D ccaron
+!E9 U+00E9 eacute
+!EA U+0119 eogonek
+!EB U+00EB edieresis
+!EC U+0117 edotaccent
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+012B imacron
+!F0 U+0111 dcroat
+!F1 U+0146 ncommaaccent
+!F2 U+014D omacron
+!F3 U+0137 kcommaaccent
+!F4 U+00F4 ocircumflex
+!F5 U+00F5 otilde
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+00F8 oslash
+!F9 U+0173 uogonek
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+0169 utilde
+!FE U+016B umacron
+!FF U+02D9 dotaccent

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-5.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-5.map
                              (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-5.map
      2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+0401 afii10023
+!A2 U+0402 afii10051
+!A3 U+0403 afii10052
+!A4 U+0404 afii10053
+!A5 U+0405 afii10054
+!A6 U+0406 afii10055
+!A7 U+0407 afii10056
+!A8 U+0408 afii10057
+!A9 U+0409 afii10058
+!AA U+040A afii10059
+!AB U+040B afii10060
+!AC U+040C afii10061
+!AD U+00AD hyphen
+!AE U+040E afii10062
+!AF U+040F afii10145
+!B0 U+0410 afii10017
+!B1 U+0411 afii10018
+!B2 U+0412 afii10019
+!B3 U+0413 afii10020
+!B4 U+0414 afii10021
+!B5 U+0415 afii10022
+!B6 U+0416 afii10024
+!B7 U+0417 afii10025
+!B8 U+0418 afii10026
+!B9 U+0419 afii10027
+!BA U+041A afii10028
+!BB U+041B afii10029
+!BC U+041C afii10030
+!BD U+041D afii10031
+!BE U+041E afii10032
+!BF U+041F afii10033
+!C0 U+0420 afii10034
+!C1 U+0421 afii10035
+!C2 U+0422 afii10036
+!C3 U+0423 afii10037
+!C4 U+0424 afii10038
+!C5 U+0425 afii10039
+!C6 U+0426 afii10040
+!C7 U+0427 afii10041
+!C8 U+0428 afii10042
+!C9 U+0429 afii10043
+!CA U+042A afii10044
+!CB U+042B afii10045
+!CC U+042C afii10046
+!CD U+042D afii10047
+!CE U+042E afii10048
+!CF U+042F afii10049
+!D0 U+0430 afii10065
+!D1 U+0431 afii10066
+!D2 U+0432 afii10067
+!D3 U+0433 afii10068
+!D4 U+0434 afii10069
+!D5 U+0435 afii10070
+!D6 U+0436 afii10072
+!D7 U+0437 afii10073
+!D8 U+0438 afii10074
+!D9 U+0439 afii10075
+!DA U+043A afii10076
+!DB U+043B afii10077
+!DC U+043C afii10078
+!DD U+043D afii10079
+!DE U+043E afii10080
+!DF U+043F afii10081
+!E0 U+0440 afii10082
+!E1 U+0441 afii10083
+!E2 U+0442 afii10084
+!E3 U+0443 afii10085
+!E4 U+0444 afii10086
+!E5 U+0445 afii10087
+!E6 U+0446 afii10088
+!E7 U+0447 afii10089
+!E8 U+0448 afii10090
+!E9 U+0449 afii10091
+!EA U+044A afii10092
+!EB U+044B afii10093
+!EC U+044C afii10094
+!ED U+044D afii10095
+!EE U+044E afii10096
+!EF U+044F afii10097
+!F0 U+2116 afii61352
+!F1 U+0451 afii10071
+!F2 U+0452 afii10099
+!F3 U+0453 afii10100
+!F4 U+0454 afii10101
+!F5 U+0455 afii10102
+!F6 U+0456 afii10103
+!F7 U+0457 afii10104
+!F8 U+0458 afii10105
+!F9 U+0459 afii10106
+!FA U+045A afii10107
+!FB U+045B afii10108
+!FC U+045C afii10109
+!FD U+00A7 section
+!FE U+045E afii10110
+!FF U+045F afii10193

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-7.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-7.map
                              (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-7.map
      2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,250 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+2018 quoteleft
+!A2 U+2019 quoteright
+!A3 U+00A3 sterling
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AF U+2015 afii00208
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+0384 tonos
+!B5 U+0385 dieresistonos
+!B6 U+0386 Alphatonos
+!B7 U+00B7 periodcentered
+!B8 U+0388 Epsilontonos
+!B9 U+0389 Etatonos
+!BA U+038A Iotatonos
+!BB U+00BB guillemotright
+!BC U+038C Omicrontonos
+!BD U+00BD onehalf
+!BE U+038E Upsilontonos
+!BF U+038F Omegatonos
+!C0 U+0390 iotadieresistonos
+!C1 U+0391 Alpha
+!C2 U+0392 Beta
+!C3 U+0393 Gamma
+!C4 U+0394 Delta
+!C5 U+0395 Epsilon
+!C6 U+0396 Zeta
+!C7 U+0397 Eta
+!C8 U+0398 Theta
+!C9 U+0399 Iota
+!CA U+039A Kappa
+!CB U+039B Lambda
+!CC U+039C Mu
+!CD U+039D Nu
+!CE U+039E Xi
+!CF U+039F Omicron
+!D0 U+03A0 Pi
+!D1 U+03A1 Rho
+!D3 U+03A3 Sigma
+!D4 U+03A4 Tau
+!D5 U+03A5 Upsilon
+!D6 U+03A6 Phi
+!D7 U+03A7 Chi
+!D8 U+03A8 Psi
+!D9 U+03A9 Omega
+!DA U+03AA Iotadieresis
+!DB U+03AB Upsilondieresis
+!DC U+03AC alphatonos
+!DD U+03AD epsilontonos
+!DE U+03AE etatonos
+!DF U+03AF iotatonos
+!E0 U+03B0 upsilondieresistonos
+!E1 U+03B1 alpha
+!E2 U+03B2 beta
+!E3 U+03B3 gamma
+!E4 U+03B4 delta
+!E5 U+03B5 epsilon
+!E6 U+03B6 zeta
+!E7 U+03B7 eta
+!E8 U+03B8 theta
+!E9 U+03B9 iota
+!EA U+03BA kappa
+!EB U+03BB lambda
+!EC U+03BC mu
+!ED U+03BD nu
+!EE U+03BE xi
+!EF U+03BF omicron
+!F0 U+03C0 pi
+!F1 U+03C1 rho
+!F2 U+03C2 sigma1
+!F3 U+03C3 sigma
+!F4 U+03C4 tau
+!F5 U+03C5 upsilon
+!F6 U+03C6 phi
+!F7 U+03C7 chi
+!F8 U+03C8 psi
+!F9 U+03C9 omega
+!FA U+03CA iotadieresis
+!FB U+03CB upsilondieresis
+!FC U+03CC omicrontonos
+!FD U+03CD upsilontonos
+!FE U+03CE omegatonos

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-9.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-9.map
                              (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/iso-8859-9.map
      2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+0080 .notdef
+!81 U+0081 .notdef
+!82 U+0082 .notdef
+!83 U+0083 .notdef
+!84 U+0084 .notdef
+!85 U+0085 .notdef
+!86 U+0086 .notdef
+!87 U+0087 .notdef
+!88 U+0088 .notdef
+!89 U+0089 .notdef
+!8A U+008A .notdef
+!8B U+008B .notdef
+!8C U+008C .notdef
+!8D U+008D .notdef
+!8E U+008E .notdef
+!8F U+008F .notdef
+!90 U+0090 .notdef
+!91 U+0091 .notdef
+!92 U+0092 .notdef
+!93 U+0093 .notdef
+!94 U+0094 .notdef
+!95 U+0095 .notdef
+!96 U+0096 .notdef
+!97 U+0097 .notdef
+!98 U+0098 .notdef
+!99 U+0099 .notdef
+!9A U+009A .notdef
+!9B U+009B .notdef
+!9C U+009C .notdef
+!9D U+009D .notdef
+!9E U+009E .notdef
+!9F U+009F .notdef
+!A0 U+00A0 space
+!A1 U+00A1 exclamdown
+!A2 U+00A2 cent
+!A3 U+00A3 sterling
+!A4 U+00A4 currency
+!A5 U+00A5 yen
+!A6 U+00A6 brokenbar
+!A7 U+00A7 section
+!A8 U+00A8 dieresis
+!A9 U+00A9 copyright
+!AA U+00AA ordfeminine
+!AB U+00AB guillemotleft
+!AC U+00AC logicalnot
+!AD U+00AD hyphen
+!AE U+00AE registered
+!AF U+00AF macron
+!B0 U+00B0 degree
+!B1 U+00B1 plusminus
+!B2 U+00B2 twosuperior
+!B3 U+00B3 threesuperior
+!B4 U+00B4 acute
+!B5 U+00B5 mu
+!B6 U+00B6 paragraph
+!B7 U+00B7 periodcentered
+!B8 U+00B8 cedilla
+!B9 U+00B9 onesuperior
+!BA U+00BA ordmasculine
+!BB U+00BB guillemotright
+!BC U+00BC onequarter
+!BD U+00BD onehalf
+!BE U+00BE threequarters
+!BF U+00BF questiondown
+!C0 U+00C0 Agrave
+!C1 U+00C1 Aacute
+!C2 U+00C2 Acircumflex
+!C3 U+00C3 Atilde
+!C4 U+00C4 Adieresis
+!C5 U+00C5 Aring
+!C6 U+00C6 AE
+!C7 U+00C7 Ccedilla
+!C8 U+00C8 Egrave
+!C9 U+00C9 Eacute
+!CA U+00CA Ecircumflex
+!CB U+00CB Edieresis
+!CC U+00CC Igrave
+!CD U+00CD Iacute
+!CE U+00CE Icircumflex
+!CF U+00CF Idieresis
+!D0 U+011E Gbreve
+!D1 U+00D1 Ntilde
+!D2 U+00D2 Ograve
+!D3 U+00D3 Oacute
+!D4 U+00D4 Ocircumflex
+!D5 U+00D5 Otilde
+!D6 U+00D6 Odieresis
+!D7 U+00D7 multiply
+!D8 U+00D8 Oslash
+!D9 U+00D9 Ugrave
+!DA U+00DA Uacute
+!DB U+00DB Ucircumflex
+!DC U+00DC Udieresis
+!DD U+0130 Idotaccent
+!DE U+015E Scedilla
+!DF U+00DF germandbls
+!E0 U+00E0 agrave
+!E1 U+00E1 aacute
+!E2 U+00E2 acircumflex
+!E3 U+00E3 atilde
+!E4 U+00E4 adieresis
+!E5 U+00E5 aring
+!E6 U+00E6 ae
+!E7 U+00E7 ccedilla
+!E8 U+00E8 egrave
+!E9 U+00E9 eacute
+!EA U+00EA ecircumflex
+!EB U+00EB edieresis
+!EC U+00EC igrave
+!ED U+00ED iacute
+!EE U+00EE icircumflex
+!EF U+00EF idieresis
+!F0 U+011F gbreve
+!F1 U+00F1 ntilde
+!F2 U+00F2 ograve
+!F3 U+00F3 oacute
+!F4 U+00F4 ocircumflex
+!F5 U+00F5 otilde
+!F6 U+00F6 odieresis
+!F7 U+00F7 divide
+!F8 U+00F8 oslash
+!F9 U+00F9 ugrave
+!FA U+00FA uacute
+!FB U+00FB ucircumflex
+!FC U+00FC udieresis
+!FD U+0131 dotlessi
+!FE U+015F scedilla
+!FF U+00FF ydieresis

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-r.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-r.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-r.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+2500 SF100000
+!81 U+2502 SF110000
+!82 U+250C SF010000
+!83 U+2510 SF030000
+!84 U+2514 SF020000
+!85 U+2518 SF040000
+!86 U+251C SF080000
+!87 U+2524 SF090000
+!88 U+252C SF060000
+!89 U+2534 SF070000
+!8A U+253C SF050000
+!8B U+2580 upblock
+!8C U+2584 dnblock
+!8D U+2588 block
+!8E U+258C lfblock
+!8F U+2590 rtblock
+!90 U+2591 ltshade
+!91 U+2592 shade
+!92 U+2593 dkshade
+!93 U+2320 integraltp
+!94 U+25A0 filledbox
+!95 U+2219 periodcentered
+!96 U+221A radical
+!97 U+2248 approxequal
+!98 U+2264 lessequal
+!99 U+2265 greaterequal
+!9A U+00A0 space
+!9B U+2321 integralbt
+!9C U+00B0 degree
+!9D U+00B2 twosuperior
+!9E U+00B7 periodcentered
+!9F U+00F7 divide
+!A0 U+2550 SF430000
+!A1 U+2551 SF240000
+!A2 U+2552 SF510000
+!A3 U+0451 afii10071
+!A4 U+2553 SF520000
+!A5 U+2554 SF390000
+!A6 U+2555 SF220000
+!A7 U+2556 SF210000
+!A8 U+2557 SF250000
+!A9 U+2558 SF500000
+!AA U+2559 SF490000
+!AB U+255A SF380000
+!AC U+255B SF280000
+!AD U+255C SF270000
+!AE U+255D SF260000
+!AF U+255E SF360000
+!B0 U+255F SF370000
+!B1 U+2560 SF420000
+!B2 U+2561 SF190000
+!B3 U+0401 afii10023
+!B4 U+2562 SF200000
+!B5 U+2563 SF230000
+!B6 U+2564 SF470000
+!B7 U+2565 SF480000
+!B8 U+2566 SF410000
+!B9 U+2567 SF450000
+!BA U+2568 SF460000
+!BB U+2569 SF400000
+!BC U+256A SF540000
+!BD U+256B SF530000
+!BE U+256C SF440000
+!BF U+00A9 copyright
+!C0 U+044E afii10096
+!C1 U+0430 afii10065
+!C2 U+0431 afii10066
+!C3 U+0446 afii10088
+!C4 U+0434 afii10069
+!C5 U+0435 afii10070
+!C6 U+0444 afii10086
+!C7 U+0433 afii10068
+!C8 U+0445 afii10087
+!C9 U+0438 afii10074
+!CA U+0439 afii10075
+!CB U+043A afii10076
+!CC U+043B afii10077
+!CD U+043C afii10078
+!CE U+043D afii10079
+!CF U+043E afii10080
+!D0 U+043F afii10081
+!D1 U+044F afii10097
+!D2 U+0440 afii10082
+!D3 U+0441 afii10083
+!D4 U+0442 afii10084
+!D5 U+0443 afii10085
+!D6 U+0436 afii10072
+!D7 U+0432 afii10067
+!D8 U+044C afii10094
+!D9 U+044B afii10093
+!DA U+0437 afii10073
+!DB U+0448 afii10090
+!DC U+044D afii10095
+!DD U+0449 afii10091
+!DE U+0447 afii10089
+!DF U+044A afii10092
+!E0 U+042E afii10048
+!E1 U+0410 afii10017
+!E2 U+0411 afii10018
+!E3 U+0426 afii10040
+!E4 U+0414 afii10021
+!E5 U+0415 afii10022
+!E6 U+0424 afii10038
+!E7 U+0413 afii10020
+!E8 U+0425 afii10039
+!E9 U+0418 afii10026
+!EA U+0419 afii10027
+!EB U+041A afii10028
+!EC U+041B afii10029
+!ED U+041C afii10030
+!EE U+041D afii10031
+!EF U+041E afii10032
+!F0 U+041F afii10033
+!F1 U+042F afii10049
+!F2 U+0420 afii10034
+!F3 U+0421 afii10035
+!F4 U+0422 afii10036
+!F5 U+0423 afii10037
+!F6 U+0416 afii10024
+!F7 U+0412 afii10019
+!F8 U+042C afii10046
+!F9 U+042B afii10045
+!FA U+0417 afii10025
+!FB U+0428 afii10042
+!FC U+042D afii10047
+!FD U+0429 afii10043
+!FE U+0427 afii10041
+!FF U+042A afii10044

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-u.map
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-u.map
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/koi8-u.map
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,256 @@
+!00 U+0000 .notdef
+!01 U+0001 .notdef
+!02 U+0002 .notdef
+!03 U+0003 .notdef
+!04 U+0004 .notdef
+!05 U+0005 .notdef
+!06 U+0006 .notdef
+!07 U+0007 .notdef
+!08 U+0008 .notdef
+!09 U+0009 .notdef
+!0A U+000A .notdef
+!0B U+000B .notdef
+!0C U+000C .notdef
+!0D U+000D .notdef
+!0E U+000E .notdef
+!0F U+000F .notdef
+!10 U+0010 .notdef
+!11 U+0011 .notdef
+!12 U+0012 .notdef
+!13 U+0013 .notdef
+!14 U+0014 .notdef
+!15 U+0015 .notdef
+!16 U+0016 .notdef
+!17 U+0017 .notdef
+!18 U+0018 .notdef
+!19 U+0019 .notdef
+!1A U+001A .notdef
+!1B U+001B .notdef
+!1C U+001C .notdef
+!1D U+001D .notdef
+!1E U+001E .notdef
+!1F U+001F .notdef
+!20 U+0020 space
+!21 U+0021 exclam
+!22 U+0022 quotedbl
+!23 U+0023 numbersign
+!24 U+0024 dollar
+!25 U+0025 percent
+!26 U+0026 ampersand
+!27 U+0027 quotesingle
+!28 U+0028 parenleft
+!29 U+0029 parenright
+!2A U+002A asterisk
+!2B U+002B plus
+!2C U+002C comma
+!2D U+002D hyphen
+!2E U+002E period
+!2F U+002F slash
+!30 U+0030 zero
+!31 U+0031 one
+!32 U+0032 two
+!33 U+0033 three
+!34 U+0034 four
+!35 U+0035 five
+!36 U+0036 six
+!37 U+0037 seven
+!38 U+0038 eight
+!39 U+0039 nine
+!3A U+003A colon
+!3B U+003B semicolon
+!3C U+003C less
+!3D U+003D equal
+!3E U+003E greater
+!3F U+003F question
+!40 U+0040 at
+!41 U+0041 A
+!42 U+0042 B
+!43 U+0043 C
+!44 U+0044 D
+!45 U+0045 E
+!46 U+0046 F
+!47 U+0047 G
+!48 U+0048 H
+!49 U+0049 I
+!4A U+004A J
+!4B U+004B K
+!4C U+004C L
+!4D U+004D M
+!4E U+004E N
+!4F U+004F O
+!50 U+0050 P
+!51 U+0051 Q
+!52 U+0052 R
+!53 U+0053 S
+!54 U+0054 T
+!55 U+0055 U
+!56 U+0056 V
+!57 U+0057 W
+!58 U+0058 X
+!59 U+0059 Y
+!5A U+005A Z
+!5B U+005B bracketleft
+!5C U+005C backslash
+!5D U+005D bracketright
+!5E U+005E asciicircum
+!5F U+005F underscore
+!60 U+0060 grave
+!61 U+0061 a
+!62 U+0062 b
+!63 U+0063 c
+!64 U+0064 d
+!65 U+0065 e
+!66 U+0066 f
+!67 U+0067 g
+!68 U+0068 h
+!69 U+0069 i
+!6A U+006A j
+!6B U+006B k
+!6C U+006C l
+!6D U+006D m
+!6E U+006E n
+!6F U+006F o
+!70 U+0070 p
+!71 U+0071 q
+!72 U+0072 r
+!73 U+0073 s
+!74 U+0074 t
+!75 U+0075 u
+!76 U+0076 v
+!77 U+0077 w
+!78 U+0078 x
+!79 U+0079 y
+!7A U+007A z
+!7B U+007B braceleft
+!7C U+007C bar
+!7D U+007D braceright
+!7E U+007E asciitilde
+!7F U+007F .notdef
+!80 U+2500 SF100000
+!81 U+2502 SF110000
+!82 U+250C SF010000
+!83 U+2510 SF030000
+!84 U+2514 SF020000
+!85 U+2518 SF040000
+!86 U+251C SF080000
+!87 U+2524 SF090000
+!88 U+252C SF060000
+!89 U+2534 SF070000
+!8A U+253C SF050000
+!8B U+2580 upblock
+!8C U+2584 dnblock
+!8D U+2588 block
+!8E U+258C lfblock
+!8F U+2590 rtblock
+!90 U+2591 ltshade
+!91 U+2592 shade
+!92 U+2593 dkshade
+!93 U+2320 integraltp
+!94 U+25A0 filledbox
+!95 U+2022 bullet
+!96 U+221A radical
+!97 U+2248 approxequal
+!98 U+2264 lessequal
+!99 U+2265 greaterequal
+!9A U+00A0 space
+!9B U+2321 integralbt
+!9C U+00B0 degree
+!9D U+00B2 twosuperior
+!9E U+00B7 periodcentered
+!9F U+00F7 divide
+!A0 U+2550 SF430000
+!A1 U+2551 SF240000
+!A2 U+2552 SF510000
+!A3 U+0451 afii10071
+!A4 U+0454 afii10101
+!A5 U+2554 SF390000
+!A6 U+0456 afii10103
+!A7 U+0457 afii10104
+!A8 U+2557 SF250000
+!A9 U+2558 SF500000
+!AA U+2559 SF490000
+!AB U+255A SF380000
+!AC U+255B SF280000
+!AD U+0491 afii10098
+!AE U+255D SF260000
+!AF U+255E SF360000
+!B0 U+255F SF370000
+!B1 U+2560 SF420000
+!B2 U+2561 SF190000
+!B3 U+0401 afii10023
+!B4 U+0404 afii10053
+!B5 U+2563 SF230000
+!B6 U+0406 afii10055
+!B7 U+0407 afii10056
+!B8 U+2566 SF410000
+!B9 U+2567 SF450000
+!BA U+2568 SF460000
+!BB U+2569 SF400000
+!BC U+256A SF540000
+!BD U+0490 afii10050
+!BE U+256C SF440000
+!BF U+00A9 copyright
+!C0 U+044E afii10096
+!C1 U+0430 afii10065
+!C2 U+0431 afii10066
+!C3 U+0446 afii10088
+!C4 U+0434 afii10069
+!C5 U+0435 afii10070
+!C6 U+0444 afii10086
+!C7 U+0433 afii10068
+!C8 U+0445 afii10087
+!C9 U+0438 afii10074
+!CA U+0439 afii10075
+!CB U+043A afii10076
+!CC U+043B afii10077
+!CD U+043C afii10078
+!CE U+043D afii10079
+!CF U+043E afii10080
+!D0 U+043F afii10081
+!D1 U+044F afii10097
+!D2 U+0440 afii10082
+!D3 U+0441 afii10083
+!D4 U+0442 afii10084
+!D5 U+0443 afii10085
+!D6 U+0436 afii10072
+!D7 U+0432 afii10067
+!D8 U+044C afii10094
+!D9 U+044B afii10093
+!DA U+0437 afii10073
+!DB U+0448 afii10090
+!DC U+044D afii10095
+!DD U+0449 afii10091
+!DE U+0447 afii10089
+!DF U+044A afii10092
+!E0 U+042E afii10048
+!E1 U+0410 afii10017
+!E2 U+0411 afii10018
+!E3 U+0426 afii10040
+!E4 U+0414 afii10021
+!E5 U+0415 afii10022
+!E6 U+0424 afii10038
+!E7 U+0413 afii10020
+!E8 U+0425 afii10039
+!E9 U+0418 afii10026
+!EA U+0419 afii10027
+!EB U+041A afii10028
+!EC U+041B afii10029
+!ED U+041C afii10030
+!EE U+041D afii10031
+!EF U+041E afii10032
+!F0 U+041F afii10033
+!F1 U+042F afii10049
+!F2 U+0420 afii10034
+!F3 U+0421 afii10035
+!F4 U+0422 afii10036
+!F5 U+0423 afii10037
+!F6 U+0416 afii10024
+!F7 U+0412 afii10019
+!F8 U+042C afii10046
+!F9 U+042B afii10045
+!FA U+0417 afii10025
+!FB U+0428 afii10042
+!FC U+042D afii10047
+!FD U+0429 afii10043
+!FE U+0427 afii10041
+!FF U+042A afii10044

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/makefont.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/makefont.php
                                (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/makefont.php
        2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,419 @@
+<?php
+/*******************************************************************************
+* Utility to generate font definition files
+*
+* Version:     1.14
+* Date:                2008-08-03
+* Author:      Olivier PLATHEY
+*******************************************************************************/
+
+function ReadMap($enc)
+{
+       //Read a map file
+       $file=dirname(__FILE__).'/'.strtolower($enc).'.map';
+       $a=file($file);
+       if(empty($a))
+               die('<b>Error:</b> encoding not found: '.$enc);
+       $cc2gn=array();
+       foreach($a as $l)
+       {
+               if($l[0]=='!')
+               {
+                       $e=preg_split('/[ \\t]+/',rtrim($l));
+                       $cc=hexdec(substr($e[0],1));
+                       $gn=$e[2];
+                       $cc2gn[$cc]=$gn;
+               }
+       }
+       for($i=0;$i<=255;$i++)
+       {
+               if(!isset($cc2gn[$i]))
+                       $cc2gn[$i]='.notdef';
+       }
+       return $cc2gn;
+}
+
+function ReadAFM($file, &$map)
+{
+       //Read a font metric file
+       $a=file($file);
+       if(empty($a))
+               die('File not found');
+       $widths=array();
+       $fm=array();
+       
$fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>'Zdotaccent','zdot'=>'zdotaccent',
+               
'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=>'Uhungarumlaut','udblacute'=>'uhungarumlaut',
+               
'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcommaaccent','kcedilla'=>'kcommaaccent',
+               
'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncommaaccent','ncedilla'=>'ncommaaccent',
+               
'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scommaaccent','scedilla'=>'scommaaccent',
+               
'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat',
+               
'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecomb','combiningtildeaccent'=>'tildecomb',
+               
'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb','dongsign'=>'dong');
+       foreach($a as $l)
+       {
+               $e=explode(' ',rtrim($l));
+               if(count($e)<2)
+                       continue;
+               $code=$e[0];
+               $param=$e[1];
+               if($code=='C')
+               {
+                       //Character metrics
+                       $cc=(int)$e[1];
+                       $w=$e[4];
+                       $gn=$e[7];
+                       if(substr($gn,-4)=='20AC')
+                               $gn='Euro';
+                       if(isset($fix[$gn]))
+                       {
+                               //Fix incorrect glyph name
+                               foreach($map as $c=>$n)
+                               {
+                                       if($n==$fix[$gn])
+                                               $map[$c]=$gn;
+                               }
+                       }
+                       if(empty($map))
+                       {
+                               //Symbolic font: use built-in encoding
+                               $widths[$cc]=$w;
+                       }
+                       else
+                       {
+                               $widths[$gn]=$w;
+                               if($gn=='X')
+                                       $fm['CapXHeight']=$e[13];
+                       }
+                       if($gn=='.notdef')
+                               $fm['MissingWidth']=$w;
+               }
+               elseif($code=='FontName')
+                       $fm['FontName']=$param;
+               elseif($code=='Weight')
+                       $fm['Weight']=$param;
+               elseif($code=='ItalicAngle')
+                       $fm['ItalicAngle']=(double)$param;
+               elseif($code=='Ascender')
+                       $fm['Ascender']=(int)$param;
+               elseif($code=='Descender')
+                       $fm['Descender']=(int)$param;
+               elseif($code=='UnderlineThickness')
+                       $fm['UnderlineThickness']=(int)$param;
+               elseif($code=='UnderlinePosition')
+                       $fm['UnderlinePosition']=(int)$param;
+               elseif($code=='IsFixedPitch')
+                       $fm['IsFixedPitch']=($param=='true');
+               elseif($code=='FontBBox')
+                       $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]);
+               elseif($code=='CapHeight')
+                       $fm['CapHeight']=(int)$param;
+               elseif($code=='StdVW')
+                       $fm['StdVW']=(int)$param;
+       }
+       if(!isset($fm['FontName']))
+               die('FontName not found');
+       if(!empty($map))
+       {
+               if(!isset($widths['.notdef']))
+                       $widths['.notdef']=600;
+               if(!isset($widths['Delta']) && isset($widths['increment']))
+                       $widths['Delta']=$widths['increment'];
+               //Order widths according to map
+               for($i=0;$i<=255;$i++)
+               {
+                       if(!isset($widths[$map[$i]]))
+                       {
+                               echo '<b>Warning:</b> character '.$map[$i].' is 
missing<br>';
+                               $widths[$i]=$widths['.notdef'];
+                       }
+                       else
+                               $widths[$i]=$widths[$map[$i]];
+               }
+       }
+       $fm['Widths']=$widths;
+       return $fm;
+}
+
+function MakeFontDescriptor($fm, $symbolic)
+{
+       //Ascent
+       $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
+       $fd="array('Ascent'=>".$asc;
+       //Descent
+       $desc=(isset($fm['Descender']) ? $fm['Descender'] : -200);
+       $fd.=",'Descent'=>".$desc;
+       //CapHeight
+       if(isset($fm['CapHeight']))
+               $ch=$fm['CapHeight'];
+       elseif(isset($fm['CapXHeight']))
+               $ch=$fm['CapXHeight'];
+       else
+               $ch=$asc;
+       $fd.=",'CapHeight'=>".$ch;
+       //Flags
+       $flags=0;
+       if(isset($fm['IsFixedPitch']) && $fm['IsFixedPitch'])
+               $flags+=1<<0;
+       if($symbolic)
+               $flags+=1<<2;
+       if(!$symbolic)
+               $flags+=1<<5;
+       if(isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0)
+               $flags+=1<<6;
+       $fd.=",'Flags'=>".$flags;
+       //FontBBox
+       if(isset($fm['FontBBox']))
+               $fbb=$fm['FontBBox'];
+       else
+               $fbb=array(0,$desc-100,1000,$asc+100);
+       $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
+       //ItalicAngle
+       $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
+       $fd.=",'ItalicAngle'=>".$ia;
+       //StemV
+       if(isset($fm['StdVW']))
+               $stemv=$fm['StdVW'];
+       elseif(isset($fm['Weight']) && 
preg_match('/bold|black/i',$fm['Weight']))
+               $stemv=120;
+       else
+               $stemv=70;
+       $fd.=",'StemV'=>".$stemv;
+       //MissingWidth
+       if(isset($fm['MissingWidth']))
+               $fd.=",'MissingWidth'=>".$fm['MissingWidth'];
+       $fd.=')';
+       return $fd;
+}
+
+function MakeWidthArray($fm)
+{
+       //Make character width array
+       $s="array(\n\t";
+       $cw=$fm['Widths'];
+       for($i=0;$i<=255;$i++)
+       {
+               if(chr($i)=="'")
+                       $s.="'\\''";
+               elseif(chr($i)=="\\")
+                       $s.="'\\\\'";
+               elseif($i>=32 && $i<=126)
+                       $s.="'".chr($i)."'";
+               else
+                       $s.="chr($i)";
+               $s.='=>'.$fm['Widths'][$i];
+               if($i<255)
+                       $s.=',';
+               if(($i+1)%22==0)
+                       $s.="\n\t";
+       }
+       $s.=')';
+       return $s;
+}
+
+function MakeFontEncoding($map)
+{
+       //Build differences from reference encoding
+       $ref=ReadMap('cp1252');
+       $s='';
+       $last=0;
+       for($i=32;$i<=255;$i++)
+       {
+               if($map[$i]!=$ref[$i])
+               {
+                       if($i!=$last+1)
+                               $s.=$i.' ';
+                       $last=$i;
+                       $s.='/'.$map[$i].' ';
+               }
+       }
+       return rtrim($s);
+}
+
+function SaveToFile($file, $s, $mode)
+{
+       $f=fopen($file,'w'.$mode);
+       if(!$f)
+               die('Can\'t write to file '.$file);
+       fwrite($f,$s,strlen($s));
+       fclose($f);
+}
+
+function ReadShort($f)
+{
+       $a=unpack('n1n',fread($f,2));
+       return $a['n'];
+}
+
+function ReadLong($f)
+{
+       $a=unpack('N1N',fread($f,4));
+       return $a['N'];
+}
+
+function CheckTTF($file)
+{
+       //Check if font license allows embedding
+       $f=fopen($file,'rb');
+       if(!$f)
+               die('<b>Error:</b> Can\'t open '.$file);
+       //Extract number of tables
+       fseek($f,4,SEEK_CUR);
+       $nb=ReadShort($f);
+       fseek($f,6,SEEK_CUR);
+       //Seek OS/2 table
+       $found=false;
+       for($i=0;$i<$nb;$i++)
+       {
+               if(fread($f,4)=='OS/2')
+               {
+                       $found=true;
+                       break;
+               }
+               fseek($f,12,SEEK_CUR);
+       }
+       if(!$found)
+       {
+               fclose($f);
+               return;
+       }
+       fseek($f,4,SEEK_CUR);
+       $offset=ReadLong($f);
+       fseek($f,$offset,SEEK_SET);
+       //Extract fsType flags
+       fseek($f,8,SEEK_CUR);
+       $fsType=ReadShort($f);
+       $rl=($fsType & 0x02)!=0;
+       $pp=($fsType & 0x04)!=0;
+       $e=($fsType & 0x08)!=0;
+       fclose($f);
+       if($rl && !$pp && !$e)
+               echo '<b>Warning:</b> font license does not allow embedding';
+}
+
+/*******************************************************************************
+* fontfile: path to TTF file (or empty string if not to be embedded0)
+* afmfile:     path to AFM file
+* enc:         font encoding (or empty string for symbolic fonts)
+* patch:       optional patch for encoding
+* type:                font type if fontfile is empty
+*******************************************************************************/
+function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), 
$type='TrueType')
+{
+       //Generate a font definition file
+       if(get_magic_quotes_runtime())
+               @set_magic_quotes_runtime(0);
+       ini_set('auto_detect_line_endings','1');
+       if($enc)
+       {
+               $map=ReadMap($enc);
+               foreach($patch as $cc=>$gn)
+                       $map[$cc]=$gn;
+       }
+       else
+               $map=array();
+       if(!file_exists($afmfile))
+               die('<b>Error:</b> AFM file not found: '.$afmfile);
+       $fm=ReadAFM($afmfile,$map);
+       if($enc)
+               $diff=MakeFontEncoding($map);
+       else
+               $diff='';
+       $fd=MakeFontDescriptor($fm,empty($map));
+       //Find font type
+       if($fontfile)
+       {
+               $ext=strtolower(substr($fontfile,-3));
+               if($ext=='ttf')
+                       $type='TrueType';
+               elseif($ext=='pfb')
+                       $type='Type1';
+               else
+                       die('<b>Error:</b> unrecognized font file extension: 
'.$ext);
+       }
+       else
+       {
+               if($type!='TrueType' && $type!='Type1')
+                       die('<b>Error:</b> incorrect font type: '.$type);
+       }
+       //Start generation
+       $s='<?php'."\n";
+       $s.='$type=\''.$type."';\n";
+       $s.='$name=\''.$fm['FontName']."';\n";
+       $s.='$desc='.$fd.";\n";
+       if(!isset($fm['UnderlinePosition']))
+               $fm['UnderlinePosition']=-100;
+       if(!isset($fm['UnderlineThickness']))
+               $fm['UnderlineThickness']=50;
+       $s.='$up='.$fm['UnderlinePosition'].";\n";
+       $s.='$ut='.$fm['UnderlineThickness'].";\n";
+       $w=MakeWidthArray($fm);
+       $s.='$cw='.$w.";\n";
+       $s.='$enc=\''.$enc."';\n";
+       $s.='$diff=\''.$diff."';\n";
+       $basename=substr(basename($afmfile),0,-4);
+       if($fontfile)
+       {
+               //Embedded font
+               if(!file_exists($fontfile))
+                       die('<b>Error:</b> font file not found: '.$fontfile);
+               if($type=='TrueType')
+                       CheckTTF($fontfile);
+               $f=fopen($fontfile,'rb');
+               if(!$f)
+                       die('<b>Error:</b> Can\'t open '.$fontfile);
+               $file=fread($f,filesize($fontfile));
+               fclose($f);
+               if($type=='Type1')
+               {
+                       //Find first two sections and discard third one
+                       $header=(ord($file[0])==128);
+                       if($header)
+                       {
+                               //Strip first binary header
+                               $file=substr($file,6);
+                       }
+                       $pos=strpos($file,'eexec');
+                       if(!$pos)
+                               die('<b>Error:</b> font file does not seem to 
be valid Type1');
+                       $size1=$pos+6;
+                       if($header && ord($file[$size1])==128)
+                       {
+                               //Strip second binary header
+                               
$file=substr($file,0,$size1).substr($file,$size1+6);
+                       }
+                       $pos=strpos($file,'00000000');
+                       if(!$pos)
+                               die('<b>Error:</b> font file does not seem to 
be valid Type1');
+                       $size2=$pos-$size1;
+                       $file=substr($file,0,$size1+$size2);
+               }
+               if(function_exists('gzcompress'))
+               {
+                       $cmp=$basename.'.z';
+                       SaveToFile($cmp,gzcompress($file),'b');
+                       $s.='$file=\''.$cmp."';\n";
+                       echo 'Font file compressed ('.$cmp.')<br>';
+               }
+               else
+               {
+                       $s.='$file=\''.basename($fontfile)."';\n";
+                       echo '<b>Notice:</b> font file could not be compressed 
(zlib extension not available)<br>';
+               }
+               if($type=='Type1')
+               {
+                       $s.='$size1='.$size1.";\n";
+                       $s.='$size2='.$size2.";\n";
+               }
+               else
+                       $s.='$originalsize='.filesize($fontfile).";\n";
+       }
+       else
+       {
+               //Not embedded font
+               $s.='$file='."'';\n";
+       }
+       $s.="?>\n";
+       SaveToFile($basename.'.php',$s,'t');
+       echo 'Font definition file generated ('.$basename.'.php'.')<br>';
+}
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/makefont/makefont.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/symbol.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/symbol.php   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/symbol.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['symbol']=array(
+       
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+       
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,'
 
'=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549,
+       
','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722,
+       
'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768,
+       
'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576,
+       
'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0,
+       
chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
+       
chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603,
+       
chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768,
+       
chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,
+       
chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,
+       
chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/symbol.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/times.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/times.php    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/times.php    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['times']=array(
+       
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+       
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,'
 
'=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
+       
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722,
+       
'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944,
+       
'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
+       
'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+       
chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980,
+       
chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+       
chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
+       
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/times.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesb.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesb.php   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesb.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['timesB']=array(
+       
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+       
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,'
 
'=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
+       
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722,
+       
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000,
+       
'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833,
+       
'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+       
chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       
chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+       
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
+       
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesb.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesbi.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesbi.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesbi.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['timesBI']=array(
+       
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+       
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,'
 
'=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
+       
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667,
+       
'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889,
+       
'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
+       
'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+       
chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       
chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+       
chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
+       
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesbi.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesi.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesi.php   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesi.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['timesI']=array(
+       
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
+       
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,'
 
'=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
+       
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611,
+       
'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833,
+       
'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722,
+       
'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
+       
chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980,
+       
chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333,
+       
chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611,
+       
chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       
chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
+       
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/timesi.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/zapfdingbats.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/zapfdingbats.php 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/zapfdingbats.php 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['zapfdingbats']=array(
+       
chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,
+       
chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,'
 
'=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
+       
','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692,
+       
'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776,
+       
'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873,
+       
'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
+       
chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
+       
chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788,
+       
chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788,
+       
chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
+       
chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
+       
chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/font/zapfdingbats.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.css
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.css          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.css  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,21 @@
+body {font-family:"Times New Roman",serif}
+h1 {font:bold 135% Arial,sans-serif; color:#4000A0; margin-bottom:0.9em}
+h2 {font:bold 100% Arial,sans-serif; color:#900000; margin-top:1.5em}
+dl.param dt {text-decoration:underline}
+dl.param dd {margin-top:1em; margin-bottom:1em}
+dl.param ul {margin-top:1em; margin-bottom:1em}
+tt, code, kbd {font-family:"Courier New",Courier,monospace; font-size:82%}
+div.source {margin-top:1.4em; margin-bottom:1.3em}
+div.source pre {display:table; border:1px solid #24246A; width:100%; 
margin:0em; font-family:inherit; font-size:100%}
+div.source code {display:block; border:1px solid #C5C5EC; 
background-color:#F0F5FF; padding:6px; color:#000000}
+div.doc-source {margin-top:1.4em; margin-bottom:1.3em}
+div.doc-source pre {display:table; width:100%; margin:0em; 
font-family:inherit; font-size:100%}
+div.doc-source code {display:block; background-color:#E0E0E0; padding:4px}
+.kw {color:#000080; font-weight:bold}
+.str {color:#CC0000}
+.cmt {color:#008000}
+p.demo {text-align:center; margin-top:-0.9em}
+a.demo {text-decoration:none; font-weight:bold; color:#0000CC}
+a.demo:link {text-decoration:none; font-weight:bold; color:#0000CC}
+a.demo:hover {text-decoration:none; font-weight:bold; color:#0000FF}
+a.demo:active {text-decoration:none; font-weight:bold; color:#0000FF}

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.php          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,1734 @@
+<?php
+/*******************************************************************************
+* FPDF                                                                         
*
+*                                                                              
*
+* Version: 1.6                                                                 
*
+* Date:    2008-08-03                                                          
*
+* Author:  Olivier PLATHEY                                                     
*
+*******************************************************************************/
+
+define('FPDF_VERSION','1.6');
+
+class FPDF
+{
+var $page;               //current page number
+var $n;                  //current object number
+var $offsets;            //array of object offsets
+var $buffer;             //buffer holding in-memory PDF
+var $pages;              //array containing pages
+var $state;              //current document state
+var $compress;           //compression flag
+var $k;                  //scale factor (number of points in user unit)
+var $DefOrientation;     //default orientation
+var $CurOrientation;     //current orientation
+var $PageFormats;        //available page formats
+var $DefPageFormat;      //default page format
+var $CurPageFormat;      //current page format
+var $PageSizes;          //array storing non-default page sizes
+var $wPt,$hPt;           //dimensions of current page in points
+var $w,$h;               //dimensions of current page in user unit
+var $lMargin;            //left margin
+var $tMargin;            //top margin
+var $rMargin;            //right margin
+var $bMargin;            //page break margin
+var $cMargin;            //cell margin
+var $x,$y;               //current position in user unit
+var $lasth;              //height of last printed cell
+var $LineWidth;          //line width in user unit
+var $CoreFonts;          //array of standard font names
+var $fonts;              //array of used fonts
+var $FontFiles;          //array of font files
+var $diffs;              //array of encoding differences
+var $FontFamily;         //current font family
+var $FontStyle;          //current font style
+var $underline;          //underlining flag
+var $CurrentFont;        //current font info
+var $FontSizePt;         //current font size in points
+var $FontSize;           //current font size in user unit
+var $DrawColor;          //commands for drawing color
+var $FillColor;          //commands for filling color
+var $TextColor;          //commands for text color
+var $ColorFlag;          //indicates whether fill and text colors are different
+var $ws;                 //word spacing
+var $images;             //array of used images
+var $PageLinks;          //array of links in pages
+var $links;              //array of internal links
+var $AutoPageBreak;      //automatic page breaking
+var $PageBreakTrigger;   //threshold used to trigger page breaks
+var $InHeader;           //flag set when processing header
+var $InFooter;           //flag set when processing footer
+var $ZoomMode;           //zoom display mode
+var $LayoutMode;         //layout display mode
+var $title;              //title
+var $subject;            //subject
+var $author;             //author
+var $keywords;           //keywords
+var $creator;            //creator
+var $AliasNbPages;       //alias for total number of pages
+var $PDFVersion;         //PDF version number
+
+/*******************************************************************************
+*                                                                              
*
+*                               Public methods                                 
*
+*                                                                              
*
+*******************************************************************************/
+function FPDF($orientation='P', $unit='mm', $format='A4')
+{
+       //Some checks
+       $this->_dochecks();
+       //Initialization of properties
+       $this->page=0;
+       $this->n=2;
+       $this->buffer='';
+       $this->pages=array();
+       $this->PageSizes=array();
+       $this->state=0;
+       $this->fonts=array();
+       $this->FontFiles=array();
+       $this->diffs=array();
+       $this->images=array();
+       $this->links=array();
+       $this->InHeader=false;
+       $this->InFooter=false;
+       $this->lasth=0;
+       $this->FontFamily='';
+       $this->FontStyle='';
+       $this->FontSizePt=12;
+       $this->underline=false;
+       $this->DrawColor='0 G';
+       $this->FillColor='0 g';
+       $this->TextColor='0 g';
+       $this->ColorFlag=false;
+       $this->ws=0;
+       //Standard fonts
+       $this->CoreFonts=array('courier'=>'Courier', 
'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 
'courierBI'=>'Courier-BoldOblique',
+               'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 
'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique',
+               'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 
'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic',
+               'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats');
+       //Scale factor
+       if($unit=='pt')
+               $this->k=1;
+       elseif($unit=='mm')
+               $this->k=72/25.4;
+       elseif($unit=='cm')
+               $this->k=72/2.54;
+       elseif($unit=='in')
+               $this->k=72;
+       else
+               $this->Error('Incorrect unit: '.$unit);
+       //Page format
+       $this->PageFormats=array('a3'=>array(841.89,1190.55), 
'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
+               'letter'=>array(612,792), 'legal'=>array(612,1008));
+       if(is_string($format))
+               $format=$this->_getpageformat($format);
+       $this->DefPageFormat=$format;
+       $this->CurPageFormat=$format;
+       //Page orientation
+       $orientation=strtolower($orientation);
+       if($orientation=='p' || $orientation=='portrait')
+       {
+               $this->DefOrientation='P';
+               $this->w=$this->DefPageFormat[0];
+               $this->h=$this->DefPageFormat[1];
+       }
+       elseif($orientation=='l' || $orientation=='landscape')
+       {
+               $this->DefOrientation='L';
+               $this->w=$this->DefPageFormat[1];
+               $this->h=$this->DefPageFormat[0];
+       }
+       else
+               $this->Error('Incorrect orientation: '.$orientation);
+       $this->CurOrientation=$this->DefOrientation;
+       $this->wPt=$this->w*$this->k;
+       $this->hPt=$this->h*$this->k;
+       //Page margins (1 cm)
+       $margin=28.35/$this->k;
+       $this->SetMargins($margin,$margin);
+       //Interior cell margin (1 mm)
+       $this->cMargin=$margin/10;
+       //Line width (0.2 mm)
+       $this->LineWidth=.567/$this->k;
+       //Automatic page break
+       $this->SetAutoPageBreak(true,2*$margin);
+       //Full width display mode
+       $this->SetDisplayMode('fullwidth');
+       //Enable compression
+       $this->SetCompression(true);
+       //Set default PDF version number
+       $this->PDFVersion='1.3';
+}
+
+function SetMargins($left, $top, $right=null)
+{
+       //Set left, top and right margins
+       $this->lMargin=$left;
+       $this->tMargin=$top;
+       if($right===null)
+               $right=$left;
+       $this->rMargin=$right;
+}
+
+function SetLeftMargin($margin)
+{
+       //Set left margin
+       $this->lMargin=$margin;
+       if($this->page>0 && $this->x<$margin)
+               $this->x=$margin;
+}
+
+function SetTopMargin($margin)
+{
+       //Set top margin
+       $this->tMargin=$margin;
+}
+
+function SetRightMargin($margin)
+{
+       //Set right margin
+       $this->rMargin=$margin;
+}
+
+function SetAutoPageBreak($auto, $margin=0)
+{
+       //Set auto page break mode and triggering margin
+       $this->AutoPageBreak=$auto;
+       $this->bMargin=$margin;
+       $this->PageBreakTrigger=$this->h-$margin;
+}
+
+function SetDisplayMode($zoom, $layout='continuous')
+{
+       //Set display mode in viewer
+       if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || 
$zoom=='default' || !is_string($zoom))
+               $this->ZoomMode=$zoom;
+       else
+               $this->Error('Incorrect zoom display mode: '.$zoom);
+       if($layout=='single' || $layout=='continuous' || $layout=='two' || 
$layout=='default')
+               $this->LayoutMode=$layout;
+       else
+               $this->Error('Incorrect layout display mode: '.$layout);
+}
+
+function SetCompression($compress)
+{
+       //Set page compression
+       if(function_exists('gzcompress'))
+               $this->compress=$compress;
+       else
+               $this->compress=false;
+}
+
+function SetTitle($title, $isUTF8=false)
+{
+       //Title of document
+       if($isUTF8)
+               $title=$this->_UTF8toUTF16($title);
+       $this->title=$title;
+}
+
+function SetSubject($subject, $isUTF8=false)
+{
+       //Subject of document
+       if($isUTF8)
+               $subject=$this->_UTF8toUTF16($subject);
+       $this->subject=$subject;
+}
+
+function SetAuthor($author, $isUTF8=false)
+{
+       //Author of document
+       if($isUTF8)
+               $author=$this->_UTF8toUTF16($author);
+       $this->author=$author;
+}
+
+function SetKeywords($keywords, $isUTF8=false)
+{
+       //Keywords of document
+       if($isUTF8)
+               $keywords=$this->_UTF8toUTF16($keywords);
+       $this->keywords=$keywords;
+}
+
+function SetCreator($creator, $isUTF8=false)
+{
+       //Creator of document
+       if($isUTF8)
+               $creator=$this->_UTF8toUTF16($creator);
+       $this->creator=$creator;
+}
+
+function AliasNbPages($alias='{nb}')
+{
+       //Define an alias for total number of pages
+       $this->AliasNbPages=$alias;
+}
+
+function Error($msg)
+{
+       //Fatal error
+       die('<b>FPDF error:</b> '.$msg);
+}
+
+function Open()
+{
+       //Begin document
+       $this->state=1;
+}
+
+function Close()
+{
+       //Terminate document
+       if($this->state==3)
+               return;
+       if($this->page==0)
+               $this->AddPage();
+       //Page footer
+       $this->InFooter=true;
+       $this->Footer();
+       $this->InFooter=false;
+       //Close page
+       $this->_endpage();
+       //Close document
+       $this->_enddoc();
+}
+
+function AddPage($orientation='', $format='')
+{
+       //Start a new page
+       if($this->state==0)
+               $this->Open();
+       $family=$this->FontFamily;
+       $style=$this->FontStyle.($this->underline ? 'U' : '');
+       $size=$this->FontSizePt;
+       $lw=$this->LineWidth;
+       $dc=$this->DrawColor;
+       $fc=$this->FillColor;
+       $tc=$this->TextColor;
+       $cf=$this->ColorFlag;
+       if($this->page>0)
+       {
+               //Page footer
+               $this->InFooter=true;
+               $this->Footer();
+               $this->InFooter=false;
+               //Close page
+               $this->_endpage();
+       }
+       //Start new page
+       $this->_beginpage($orientation,$format);
+       //Set line cap style to square
+       $this->_out('2 J');
+       //Set line width
+       $this->LineWidth=$lw;
+       $this->_out(sprintf('%.2F w',$lw*$this->k));
+       //Set font
+       if($family)
+               $this->SetFont($family,$style,$size);
+       //Set colors
+       $this->DrawColor=$dc;
+       if($dc!='0 G')
+               $this->_out($dc);
+       $this->FillColor=$fc;
+       if($fc!='0 g')
+               $this->_out($fc);
+       $this->TextColor=$tc;
+       $this->ColorFlag=$cf;
+       //Page header
+       $this->InHeader=true;
+       $this->Header();
+       $this->InHeader=false;
+       //Restore line width
+       if($this->LineWidth!=$lw)
+       {
+               $this->LineWidth=$lw;
+               $this->_out(sprintf('%.2F w',$lw*$this->k));
+       }
+       //Restore font
+       if($family)
+               $this->SetFont($family,$style,$size);
+       //Restore colors
+       if($this->DrawColor!=$dc)
+       {
+               $this->DrawColor=$dc;
+               $this->_out($dc);
+       }
+       if($this->FillColor!=$fc)
+       {
+               $this->FillColor=$fc;
+               $this->_out($fc);
+       }
+       $this->TextColor=$tc;
+       $this->ColorFlag=$cf;
+}
+
+function Header()
+{
+       //To be implemented in your own inherited class
+}
+
+function Footer()
+{
+       //To be implemented in your own inherited class
+}
+
+function PageNo()
+{
+       //Get current page number
+       return $this->page;
+}
+
+function SetDrawColor($r, $g=null, $b=null)
+{
+       //Set color for all stroking operations
+       if(($r==0 && $g==0 && $b==0) || $g===null)
+               $this->DrawColor=sprintf('%.3F G',$r/255);
+       else
+               $this->DrawColor=sprintf('%.3F %.3F %.3F 
RG',$r/255,$g/255,$b/255);
+       if($this->page>0)
+               $this->_out($this->DrawColor);
+}
+
+function SetFillColor($r, $g=null, $b=null)
+{
+       //Set color for all filling operations
+       if(($r==0 && $g==0 && $b==0) || $g===null)
+               $this->FillColor=sprintf('%.3F g',$r/255);
+       else
+               $this->FillColor=sprintf('%.3F %.3F %.3F 
rg',$r/255,$g/255,$b/255);
+       $this->ColorFlag=($this->FillColor!=$this->TextColor);
+       if($this->page>0)
+               $this->_out($this->FillColor);
+}
+
+function SetTextColor($r, $g=null, $b=null)
+{
+       //Set color for text
+       if(($r==0 && $g==0 && $b==0) || $g===null)
+               $this->TextColor=sprintf('%.3F g',$r/255);
+       else
+               $this->TextColor=sprintf('%.3F %.3F %.3F 
rg',$r/255,$g/255,$b/255);
+       $this->ColorFlag=($this->FillColor!=$this->TextColor);
+}
+
+function GetStringWidth($s)
+{
+       //Get width of a string in the current font
+       $s=(string)$s;
+       $cw=&$this->CurrentFont['cw'];
+       $w=0;
+       $l=strlen($s);
+       for($i=0;$i<$l;$i++)
+               $w+=$cw[$s[$i]];
+       return $w*$this->FontSize/1000;
+}
+
+function SetLineWidth($width)
+{
+       //Set line width
+       $this->LineWidth=$width;
+       if($this->page>0)
+               $this->_out(sprintf('%.2F w',$width*$this->k));
+}
+
+function Line($x1, $y1, $x2, $y2)
+{
+       //Draw a line
+       $this->_out(sprintf('%.2F %.2F m %.2F %.2F l 
S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
+}
+
+function Rect($x, $y, $w, $h, $style='')
+{
+       //Draw a rectangle
+       if($style=='F')
+               $op='f';
+       elseif($style=='FD' || $style=='DF')
+               $op='B';
+       else
+               $op='S';
+       $this->_out(sprintf('%.2F %.2F %.2F %.2F re 
%s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
+}
+
+function AddFont($family, $style='', $file='')
+{
+       //Add a TrueType or Type1 font
+       $family=strtolower($family);
+       if($file=='')
+               $file=str_replace(' ','',$family).strtolower($style).'.php';
+       if($family=='arial')
+               $family='helvetica';
+       $style=strtoupper($style);
+       if($style=='IB')
+               $style='BI';
+       $fontkey=$family.$style;
+       if(isset($this->fonts[$fontkey]))
+               return;
+       include($this->_getfontpath().$file);
+       if(!isset($name))
+               $this->Error('Could not include font definition file');
+       $i=count($this->fonts)+1;
+       $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 
'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file);
+       if($diff)
+       {
+               //Search existing encodings
+               $d=0;
+               $nb=count($this->diffs);
+               for($i=1;$i<=$nb;$i++)
+               {
+                       if($this->diffs[$i]==$diff)
+                       {
+                               $d=$i;
+                               break;
+                       }
+               }
+               if($d==0)
+               {
+                       $d=$nb+1;
+                       $this->diffs[$d]=$diff;
+               }
+               $this->fonts[$fontkey]['diff']=$d;
+       }
+       if($file)
+       {
+               if($type=='TrueType')
+                       $this->FontFiles[$file]=array('length1'=>$originalsize);
+               else
+                       $this->FontFiles[$file]=array('length1'=>$size1, 
'length2'=>$size2);
+       }
+}
+
+function SetFont($family, $style='', $size=0)
+{
+       //Select a font; size given in points
+       global $fpdf_charwidths;
+
+       $family=strtolower($family);
+       if($family=='')
+               $family=$this->FontFamily;
+       if($family=='arial')
+               $family='helvetica';
+       elseif($family=='symbol' || $family=='zapfdingbats')
+               $style='';
+       $style=strtoupper($style);
+       if(strpos($style,'U')!==false)
+       {
+               $this->underline=true;
+               $style=str_replace('U','',$style);
+       }
+       else
+               $this->underline=false;
+       if($style=='IB')
+               $style='BI';
+       if($size==0)
+               $size=$this->FontSizePt;
+       //Test if font is already selected
+       if($this->FontFamily==$family && $this->FontStyle==$style && 
$this->FontSizePt==$size)
+               return;
+       //Test if used for the first time
+       $fontkey=$family.$style;
+       if(!isset($this->fonts[$fontkey]))
+       {
+               //Check if one of the standard fonts
+               if(isset($this->CoreFonts[$fontkey]))
+               {
+                       if(!isset($fpdf_charwidths[$fontkey]))
+                       {
+                               //Load metric file
+                               $file=$family;
+                               if($family=='times' || $family=='helvetica')
+                                       $file.=strtolower($style);
+                               include($this->_getfontpath().$file.'.php');
+                               if(!isset($fpdf_charwidths[$fontkey]))
+                                       $this->Error('Could not include font 
metric file');
+                       }
+                       $i=count($this->fonts)+1;
+                       $name=$this->CoreFonts[$fontkey];
+                       $cw=$fpdf_charwidths[$fontkey];
+                       $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 
'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw);
+               }
+               else
+                       $this->Error('Undefined font: '.$family.' '.$style);
+       }
+       //Select it
+       $this->FontFamily=$family;
+       $this->FontStyle=$style;
+       $this->FontSizePt=$size;
+       $this->FontSize=$size/$this->k;
+       $this->CurrentFont=&$this->fonts[$fontkey];
+       if($this->page>0)
+               $this->_out(sprintf('BT /F%d %.2F Tf 
ET',$this->CurrentFont['i'],$this->FontSizePt));
+}
+
+function SetFontSize($size)
+{
+       //Set font size in points
+       if($this->FontSizePt==$size)
+               return;
+       $this->FontSizePt=$size;
+       $this->FontSize=$size/$this->k;
+       if($this->page>0)
+               $this->_out(sprintf('BT /F%d %.2F Tf 
ET',$this->CurrentFont['i'],$this->FontSizePt));
+}
+
+function AddLink()
+{
+       //Create a new internal link
+       $n=count($this->links)+1;
+       $this->links[$n]=array(0, 0);
+       return $n;
+}
+
+function SetLink($link, $y=0, $page=-1)
+{
+       //Set destination of internal link
+       if($y==-1)
+               $y=$this->y;
+       if($page==-1)
+               $page=$this->page;
+       $this->links[$link]=array($page, $y);
+}
+
+function Link($x, $y, $w, $h, $link)
+{
+       //Put a link on the page
+       $this->PageLinks[$this->page][]=array($x*$this->k, 
$this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link);
+}
+
+function Text($x, $y, $txt)
+{
+       //Output a string
+       $s=sprintf('BT %.2F %.2F Td (%s) Tj 
ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
+       if ($txt!='')
+       {
+               if($this->underline) $s.=' '.$this->_dounderline($x,$y,$txt);
+       }
+       if($this->ColorFlag)
+               $s='q '.$this->TextColor.' '.$s.' Q';
+       $this->_out($s);
+}
+
+function AcceptPageBreak()
+{
+       //Accept automatic page break or not
+       return $this->AutoPageBreak;
+}
+
+function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, 
$link='')
+{
+       //Output a cell
+       $k=$this->k;
+       if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && 
!$this->InFooter && $this->AcceptPageBreak())
+       {
+               //Automatic page break
+               $x=$this->x;
+               $ws=$this->ws;
+               if($ws>0)
+               {
+                       $this->ws=0;
+                       $this->_out('0 Tw');
+               }
+               $this->AddPage($this->CurOrientation,$this->CurPageFormat);
+               $this->x=$x;
+               if($ws>0)
+               {
+                       $this->ws=$ws;
+                       $this->_out(sprintf('%.3F Tw',$ws*$k));
+               }
+       }
+       if($w==0)
+               $w=$this->w-$this->rMargin-$this->x;
+       $s='';
+       if($fill || $border==1)
+       {
+               if($fill)
+                       $op=($border==1) ? 'B' : 'f';
+               else
+                       $op='S';
+               $s=sprintf('%.2F %.2F %.2F %.2F re %s 
',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
+       }
+       if(is_string($border))
+       {
+               $x=$this->x;
+               $y=$this->y;
+               if(strpos($border,'L')!==false)
+                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
+               if(strpos($border,'T')!==false)
+                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
+               if(strpos($border,'R')!==false)
+                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+               if(strpos($border,'B')!==false)
+                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+       }
+       if($txt!=='')
+       {
+               if($align=='R')
+                       $dx=$w-$this->cMargin-$this->GetStringWidth($txt);
+               elseif($align=='C')
+                       $dx=($w-$this->GetStringWidth($txt))/2;
+               else
+                       $dx=$this->cMargin;
+               if($this->ColorFlag)
+                       $s.='q '.$this->TextColor.' ';
+               
$txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
+               $s.=sprintf('BT %.2F %.2F Td (%s) Tj 
ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
+               if($this->underline)
+                       $s.=' 
'.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
+               if($this->ColorFlag)
+                       $s.=' Q';
+               if($link)
+                       
$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
+       }
+       if($s)
+               $this->_out($s);
+       $this->lasth=$h;
+       if($ln>0)
+       {
+               //Go to next line
+               $this->y+=$h;
+               if($ln==1)
+                       $this->x=$this->lMargin;
+       }
+       else
+               $this->x+=$w;
+}
+
+function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false)
+{
+       //Output text with automatic or explicit line breaks
+       $cw=&$this->CurrentFont['cw'];
+       if($w==0)
+               $w=$this->w-$this->rMargin-$this->x;
+       $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+       $s=str_replace("\r",'',$txt);
+       $nb=strlen($s);
+       if($nb>0 && $s[$nb-1]=="\n")
+               $nb--;
+       $b=0;
+       if($border)
+       {
+               if($border==1)
+               {
+                       $border='LTRB';
+                       $b='LRT';
+                       $b2='LR';
+               }
+               else
+               {
+                       $b2='';
+                       if(strpos($border,'L')!==false)
+                               $b2.='L';
+                       if(strpos($border,'R')!==false)
+                               $b2.='R';
+                       $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2;
+               }
+       }
+       $sep=-1;
+       $i=0;
+       $j=0;
+       $l=0;
+       $ns=0;
+       $nl=1;
+       while($i<$nb)
+       {
+               //Get next character
+               $c=$s[$i];
+               if($c=="\n")
+               {
+                       //Explicit line break
+                       if($this->ws>0)
+                       {
+                               $this->ws=0;
+                               $this->_out('0 Tw');
+                       }
+                       
$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+                       $i++;
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       $ns=0;
+                       $nl++;
+                       if($border && $nl==2)
+                               $b=$b2;
+                       continue;
+               }
+               if($c==' ')
+               {
+                       $sep=$i;
+                       $ls=$l;
+                       $ns++;
+               }
+               $l+=$cw[$c];
+               if($l>$wmax)
+               {
+                       //Automatic line break
+                       if($sep==-1)
+                       {
+                               if($i==$j)
+                                       $i++;
+                               if($this->ws>0)
+                               {
+                                       $this->ws=0;
+                                       $this->_out('0 Tw');
+                               }
+                               
$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+                       }
+                       else
+                       {
+                               if($align=='J')
+                               {
+                                       $this->ws=($ns>1) ? 
($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
+                                       $this->_out(sprintf('%.3F 
Tw',$this->ws*$this->k));
+                               }
+                               
$this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
+                               $i=$sep+1;
+                       }
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       $ns=0;
+                       $nl++;
+                       if($border && $nl==2)
+                               $b=$b2;
+               }
+               else
+                       $i++;
+       }
+       //Last chunk
+       if($this->ws>0)
+       {
+               $this->ws=0;
+               $this->_out('0 Tw');
+       }
+       if($border && strpos($border,'B')!==false)
+               $b.='B';
+       $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+       $this->x=$this->lMargin;
+}
+
+function Write($h, $txt, $link='')
+{
+       //Output text in flowing mode
+       $cw=&$this->CurrentFont['cw'];
+       $w=$this->w-$this->rMargin-$this->x;
+       $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+       $s=str_replace("\r",'',$txt);
+       $nb=strlen($s);
+       $sep=-1;
+       $i=0;
+       $j=0;
+       $l=0;
+       $nl=1;
+       while($i<$nb)
+       {
+               //Get next character
+               $c=$s[$i];
+               if($c=="\n")
+               {
+                       //Explicit line break
+                       $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+                       $i++;
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       if($nl==1)
+                       {
+                               $this->x=$this->lMargin;
+                               $w=$this->w-$this->rMargin-$this->x;
+                               
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+                       }
+                       $nl++;
+                       continue;
+               }
+               if($c==' ')
+                       $sep=$i;
+               $l+=$cw[$c];
+               if($l>$wmax)
+               {
+                       //Automatic line break
+                       if($sep==-1)
+                       {
+                               if($this->x>$this->lMargin)
+                               {
+                                       //Move to next line
+                                       $this->x=$this->lMargin;
+                                       $this->y+=$h;
+                                       $w=$this->w-$this->rMargin-$this->x;
+                                       
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+                                       $i++;
+                                       $nl++;
+                                       continue;
+                               }
+                               if($i==$j)
+                                       $i++;
+                               
$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+                       }
+                       else
+                       {
+                               
$this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
+                               $i=$sep+1;
+                       }
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       if($nl==1)
+                       {
+                               $this->x=$this->lMargin;
+                               $w=$this->w-$this->rMargin-$this->x;
+                               
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+                       }
+                       $nl++;
+               }
+               else
+                       $i++;
+       }
+       //Last chunk
+       if($i!=$j)
+               
$this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link);
+}
+
+function Ln($h=null)
+{
+       //Line feed; default value is last cell height
+       $this->x=$this->lMargin;
+       if($h===null)
+               $this->y+=$this->lasth;
+       else
+               $this->y+=$h;
+}
+
+function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='')
+{
+       //Put an image on the page
+       if(!isset($this->images[$file]))
+       {
+               //First use of this image, get info
+               if($type=='')
+               {
+                       $pos=strrpos($file,'.');
+                       if(!$pos)
+                               $this->Error('Image file has no extension and 
no type was specified: '.$file);
+                       $type=substr($file,$pos+1);
+               }
+               $type=strtolower($type);
+               if($type=='jpeg')
+                       $type='jpg';
+               $mtd='_parse'.$type;
+               if(!method_exists($this,$mtd))
+                       $this->Error('Unsupported image type: '.$type);
+               $info=$this->$mtd($file);
+               $info['i']=count($this->images)+1;
+               $this->images[$file]=$info;
+       }
+       else
+               $info=$this->images[$file];
+       //Automatic width and height calculation if needed
+       if($w==0 && $h==0)
+       {
+               //Put image at 72 dpi
+               $w=$info['w']/$this->k;
+               $h=$info['h']/$this->k;
+       }
+       elseif($w==0)
+               $w=$h*$info['w']/$info['h'];
+       elseif($h==0)
+               $h=$w*$info['h']/$info['w'];
+       //Flowing mode
+       if($y===null)
+       {
+               if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && 
!$this->InFooter && $this->AcceptPageBreak())
+               {
+                       //Automatic page break
+                       $x2=$this->x;
+                       
$this->AddPage($this->CurOrientation,$this->CurPageFormat);
+                       $this->x=$x2;
+               }
+               $y=$this->y;
+               $this->y+=$h;
+       }
+       if($x===null)
+               $x=$this->x;
+       $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do 
Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
+       if($link)
+               $this->Link($x,$y,$w,$h,$link);
+}
+
+function GetX()
+{
+       //Get x position
+       return $this->x;
+}
+
+function SetX($x)
+{
+       //Set x position
+       if($x>=0)
+               $this->x=$x;
+       else
+               $this->x=$this->w+$x;
+}
+
+function GetY()
+{
+       //Get y position
+       return $this->y;
+}
+
+function SetY($y)
+{
+       //Set y position and reset x
+       $this->x=$this->lMargin;
+       if($y>=0)
+               $this->y=$y;
+       else
+               $this->y=$this->h+$y;
+}
+
+function SetXY($x, $y)
+{
+       //Set x and y positions
+       $this->SetY($y);
+       $this->SetX($x);
+}
+
+function Output($name='', $dest='')
+{
+       //Output PDF to some destination
+       if($this->state<3)
+               $this->Close();
+       $dest=strtoupper($dest);
+       if($dest=='')
+       {
+               if($name=='')
+               {
+                       $name='doc.pdf';
+                       $dest='I';
+               }
+               else
+                       $dest='F';
+       }
+       switch($dest)
+       {
+               case 'I':
+                       //Send to standard output
+                       if(ob_get_length())
+                               $this->Error('Some data has already been 
output, can\'t send PDF file');
+                       if(php_sapi_name()!='cli')
+                       {
+                               //We send to a browser
+                               header('Content-Type: application/pdf');
+                               if(headers_sent())
+                                       $this->Error('Some data has already 
been output, can\'t send PDF file');
+                               header('Content-Length: 
'.strlen($this->buffer));
+                               header('Content-Disposition: inline; 
filename="'.$name.'"');
+                               header('Cache-Control: private, max-age=0, 
must-revalidate');
+                               header('Pragma: public');
+                               ini_set('zlib.output_compression','0');
+                       }
+                       echo $this->buffer;
+                       break;
+               case 'D':
+                       //Download file
+                       if(ob_get_length())
+                               $this->Error('Some data has already been 
output, can\'t send PDF file');
+                       header('Content-Type: application/x-download');
+                       if(headers_sent())
+                               $this->Error('Some data has already been 
output, can\'t send PDF file');
+                       header('Content-Length: '.strlen($this->buffer));
+                       header('Content-Disposition: attachment; 
filename="'.$name.'"');
+                       header('Cache-Control: private, max-age=0, 
must-revalidate');
+                       header('Pragma: public');
+                       ini_set('zlib.output_compression','0');
+                       echo $this->buffer;
+                       break;
+               case 'F':
+                       //Save to local file
+                       $f=fopen($name,'wb');
+                       if(!$f)
+                               $this->Error('Unable to create output file: 
'.$name);
+                       fwrite($f,$this->buffer,strlen($this->buffer));
+                       fclose($f);
+                       break;
+               case 'S':
+                       //Return as a string
+                       return $this->buffer;
+               default:
+                       $this->Error('Incorrect output destination: '.$dest);
+       }
+       return '';
+}
+
+/*******************************************************************************
+*                                                                              
*
+*                              Protected methods                               
*
+*                                                                              
*
+*******************************************************************************/
+function _dochecks()
+{
+       //Check availability of %F
+       if(sprintf('%.1F',1.0)!='1.0')
+               $this->Error('This version of PHP is not supported');
+       //Check mbstring overloading
+       if(ini_get('mbstring.func_overload') & 2)
+               $this->Error('mbstring overloading must be disabled');
+       //Disable runtime magic quotes
+       if(get_magic_quotes_runtime())
+               @set_magic_quotes_runtime(0);
+}
+
+function _getpageformat($format)
+{
+       $format=strtolower($format);
+       if(!isset($this->PageFormats[$format]))
+               $this->Error('Unknown page format: '.$format);
+       $a=$this->PageFormats[$format];
+       return array($a[0]/$this->k, $a[1]/$this->k);
+}
+
+function _getfontpath()
+{
+       if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font'))
+               define('FPDF_FONTPATH',dirname(__FILE__).'/font/');
+       return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
+}
+
+function _beginpage($orientation, $format)
+{
+       $this->page++;
+       $this->pages[$this->page]='';
+       $this->state=2;
+       $this->x=$this->lMargin;
+       $this->y=$this->tMargin;
+       $this->FontFamily='';
+       //Check page size
+       if($orientation=='')
+               $orientation=$this->DefOrientation;
+       else
+               $orientation=strtoupper($orientation[0]);
+       if($format=='')
+               $format=$this->DefPageFormat;
+       else
+       {
+               if(is_string($format))
+                       $format=$this->_getpageformat($format);
+       }
+       if($orientation!=$this->CurOrientation || 
$format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1])
+       {
+               //New size
+               if($orientation=='P')
+               {
+                       $this->w=$format[0];
+                       $this->h=$format[1];
+               }
+               else
+               {
+                       $this->w=$format[1];
+                       $this->h=$format[0];
+               }
+               $this->wPt=$this->w*$this->k;
+               $this->hPt=$this->h*$this->k;
+               $this->PageBreakTrigger=$this->h-$this->bMargin;
+               $this->CurOrientation=$orientation;
+               $this->CurPageFormat=$format;
+       }
+       if($orientation!=$this->DefOrientation || 
$format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1])
+               $this->PageSizes[$this->page]=array($this->wPt, $this->hPt);
+}
+
+function _endpage()
+{
+       $this->state=1;
+}
+
+function _escape($s)
+{
+       //Escape special characters in strings
+       $s=str_replace('\\','\\\\',$s);
+       $s=str_replace('(','\\(',$s);
+       $s=str_replace(')','\\)',$s);
+       $s=str_replace("\r",'\\r',$s);
+       return $s;
+}
+
+function _textstring($s)
+{
+       //Format a text string
+       return '('.$this->_escape($s).')';
+}
+
+function _UTF8toUTF16($s)
+{
+       //Convert UTF-8 to UTF-16BE with BOM
+       $res="\xFE\xFF";
+       $nb=strlen($s);
+       $i=0;
+       while($i<$nb)
+       {
+               $c1=ord($s[$i++]);
+               if($c1>=224)
+               {
+                       //3-byte character
+                       $c2=ord($s[$i++]);
+                       $c3=ord($s[$i++]);
+                       $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
+                       $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
+               }
+               elseif($c1>=192)
+               {
+                       //2-byte character
+                       $c2=ord($s[$i++]);
+                       $res.=chr(($c1 & 0x1C)>>2);
+                       $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
+               }
+               else
+               {
+                       //Single-byte character
+                       $res.="\0".chr($c1);
+               }
+       }
+       return $res;
+}
+
+function _dounderline($x, $y, $txt)
+{
+       //Underline text
+       $up=$this->CurrentFont['up'];
+       $ut=$this->CurrentFont['ut'];
+       $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
+       return sprintf('%.2F %.2F %.2F %.2F re 
f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
+}
+
+function _parsejpg($file)
+{
+       //Extract info from a JPEG file
+       $a=GetImageSize($file);
+       if(!$a)
+               $this->Error('Missing or incorrect image file: '.$file);
+       if($a[2]!=2)
+               $this->Error('Not a JPEG file: '.$file);
+       if(!isset($a['channels']) || $a['channels']==3)
+               $colspace='DeviceRGB';
+       elseif($a['channels']==4)
+               $colspace='DeviceCMYK';
+       else
+               $colspace='DeviceGray';
+       $bpc=isset($a['bits']) ? $a['bits'] : 8;
+       //Read whole file
+       $f=fopen($file,'rb');
+       $data='';
+       while(!feof($f))
+               $data.=fread($f,8192);
+       fclose($f);
+       return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 
'f'=>'DCTDecode', 'data'=>$data);
+}
+
+function _parsepng($file)
+{
+       //Extract info from a PNG file
+       $f=fopen($file,'rb');
+       if(!$f)
+               $this->Error('Can\'t open image file: '.$file);
+       //Check signature
+       
if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
+               $this->Error('Not a PNG file: '.$file);
+       //Read header chunk
+       $this->_readstream($f,4);
+       if($this->_readstream($f,4)!='IHDR')
+               $this->Error('Incorrect PNG file: '.$file);
+       $w=$this->_readint($f);
+       $h=$this->_readint($f);
+       $bpc=ord($this->_readstream($f,1));
+       if($bpc>8)
+               $this->Error('16-bit depth not supported: '.$file);
+       $ct=ord($this->_readstream($f,1));
+       if($ct==0)
+               $colspace='DeviceGray';
+       elseif($ct==2)
+               $colspace='DeviceRGB';
+       elseif($ct==3)
+               $colspace='Indexed';
+       else
+               $this->Error('Alpha channel not supported: '.$file);
+       if(ord($this->_readstream($f,1))!=0)
+               $this->Error('Unknown compression method: '.$file);
+       if(ord($this->_readstream($f,1))!=0)
+               $this->Error('Unknown filter method: '.$file);
+       if(ord($this->_readstream($f,1))!=0)
+               $this->Error('Interlacing not supported: '.$file);
+       $this->_readstream($f,4);
+       $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' 
/BitsPerComponent '.$bpc.' /Columns '.$w.'>>';
+       //Scan chunks looking for palette, transparency and image data
+       $pal='';
+       $trns='';
+       $data='';
+       do
+       {
+               $n=$this->_readint($f);
+               $type=$this->_readstream($f,4);
+               if($type=='PLTE')
+               {
+                       //Read palette
+                       $pal=$this->_readstream($f,$n);
+                       $this->_readstream($f,4);
+               }
+               elseif($type=='tRNS')
+               {
+                       //Read transparency info
+                       $t=$this->_readstream($f,$n);
+                       if($ct==0)
+                               $trns=array(ord(substr($t,1,1)));
+                       elseif($ct==2)
+                               $trns=array(ord(substr($t,1,1)), 
ord(substr($t,3,1)), ord(substr($t,5,1)));
+                       else
+                       {
+                               $pos=strpos($t,chr(0));
+                               if($pos!==false)
+                                       $trns=array($pos);
+                       }
+                       $this->_readstream($f,4);
+               }
+               elseif($type=='IDAT')
+               {
+                       //Read image data block
+                       $data.=$this->_readstream($f,$n);
+                       $this->_readstream($f,4);
+               }
+               elseif($type=='IEND')
+                       break;
+               else
+                       $this->_readstream($f,$n+4);
+       }
+       while($n);
+       if($colspace=='Indexed' && empty($pal))
+               $this->Error('Missing palette in '.$file);
+       fclose($f);
+       return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 
'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
+}
+
+function _readstream($f, $n)
+{
+       //Read n bytes from stream
+       $res='';
+       while($n>0 && !feof($f))
+       {
+               $s=fread($f,$n);
+               if($s===false)
+                       $this->Error('Error while reading stream');
+               $n-=strlen($s);
+               $res.=$s;
+       }
+       if($n>0)
+               $this->Error('Unexpected end of stream');
+       return $res;
+}
+
+function _readint($f)
+{
+       //Read a 4-byte integer from stream
+       $a=unpack('Ni',$this->_readstream($f,4));
+       return $a['i'];
+}
+
+function _parsegif($file)
+{
+       //Extract info from a GIF file (via PNG conversion)
+       if(!function_exists('imagepng'))
+               $this->Error('GD extension is required for GIF support');
+       if(!function_exists('imagecreatefromgif'))
+               $this->Error('GD has no GIF read support');
+       $im=imagecreatefromgif($file);
+       if(!$im)
+               $this->Error('Missing or incorrect image file: '.$file);
+       imageinterlace($im,0);
+       $tmp=tempnam('.','gif');
+       if(!$tmp)
+               $this->Error('Unable to create a temporary file');
+       if(!imagepng($im,$tmp))
+               $this->Error('Error while saving to temporary file');
+       imagedestroy($im);
+       $info=$this->_parsepng($tmp);
+       unlink($tmp);
+       return $info;
+}
+
+function _newobj()
+{
+       //Begin a new object
+       $this->n++;
+       $this->offsets[$this->n]=strlen($this->buffer);
+       $this->_out($this->n.' 0 obj');
+}
+
+function _putstream($s)
+{
+       $this->_out('stream');
+       $this->_out($s);
+       $this->_out('endstream');
+}
+
+function _out($s)
+{
+       //Add a line to the document
+       if($this->state==2)
+               $this->pages[$this->page].=$s."\n";
+       else
+               $this->buffer.=$s."\n";
+}
+
+function _putpages()
+{
+       $nb=$this->page;
+       if(!empty($this->AliasNbPages))
+       {
+               //Replace number of pages
+               for($n=1;$n<=$nb;$n++)
+                       
$this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]);
+       }
+       if($this->DefOrientation=='P')
+       {
+               $wPt=$this->DefPageFormat[0]*$this->k;
+               $hPt=$this->DefPageFormat[1]*$this->k;
+       }
+       else
+       {
+               $wPt=$this->DefPageFormat[1]*$this->k;
+               $hPt=$this->DefPageFormat[0]*$this->k;
+       }
+       $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+       for($n=1;$n<=$nb;$n++)
+       {
+               //Page
+               $this->_newobj();
+               $this->_out('<</Type /Page');
+               $this->_out('/Parent 1 0 R');
+               if(isset($this->PageSizes[$n]))
+                       $this->_out(sprintf('/MediaBox [0 0 %.2F 
%.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1]));
+               $this->_out('/Resources 2 0 R');
+               if(isset($this->PageLinks[$n]))
+               {
+                       //Links
+                       $annots='/Annots [';
+                       foreach($this->PageLinks[$n] as $pl)
+                       {
+                               $rect=sprintf('%.2F %.2F %.2F 
%.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
+                               $annots.='<</Type /Annot /Subtype /Link /Rect 
['.$rect.'] /Border [0 0 0] ';
+                               if(is_string($pl[4]))
+                                       $annots.='/A <</S /URI /URI 
'.$this->_textstring($pl[4]).'>>>>';
+                               else
+                               {
+                                       $l=$this->links[$pl[4]];
+                                       $h=isset($this->PageSizes[$l[0]]) ? 
$this->PageSizes[$l[0]][1] : $hPt;
+                                       $annots.=sprintf('/Dest [%d 0 R /XYZ 0 
%.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k);
+                               }
+                       }
+                       $this->_out($annots.']');
+               }
+               $this->_out('/Contents '.($this->n+1).' 0 R>>');
+               $this->_out('endobj');
+               //Page content
+               $p=($this->compress) ? gzcompress($this->pages[$n]) : 
$this->pages[$n];
+               $this->_newobj();
+               $this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
+               $this->_putstream($p);
+               $this->_out('endobj');
+       }
+       //Pages root
+       $this->offsets[1]=strlen($this->buffer);
+       $this->_out('1 0 obj');
+       $this->_out('<</Type /Pages');
+       $kids='/Kids [';
+       for($i=0;$i<$nb;$i++)
+               $kids.=(3+2*$i).' 0 R ';
+       $this->_out($kids.']');
+       $this->_out('/Count '.$nb);
+       $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt));
+       $this->_out('>>');
+       $this->_out('endobj');
+}
+
+function _putfonts()
+{
+       $nf=$this->n;
+       foreach($this->diffs as $diff)
+       {
+               //Encodings
+               $this->_newobj();
+               $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding 
/Differences ['.$diff.']>>');
+               $this->_out('endobj');
+       }
+       foreach($this->FontFiles as $file=>$info)
+       {
+               //Font file embedding
+               $this->_newobj();
+               $this->FontFiles[$file]['n']=$this->n;
+               $font='';
+               $f=fopen($this->_getfontpath().$file,'rb',1);
+               if(!$f)
+                       $this->Error('Font file not found');
+               while(!feof($f))
+                       $font.=fread($f,8192);
+               fclose($f);
+               $compressed=(substr($file,-2)=='.z');
+               if(!$compressed && isset($info['length2']))
+               {
+                       $header=(ord($font[0])==128);
+                       if($header)
+                       {
+                               //Strip first binary header
+                               $font=substr($font,6);
+                       }
+                       if($header && ord($font[$info['length1']])==128)
+                       {
+                               //Strip second binary header
+                               
$font=substr($font,0,$info['length1']).substr($font,$info['length1']+6);
+                       }
+               }
+               $this->_out('<</Length '.strlen($font));
+               if($compressed)
+                       $this->_out('/Filter /FlateDecode');
+               $this->_out('/Length1 '.$info['length1']);
+               if(isset($info['length2']))
+                       $this->_out('/Length2 '.$info['length2'].' /Length3 0');
+               $this->_out('>>');
+               $this->_putstream($font);
+               $this->_out('endobj');
+       }
+       foreach($this->fonts as $k=>$font)
+       {
+               //Font objects
+               $this->fonts[$k]['n']=$this->n+1;
+               $type=$font['type'];
+               $name=$font['name'];
+               if($type=='core')
+               {
+                       //Standard font
+                       $this->_newobj();
+                       $this->_out('<</Type /Font');
+                       $this->_out('/BaseFont /'.$name);
+                       $this->_out('/Subtype /Type1');
+                       if($name!='Symbol' && $name!='ZapfDingbats')
+                               $this->_out('/Encoding /WinAnsiEncoding');
+                       $this->_out('>>');
+                       $this->_out('endobj');
+               }
+               elseif($type=='Type1' || $type=='TrueType')
+               {
+                       //Additional Type1 or TrueType font
+                       $this->_newobj();
+                       $this->_out('<</Type /Font');
+                       $this->_out('/BaseFont /'.$name);
+                       $this->_out('/Subtype /'.$type);
+                       $this->_out('/FirstChar 32 /LastChar 255');
+                       $this->_out('/Widths '.($this->n+1).' 0 R');
+                       $this->_out('/FontDescriptor '.($this->n+2).' 0 R');
+                       if($font['enc'])
+                       {
+                               if(isset($font['diff']))
+                                       $this->_out('/Encoding 
'.($nf+$font['diff']).' 0 R');
+                               else
+                                       $this->_out('/Encoding 
/WinAnsiEncoding');
+                       }
+                       $this->_out('>>');
+                       $this->_out('endobj');
+                       //Widths
+                       $this->_newobj();
+                       $cw=&$font['cw'];
+                       $s='[';
+                       for($i=32;$i<=255;$i++)
+                               $s.=$cw[chr($i)].' ';
+                       $this->_out($s.']');
+                       $this->_out('endobj');
+                       //Descriptor
+                       $this->_newobj();
+                       $s='<</Type /FontDescriptor /FontName /'.$name;
+                       foreach($font['desc'] as $k=>$v)
+                               $s.=' /'.$k.' '.$v;
+                       $file=$font['file'];
+                       if($file)
+                               $s.=' /FontFile'.($type=='Type1' ? '' : '2').' 
'.$this->FontFiles[$file]['n'].' 0 R';
+                       $this->_out($s.'>>');
+                       $this->_out('endobj');
+               }
+               else
+               {
+                       //Allow for additional types
+                       $mtd='_put'.strtolower($type);
+                       if(!method_exists($this,$mtd))
+                               $this->Error('Unsupported font type: '.$type);
+                       $this->$mtd($font);
+               }
+       }
+}
+
+function _putimages()
+{
+       $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+       reset($this->images);
+       while(list($file,$info)=each($this->images))
+       {
+               $this->_newobj();
+               $this->images[$file]['n']=$this->n;
+               $this->_out('<</Type /XObject');
+               $this->_out('/Subtype /Image');
+               $this->_out('/Width '.$info['w']);
+               $this->_out('/Height '.$info['h']);
+               if($info['cs']=='Indexed')
+                       $this->_out('/ColorSpace [/Indexed /DeviceRGB 
'.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
+               else
+               {
+                       $this->_out('/ColorSpace /'.$info['cs']);
+                       if($info['cs']=='DeviceCMYK')
+                               $this->_out('/Decode [1 0 1 0 1 0 1 0]');
+               }
+               $this->_out('/BitsPerComponent '.$info['bpc']);
+               if(isset($info['f']))
+                       $this->_out('/Filter /'.$info['f']);
+               if(isset($info['parms']))
+                       $this->_out($info['parms']);
+               if(isset($info['trns']) && is_array($info['trns']))
+               {
+                       $trns='';
+                       for($i=0;$i<count($info['trns']);$i++)
+                               $trns.=$info['trns'][$i].' 
'.$info['trns'][$i].' ';
+                       $this->_out('/Mask ['.$trns.']');
+               }
+               $this->_out('/Length '.strlen($info['data']).'>>');
+               $this->_putstream($info['data']);
+               unset($this->images[$file]['data']);
+               $this->_out('endobj');
+               //Palette
+               if($info['cs']=='Indexed')
+               {
+                       $this->_newobj();
+                       $pal=($this->compress) ? gzcompress($info['pal']) : 
$info['pal'];
+                       $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
+                       $this->_putstream($pal);
+                       $this->_out('endobj');
+               }
+       }
+}
+
+function _putxobjectdict()
+{
+       foreach($this->images as $image)
+               $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
+}
+
+function _putresourcedict()
+{
+       $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
+       $this->_out('/Font <<');
+       foreach($this->fonts as $font)
+               $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
+       $this->_out('>>');
+       $this->_out('/XObject <<');
+       $this->_putxobjectdict();
+       $this->_out('>>');
+}
+
+function _putresources()
+{
+       $this->_putfonts();
+       $this->_putimages();
+       //Resource dictionary
+       $this->offsets[2]=strlen($this->buffer);
+       $this->_out('2 0 obj');
+       $this->_out('<<');
+       $this->_putresourcedict();
+       $this->_out('>>');
+       $this->_out('endobj');
+}
+
+function _putinfo()
+{
+       $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
+       if(!empty($this->title))
+               $this->_out('/Title '.$this->_textstring($this->title));
+       if(!empty($this->subject))
+               $this->_out('/Subject '.$this->_textstring($this->subject));
+       if(!empty($this->author))
+               $this->_out('/Author '.$this->_textstring($this->author));
+       if(!empty($this->keywords))
+               $this->_out('/Keywords '.$this->_textstring($this->keywords));
+       if(!empty($this->creator))
+               $this->_out('/Creator '.$this->_textstring($this->creator));
+       $this->_out('/CreationDate 
'.$this->_textstring('D:'address@hidden('YmdHis')));
+}
+
+function _putcatalog()
+{
+       $this->_out('/Type /Catalog');
+       $this->_out('/Pages 1 0 R');
+       if($this->ZoomMode=='fullpage')
+               $this->_out('/OpenAction [3 0 R /Fit]');
+       elseif($this->ZoomMode=='fullwidth')
+               $this->_out('/OpenAction [3 0 R /FitH null]');
+       elseif($this->ZoomMode=='real')
+               $this->_out('/OpenAction [3 0 R /XYZ null null 1]');
+       elseif(!is_string($this->ZoomMode))
+               $this->_out('/OpenAction [3 0 R /XYZ null null 
'.($this->ZoomMode/100).']');
+       if($this->LayoutMode=='single')
+               $this->_out('/PageLayout /SinglePage');
+       elseif($this->LayoutMode=='continuous')
+               $this->_out('/PageLayout /OneColumn');
+       elseif($this->LayoutMode=='two')
+               $this->_out('/PageLayout /TwoColumnLeft');
+}
+
+function _putheader()
+{
+       $this->_out('%PDF-'.$this->PDFVersion);
+}
+
+function _puttrailer()
+{
+       $this->_out('/Size '.($this->n+1));
+       $this->_out('/Root '.$this->n.' 0 R');
+       $this->_out('/Info '.($this->n-1).' 0 R');
+}
+
+function _enddoc()
+{
+       $this->_putheader();
+       $this->_putpages();
+       $this->_putresources();
+       //Info
+       $this->_newobj();
+       $this->_out('<<');
+       $this->_putinfo();
+       $this->_out('>>');
+       $this->_out('endobj');
+       //Catalog
+       $this->_newobj();
+       $this->_out('<<');
+       $this->_putcatalog();
+       $this->_out('>>');
+       $this->_out('endobj');
+       //Cross-ref
+       $o=strlen($this->buffer);
+       $this->_out('xref');
+       $this->_out('0 '.($this->n+1));
+       $this->_out('0000000000 65535 f ');
+       for($i=1;$i<=$this->n;$i++)
+               $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
+       //Trailer
+       $this->_out('trailer');
+       $this->_out('<<');
+       $this->_puttrailer();
+       $this->_out('>>');
+       $this->_out('startxref');
+       $this->_out($o);
+       $this->_out('%%EOF');
+       $this->state=3;
+}
+//End of class
+}
+
+//Handle special IE contype request
+if(isset($_SERVER['HTTP_USER_AGENT']) && 
$_SERVER['HTTP_USER_AGENT']=='contype')
+{
+       header('Content-Type: application/pdf');
+       exit;
+}
+
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/fpdf.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/histo.htm
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/histo.htm         
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/histo.htm 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,128 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>History</title>
+<link type="text/css" rel="stylesheet" href="fpdf.css">
+<style type="text/css">
+dd {margin-top:1em; margin-bottom:1em}
+</style>
+</head>
+<body>
+<h1>History</h1>
+<dl>
+<dt><strong>v1.6</strong> (2008-06-08)</dt>
+<dd>
+- GIF image support.<br>
+- Images can now trigger page breaks.<br>
+- Possibility to have different page formats in a single document.<br>
+- Document properties (author, creator, keywords, subject and title) can now 
be specified in UTF-8.<br>
+- Fixed a bug: when a PNG was inserted through a URL, an error sometimes 
occurred.<br>
+- An automatic page break in Header() doesn't cause an infinite loop any 
more.<br>
+- Removed some warning messages appearing with recent PHP versions.<br>
+- Added HTTP headers to reduce problems with IE.<br>
+</dd>
+<dt><strong>v1.53</strong> (2004-12-31)</dt>
+<dd>
+- When the font subdirectory is in the same directory as fpdf.php, it is no 
longer necessary to define the FPDF_FONTPATH constant.<br>
+- The array $HTTP_SERVER_VARS is no longer used. It could cause trouble on 
PHP5-based configurations with the register_long_arrays option disabled.<br>
+- Fixed a problem related to Type1 font embedding which caused trouble to some 
PDF processors.<br>
+- The file name sent to the browser could not contain a space character.<br>
+- The Cell() method could not print the number 0 (you had to pass the string 
'0').<br>
+</dd>
+<dt><strong>v1.52</strong> (2003-12-30)</dt>
+<dd>
+- Image() now displays the image at 72 dpi if no dimension is given.<br>
+- Output() takes a string as second parameter to indicate destination.<br>
+- Open() is now called automatically by AddPage().<br>
+- Inserting remote JPEG images doesn't generate an error any longer.<br>
+- Decimal separator is forced to dot in the constructor.<br>
+- Added several encodings (Turkish, Thai, Hebrew, Ukrainian and 
Vietnamese).<br>
+- The last line of a right-aligned MultiCell() was not correctly aligned if it 
was terminated by a carriage return.<br>
+- No more error message about already sent headers when outputting the PDF to 
the standard output from the command line.<br>
+- The underlining was going too far for text containing characters \, ( or 
).<br>
+- $HTTP_ENV_VARS has been replaced by $HTTP_SERVER_VARS.<br>
+</dd>
+<dt><strong>v1.51</strong> (2002-08-03)</dt>
+<dd>
+- Type1 font support.<br>
+- Added Baltic encoding.<br>
+- The class now works internally in points with the origin at the bottom in 
order to avoid two bugs occurring with Acrobat 5 :<br>&nbsp;&nbsp;* The line 
thickness was too large when printed under Windows 98 SE and 
ME.<br>&nbsp;&nbsp;* TrueType fonts didn't appear immediately inside the 
plug-in (a substitution font was used), one had to cause a window refresh to 
make them show up.<br>
+- It is no longer necessary to set the decimal separator as dot to produce 
valid documents.<br>
+- The clickable area in a cell was always on the left independently from the 
text alignment.<br>
+- JPEG images in CMYK mode appeared in inverted colors.<br>
+- Transparent PNG images in grayscale or true color mode were incorrectly 
handled.<br>
+- Adding new fonts now works correctly even with the magic_quotes_runtime 
option set to on.<br>
+</dd>
+<dt><strong>v1.5</strong> (2002-05-28)</dt>
+<dd>
+- TrueType font (AddFont()) and encoding support (Western and Eastern Europe, 
Cyrillic and Greek).<br>
+- Added Write() method.<br>
+- Added underlined style.<br>
+- Internal and external link support (AddLink(), SetLink(), Link()).<br>
+- Added right margin management and methods SetRightMargin(), 
SetTopMargin().<br>
+- Modification of SetDisplayMode() to select page layout.<br>
+- The border parameter of MultiCell() now lets choose borders to draw as 
Cell().<br>
+- When a document contains no page, Close() now calls AddPage() instead of 
causing a fatal error.<br>
+</dd>
+<dt><strong>v1.41</strong> (2002-03-13)</dt>
+<dd>
+- Fixed SetDisplayMode() which no longer worked (the PDF viewer used its 
default display).<br>
+</dd>
+<dt><strong>v1.4</strong> (2002-03-02)</dt>
+<dd>
+- PHP3 is no longer supported.<br>
+- Page compression (SetCompression()).<br>
+- Choice of page format and possibility to change orientation inside 
document.<br>
+- Added AcceptPageBreak() method.<br>
+- Ability to print the total number of pages (AliasNbPages()).<br>
+- Choice of cell borders to draw.<br>
+- New mode for Cell(): the current position can now move under the cell.<br>
+- Ability to include an image by specifying height only (width is calculated 
automatically).<br>
+- Fixed a bug: when a justified line triggered a page break, the footer 
inherited the corresponding word spacing.<br>
+</dd>
+<dt><strong>v1.31</strong> (2002-01-12)</dt>
+<dd>
+- Fixed a bug in drawing frame with MultiCell(): the last line always started 
from the left margin.<br>
+- Removed Expires HTTP header (gives trouble in some situations).<br>
+- Added Content-disposition HTTP header (seems to help in some situations).<br>
+</dd>
+<dt><strong>v1.3</strong> (2001-12-03)</dt>
+<dd>
+- Line break and text justification support (MultiCell()).<br>
+- Color support (SetDrawColor(), SetFillColor(), SetTextColor()). Possibility 
to draw filled rectangles and paint cell background.<br>
+- A cell whose width is declared null extends up to the right margin of the 
page.<br>
+- Line width is now retained from page to page and defaults to 0.2 mm.<br>
+- Added SetXY() method.<br>
+- Fixed a passing by reference done in a deprecated manner for PHP4.<br>
+</dd>
+<dt><strong>v1.2</strong> (2001-11-11)</dt>
+<dd>
+- Added font metric files and GetStringWidth() method.<br>
+- Centering and right-aligning text in cells.<br>
+- Display mode control (SetDisplayMode()).<br>
+- Added methods to set document properties (SetAuthor(), SetCreator(), 
SetKeywords(), SetSubject(), SetTitle()).<br>
+- Possibility to force PDF download by browser.<br>
+- Added SetX() and GetX() methods.<br>
+- During automatic page break, current abscissa is now retained.<br>
+</dd>
+<dt><strong>v1.11</strong> (2001-10-20)</dt>
+<dd>
+- PNG support doesn't require PHP4/zlib any more. Data are now put directly 
into PDF without any decompression/recompression stage.<br>
+- Image insertion now works correctly even with magic_quotes_runtime option 
set to on.<br>
+</dd>
+<dt><strong>v1.1</strong> (2001-10-07)</dt>
+<dd>
+- JPEG and PNG image support.<br>
+</dd>
+<dt><strong>v1.01</strong> (2001-10-03)</dt>
+<dd>
+- Fixed a bug involving page break: in case when Header() doesn't specify a 
font, the one from previous page was not restored and produced an incorrect 
document.<br>
+</dd>
+<dt><strong>v1.0</strong> (2001-09-17)</dt>
+<dd>
+- First version.<br>
+</dd>
+</dl>
+</body>
+</html>

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/install.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/install.txt       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/install.txt       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,26 @@
+The FPDF library is made up of the following elements:
+
+- the main file, fpdf.php, which contains the class
+- the font metric files (located in the font directory of this archive)
+
+The metric files are necessary as soon as you want to output some text in a 
document.
+They can be accessed from three different locations:
+
+- the directory defined by the FPDF_FONTPATH constant (if this constant is 
defined)
+- the font directory located in the directory containing fpdf.php (as it is 
the case in this archive)
+- the directories accessible through include()
+
+Here is an example defining FPDF_FONTPATH (note the mandatory final slash):
+
+define('FPDF_FONTPATH','/home/www/font/');
+require('fpdf.php');
+
+If the files are not accessible, the SetFont() method will produce the 
following error:
+
+FPDF error: Could not include font metric file
+
+
+Remarks:
+
+- Only the files corresponding to the fonts actually used are necessary
+- The tutorials provided in this package are ready to be executed


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/install.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/license.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/license.txt       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/license.txt       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,6 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software to use, copy, modify, distribute, sublicense, and/or sell
+copies of the software, and to permit persons to whom the software is furnished
+to do so.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED.
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/license.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c1.txt
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c1.txt   
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c1.txt   
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,10 @@
+The year 1866 was marked by a bizarre development, an unexplained and 
downright inexplicable phenomenon that surely no one has forgotten. Without 
getting into those rumors that upset civilians in the seaports and deranged the 
public mind even far inland, it must be said that professional seamen were 
especially alarmed. Traders, shipowners, captains of vessels, skippers, and 
master mariners from Europe and America, naval officers from every country, and 
at their heels the various national governments on these two continents, were 
all extremely disturbed by the business.
+In essence, over a period of time several ships had encountered "an enormous 
thing" at sea, a long spindle-shaped object, sometimes giving off a 
phosphorescent glow, infinitely bigger and faster than any whale.
+The relevant data on this apparition, as recorded in various logbooks, agreed 
pretty closely as to the structure of the object or creature in question, its 
unprecedented speed of movement, its startling locomotive power, and the unique 
vitality with which it seemed to be gifted.  If it was a cetacean, it exceeded 
in bulk any whale previously classified by science.  No naturalist, neither 
Cuvier nor Lac\xE9p\xE8de, neither Professor Dumeril nor Professor de 
Quatrefages, would have accepted the existence of such a monster sight unseen 
-- specifically, unseen by their own scientific eyes.
+Striking an average of observations taken at different times -- rejecting 
those timid estimates that gave the object a length of 200 feet, and ignoring 
those exaggerated views that saw it as a mile wide and three long--you could 
still assert that this phenomenal creature greatly exceeded the dimensions of 
anything then known to ichthyologists, if it existed at all.
+Now then, it did exist, this was an undeniable fact; and since the human mind 
dotes on objects of wonder, you can understand the worldwide excitement caused 
by this unearthly apparition. As for relegating it to the realm of fiction, 
that charge had to be dropped.
+In essence, on July 20, 1866, the steamer Governor Higginson, from the 
Calcutta & Burnach Steam Navigation Co., encountered this moving mass five 
miles off the eastern shores of Australia. Captain Baker at first thought he 
was in the presence of an unknown reef; he was even about to fix its exact 
position when two waterspouts shot out of this inexplicable object and sprang 
hissing into the air some 150 feet.  So, unless this reef was subject to the 
intermittent eruptions of a geyser, the Governor Higginson had fair and honest 
dealings with some aquatic mammal, until then unknown, that could spurt from 
its blowholes waterspouts mixed with air and steam.
+Similar events were likewise observed in Pacific seas, on July 23 of the same 
year, by the Christopher Columbus from the West India & Pacific Steam 
Navigation Co.  Consequently, this extraordinary cetacean could transfer itself 
from one locality to another with startling swiftness, since within an interval 
of just three days, the Governor Higginson and the Christopher Columbus had 
observed it at two positions on the charts separated by a distance of more than 
700 nautical leagues.
+Fifteen days later and 2,000 leagues farther, the Helvetia from the Compagnie 
Nationale and the Shannon from the Royal Mail line, running on opposite tacks 
in that part of the Atlantic lying between the United States and Europe, 
respectively signaled each other that the monster had been sighted in latitude 
42 degrees 15' north and longitude 60 degrees 35' west of the meridian of 
Greenwich.  From their simultaneous observations, they were able to estimate 
the mammal's minimum length at more than 350 English feet; this was because 
both the Shannon and the Helvetia were of smaller dimensions, although each 
measured 100 meters stem to stern. Now then, the biggest whales, those rorqual 
whales that frequent the waterways of the Aleutian Islands, have never exceeded 
a length of 56 meters--if they reach even that.
+One after another, reports arrived that would profoundly affect public 
opinion:  new observations taken by the transatlantic liner Pereire, the Inman 
line's Etna running afoul of the monster, an official report drawn up by 
officers on the French frigate Normandy, dead-earnest reckonings obtained by 
the general staff of Commodore Fitz-James aboard the Lord Clyde. In 
lighthearted countries, people joked about this phenomenon, but such serious, 
practical countries as England, America, and Germany were deeply concerned.
+In every big city the monster was the latest rage; they sang about it in the 
coffee houses, they ridiculed it in the newspapers, they dramatized it in the 
theaters.  The tabloids found it a fine opportunity for hatching all sorts of 
hoaxes. In those newspapers short of copy, you saw the reappearance of every 
gigantic imaginary creature, from "Moby Dick," that dreadful white whale from 
the High Arctic regions, to the stupendous kraken whose tentacles could entwine 
a 500-ton craft and drag it into the ocean depths. They even reprinted reports 
from ancient times: the views of Aristotle and Pliny accepting the existence of 
such monsters, then the Norwegian stories of Bishop Pontoppidan, the narratives 
of Paul Egede, and finally the reports of Captain Harrington -- whose good 
faith is above suspicion--in which he claims he saw, while aboard the Castilian 
in 1857, one of those enormous serpents that, until then, had frequented only 
the seas of France's old extremist newspaper, The Constitutionalist.


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c1.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c2.txt
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c2.txt   
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c2.txt   
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+During the period in which these developments were occurring, I had returned 
from a scientific undertaking organized to explore the Nebraska badlands in the 
United States. In my capacity as Assistant Professor at the Paris Museum of 
Natural History, I had been attached to this expedition by the French 
government. After spending six months in Nebraska, I arrived in New York laden 
with valuable collections near the end of March. My departure for France was 
set for early May. In the meantime, then, I was busy classifying my 
mineralogical, botanical, and zoological treasures when that incident took 
place with the Scotia.
+I was perfectly abreast of this question, which was the big news of the day, 
and how could I not have been? I had read and reread every American and 
European newspaper without being any farther along. This mystery puzzled me. 
Finding it impossible to form any views, I drifted from one extreme to the 
other. Something was out there, that much was certain, and any doubting Thomas 
was invited to place his finger on the Scotia's wound.
+When I arrived in New York, the question was at the boiling point. The 
hypothesis of a drifting islet or an elusive reef, put forward by people not 
quite in their right minds, was completely eliminated. And indeed, unless this 
reef had an engine in its belly, how could it move about with such prodigious 
speed?
+Also discredited was the idea of a floating hull or some other enormous 
wreckage, and again because of this speed of movement.
+So only two possible solutions to the question were left, creating two very 
distinct groups of supporters: on one side, those favoring a monster of 
colossal strength; on the other, those favoring an "underwater boat" of 
tremendous motor power.
+Now then, although the latter hypothesis was completely admissible, it 
couldn't stand up to inquiries conducted in both the New World and the Old. 
That a private individual had such a mechanism at his disposal was less than 
probable. Where and when had he built it, and how could he have built it in 
secret?
+Only some government could own such an engine of destruction, and in these 
disaster-filled times, when men tax their ingenuity to build increasingly 
powerful aggressive weapons, it was possible that, unknown to the rest of the 
world, some nation could have been testing such a fearsome machine. The 
Chassepot rifle led to the torpedo, and the torpedo has led to this underwater 
battering ram, which in turn will lead to the world putting its foot down. At 
least I hope it will.
+But this hypothesis of a war machine collapsed in the face of formal denials 
from the various governments. Since the public interest was at stake and 
transoceanic travel was suffering, the sincerity of these governments could not 
be doubted. Besides, how could the assembly of this underwater boat have 
escaped public notice? Keeping a secret under such circumstances would be 
difficult enough for an individual, and certainly impossible for a nation whose 
every move is under constant surveillance by rival powers.
+So, after inquiries conducted in England, France, Russia, Prussia, Spain, 
Italy, America, and even Turkey, the hypothesis of an underwater Monitor was 
ultimately rejected.
+After I arrived in New York, several people did me the honor of consulting me 
on the phenomenon in question. In France I had published a two-volume work, in 
quarto, entitled The Mysteries of the Great Ocean Depths. Well received in 
scholarly circles, this book had established me as a specialist in this pretty 
obscure field of natural history. My views were in demand. As long as I could 
deny the reality of the business, I confined myself to a flat "no comment." But 
soon, pinned to the wall, I had to explain myself straight out. And in this 
vein, "the honorable Pierre Aronnax, Professor at the Paris Museum," was 
summoned by The New York Herald to formulate his views no matter what.
+I complied. Since I could no longer hold my tongue, I let it wag. I discussed 
the question in its every aspect, both political and scientific, and this is an 
excerpt from the well-padded article I published in the issue of April 30.
+
+"Therefore," I wrote, "after examining these different hypotheses one by one, 
we are forced, every other supposition having been refuted, to accept the 
existence of an extremely powerful marine animal.
+"The deepest parts of the ocean are totally unknown to us. No soundings have 
been able to reach them. What goes on in those distant depths? What creatures 
inhabit, or could inhabit, those regions twelve or fifteen miles beneath the 
surface of the water? What is the constitution of these animals? It's almost 
beyond conjecture.
+"However, the solution to this problem submitted to me can take the form of a 
choice between two alternatives.
+"Either we know every variety of creature populating our planet, or we do not.
+"If we do not know every one of them, if nature still keeps ichthyological 
secrets from us, nothing is more admissible than to accept the existence of 
fish or cetaceans of new species or even new genera, animals with a basically 
'cast-iron' constitution that inhabit strata beyond the reach of our soundings, 
and which some development or other, an urge or a whim if you prefer, can bring 
to the upper level of the ocean for long intervals.
+"If, on the other hand, we do know every living species, we must look for the 
animal in question among those marine creatures already cataloged, and in this 
event I would be inclined to accept the existence of a giant narwhale.
+"The common narwhale, or sea unicorn, often reaches a length of sixty feet. 
Increase its dimensions fivefold or even tenfold, then give this cetacean a 
strength in proportion to its size while enlarging its offensive weapons, and 
you have the animal we're looking for. It would have the proportions determined 
by the officers of the Shannon, the instrument needed to perforate the Scotia, 
and the power to pierce a steamer's hull.
+"In essence, the narwhale is armed with a sort of ivory sword, or lance, as 
certain naturalists have expressed it. It's a king-sized tooth as hard as 
steel. Some of these teeth have been found buried in the bodies of baleen 
whales, which the narwhale attacks with invariable success. Others have been 
wrenched, not without difficulty, from the undersides of vessels that narwhales 
have pierced clean through, as a gimlet pierces a wine barrel. The museum at 
the Faculty of Medicine in Paris owns one of these tusks with a length of 2.25 
meters and a width at its base of forty-eight centimeters!
+"All right then! Imagine this weapon to be ten times stronger and the animal 
ten times more powerful, launch it at a speed of twenty miles per hour, 
multiply its mass times its velocity, and you get just the collision we need to 
cause the specified catastrophe.
+"So, until information becomes more abundant, I plump for a sea unicorn of 
colossal dimensions, no longer armed with a mere lance but with an actual spur, 
like ironclad frigates or those warships called 'rams,' whose mass and motor 
power it would possess simultaneously.
+"This inexplicable phenomenon is thus explained away--unless it's something 
else entirely, which, despite everything that has been sighted, studied, 
explored and experienced, is still possible!"


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/20k_c2.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.afm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.afm 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.afm 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,275 @@
+StartFontMetrics 4.1
+FontName Calligrapher-Regular
+FullName Calligrapher Regular
+Notice Generated by Fontographer 3.5
+EncodingScheme FontSpecific
+FamilyName Calligrapher
+Weight Regular
+Version (Altsys Fontographer 3.5  5/26/92)
+Characters 215
+ItalicAngle 0.0
+Ascender 899
+Descender -234
+UnderlineThickness 20
+UnderlinePosition -200
+IsFixedPitch false
+FontBBox -50 -234 1328 899
+StartCharMetrics 256
+C 0 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 1 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 2 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 3 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 4 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 5 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 6 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 7 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 8 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 9 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 10 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 11 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 12 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 13 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 14 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 15 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 16 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 17 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 18 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 19 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 20 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 21 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 22 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 23 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 24 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 25 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 26 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 27 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 28 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 29 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 30 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 31 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 32 ; WX 282 ; N space ; B 67 -16 251 718 ;
+C 33 ; WX 324 ; N exclam ; B 67 -16 251 718 ;
+C 34 ; WX 405 ; N quotedbl ; B 60 460 353 718 ;
+C 35 ; WX 584 ; N numbersign ; B 35 0 549 701 ;
+C 36 ; WX 632 ; N dollar ; B 32 -126 595 814 ;
+C 37 ; WX 980 ; N percent ; B 35 -16 945 703 ;
+C 38 ; WX 776 ; N ampersand ; B 41 -17 811 670 ;
+C 39 ; WX 259 ; N quotesingle ; B 72 460 206 718 ;
+C 40 ; WX 299 ; N parenleft ; B 57 -119 299 785 ;
+C 41 ; WX 299 ; N parenright ; B 0 -119 242 785 ;
+C 42 ; WX 377 ; N asterisk ; B 35 407 342 714 ;
+C 43 ; WX 600 ; N plus ; B 47 0 553 506 ;
+C 44 ; WX 259 ; N comma ; B 35 -67 224 162 ;
+C 45 ; WX 432 ; N hyphen ; B 28 249 404 377 ;
+C 46 ; WX 254 ; N period ; B 43 -16 227 162 ;
+C 47 ; WX 597 ; N slash ; B 7 -14 591 714 ;
+C 48 ; WX 529 ; N zero ; B 21 -18 508 583 ;
+C 49 ; WX 298 ; N one ; B 8 -15 233 582 ;
+C 50 ; WX 451 ; N two ; B 17 -8 430 588 ;
+C 51 ; WX 359 ; N three ; B 11 -54 337 582 ;
+C 52 ; WX 525 ; N four ; B 18 -20 519 602 ;
+C 53 ; WX 423 ; N five ; B 10 -55 420 582 ;
+C 54 ; WX 464 ; N six ; B 23 -14 447 589 ;
+C 55 ; WX 417 ; N seven ; B 8 -18 415 589 ;
+C 56 ; WX 457 ; N eight ; B 19 -16 432 583 ;
+C 57 ; WX 479 ; N nine ; B 26 -16 450 588 ;
+C 58 ; WX 275 ; N colon ; B 59 -16 242 491 ;
+C 59 ; WX 282 ; N semicolon ; B 54 -67 245 491 ;
+C 60 ; WX 600 ; N less ; B 47 -8 553 514 ;
+C 61 ; WX 600 ; N equal ; B 47 98 553 408 ;
+C 62 ; WX 600 ; N greater ; B 47 -8 553 514 ;
+C 63 ; WX 501 ; N question ; B 21 -16 473 721 ;
+C 64 ; WX 800 ; N at ; B 29 -12 771 730 ;
+C 65 ; WX 743 ; N A ; B -23 -14 754 723 ;
+C 66 ; WX 636 ; N B ; B -42 -7 608 706 ;
+C 67 ; WX 598 ; N C ; B 27 -12 572 712 ;
+C 68 ; WX 712 ; N D ; B -42 -11 684 705 ;
+C 69 ; WX 608 ; N E ; B -21 0 608 708 ;
+C 70 ; WX 562 ; N F ; B -21 -18 584 716 ;
+C 71 ; WX 680 ; N G ; B 29 -8 668 714 ;
+C 72 ; WX 756 ; N H ; B 70 -17 777 728 ;
+C 73 ; WX 308 ; N I ; B 14 -15 238 718 ;
+C 74 ; WX 314 ; N J ; B 7 -223 244 727 ;
+C 75 ; WX 676 ; N K ; B 14 -16 683 725 ;
+C 76 ; WX 552 ; N L ; B 14 -8 580 713 ;
+C 77 ; WX 1041 ; N M ; B 42 -17 1017 739 ;
+C 78 ; WX 817 ; N N ; B -42 -17 747 736 ;
+C 79 ; WX 729 ; N O ; B 32 -16 698 709 ;
+C 80 ; WX 569 ; N P ; B -35 -15 570 716 ;
+C 81 ; WX 698 ; N Q ; B 27 -201 1328 715 ;
+C 82 ; WX 674 ; N R ; B -35 -20 696 712 ;
+C 83 ; WX 618 ; N S ; B 31 -16 589 709 ;
+C 84 ; WX 673 ; N T ; B -21 -20 702 714 ;
+C 85 ; WX 805 ; N U ; B 0 -19 804 722 ;
+C 86 ; WX 753 ; N V ; B -28 -20 788 729 ;
+C 87 ; WX 1238 ; N W ; B -28 -17 1273 736 ;
+C 88 ; WX 716 ; N X ; B 7 -38 709 731 ;
+C 89 ; WX 754 ; N Y ; B -35 -17 789 747 ;
+C 90 ; WX 599 ; N Z ; B 30 -5 584 748 ;
+C 91 ; WX 315 ; N bracketleft ; B 93 -124 322 718 ;
+C 92 ; WX 463 ; N backslash ; B -21 -18 484 736 ;
+C 93 ; WX 315 ; N bracketright ; B -7 -124 222 718 ;
+C 94 ; WX 600 ; N asciicircum ; B 63 266 537 658 ;
+C 95 ; WX 547 ; N underscore ; B -7 -198 554 -163 ;
+C 96 ; WX 278 ; N grave ; B -1 541 214 693 ;
+C 97 ; WX 581 ; N a ; B 21 -16 581 494 ;
+C 98 ; WX 564 ; N b ; B -24 -17 543 793 ;
+C 99 ; WX 440 ; N c ; B 21 -17 422 490 ;
+C 100 ; WX 571 ; N d ; B 0 -15 550 659 ;
+C 101 ; WX 450 ; N e ; B 28 -23 428 493 ;
+C 102 ; WX 347 ; N f ; B -35 -14 474 785 ;
+C 103 ; WX 628 ; N g ; B 19 -219 612 496 ;
+C 104 ; WX 611 ; N h ; B -29 -18 569 785 ;
+C 105 ; WX 283 ; N i ; B -14 -15 241 679 ;
+C 106 ; WX 283 ; N j ; B -14 -234 241 679 ;
+C 107 ; WX 560 ; N k ; B -24 -15 582 789 ;
+C 108 ; WX 252 ; N l ; B -28 -15 210 789 ;
+C 109 ; WX 976 ; N m ; B -21 -16 927 494 ;
+C 110 ; WX 595 ; N n ; B -28 -15 574 493 ;
+C 111 ; WX 508 ; N o ; B 27 -17 485 490 ;
+C 112 ; WX 549 ; N p ; B -28 -216 526 496 ;
+C 113 ; WX 540 ; N q ; B 28 -219 491 493 ;
+C 114 ; WX 395 ; N r ; B -21 -19 430 492 ;
+C 115 ; WX 441 ; N s ; B 34 -15 413 493 ;
+C 116 ; WX 307 ; N t ; B -21 -16 378 621 ;
+C 117 ; WX 614 ; N u ; B -14 -18 558 501 ;
+C 118 ; WX 556 ; N v ; B -28 -20 569 483 ;
+C 119 ; WX 915 ; N w ; B -28 -17 928 495 ;
+C 120 ; WX 559 ; N x ; B 14 -17 546 500 ;
+C 121 ; WX 597 ; N y ; B -21 -227 541 500 ;
+C 122 ; WX 452 ; N z ; B 28 -5 442 515 ;
+C 123 ; WX 315 ; N braceleft ; B 6 -118 309 718 ;
+C 124 ; WX 222 ; N bar ; B 63 -18 159 730 ;
+C 125 ; WX 315 ; N braceright ; B 6 -118 309 718 ;
+C 126 ; WX 600 ; N asciitilde ; B 69 166 531 340 ;
+C 127 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 128 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 129 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 130 ; WX 0 ; N quotesinglbase ; B -23 -14 754 877 ;
+C 131 ; WX 0 ; N florin ; B 0 -19 804 854 ;
+C 132 ; WX 0 ; N quotedblbase ; B -23 -14 754 877 ;
+C 133 ; WX 780 ; N ellipsis ; B 43 -16 747 162 ;
+C 134 ; WX 0 ; N dagger ; B 27 -122 437 592 ;
+C 135 ; WX 0 ; N daggerdbl ; B 43 278 227 456 ;
+C 136 ; WX 278 ; N circumflex ; B -14 557 292 677 ;
+C 137 ; WX 0 ; N perthousand ; B -23 -14 754 877 ;
+C 138 ; WX 0 ; N Scaron ; B 0 0 0 100 ;
+C 139 ; WX 0 ; N guilsinglleft ; B 43 278 227 456 ;
+C 140 ; WX 1064 ; N OE ; B 32 -16 1055 709 ;
+C 141 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 142 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 143 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 144 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 145 ; WX 259 ; N quoteleft ; B 35 489 224 717 ;
+C 146 ; WX 259 ; N quoteright ; B 35 489 224 717 ;
+C 147 ; WX 470 ; N quotedblleft ; B 35 489 443 717 ;
+C 148 ; WX 470 ; N quotedblright ; B 35 487 443 717 ;
+C 149 ; WX 500 ; N bullet ; B 70 179 430 539 ;
+C 150 ; WX 300 ; N endash ; B 0 245 300 350 ;
+C 151 ; WX 600 ; N emdash ; B 0 245 600 350 ;
+C 152 ; WX 278 ; N tilde ; B -44 563 326 689 ;
+C 153 ; WX 990 ; N trademark ; B 62 306 928 718 ;
+C 154 ; WX 0 ; N scaron ; B 0 0 0 100 ;
+C 155 ; WX 0 ; N guilsinglright ; B 43 278 227 456 ;
+C 156 ; WX 790 ; N oe ; B 27 -23 764 493 ;
+C 157 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 158 ; WX 800 ; N .notdef ; B 50 0 750 800 ;
+C 159 ; WX 754 ; N Ydieresis ; B -35 -17 789 882 ;
+C 160 ; WX 282 ; N nbspace ; B -23 -14 754 893 ;
+C 161 ; WX 324 ; N exclamdown ; B 69 -203 253 531 ;
+C 162 ; WX 450 ; N cent ; B 27 -122 437 592 ;
+C 163 ; WX 640 ; N sterling ; B 0 -9 619 716 ;
+C 164 ; WX 518 ; N currency ; B 3 72 515 586 ;
+C 165 ; WX 603 ; N yen ; B -28 -65 631 747 ;
+C 166 ; WX 0 ; N brokenbar ; B 0 0 0 100 ;
+C 167 ; WX 519 ; N section ; B -50 -216 524 762 ;
+C 168 ; WX 254 ; N dieresis ; B -20 554 308 682 ;
+C 169 ; WX 800 ; N copyright ; B 29 -12 771 730 ;
+C 170 ; WX 349 ; N ordfeminine ; B 13 385 349 717 ;
+C 171 ; WX 0 ; N guillemotleft ; B 43 -16 747 162 ;
+C 172 ; WX 0 ; N logicalnot ; B 30 0 730 700 ;
+C 173 ; WX 432 ; N hyphen ; B 28 249 404 377 ;
+C 174 ; WX 800 ; N registered ; B 29 -12 771 730 ;
+C 175 ; WX 278 ; N macron ; B -47 584 325 665 ;
+C 176 ; WX 0 ; N degree ; B 27 -122 437 592 ;
+C 177 ; WX 0 ; N plusminus ; B 29 -8 668 877 ;
+C 178 ; WX 0 ; N twosuperior ; B 0 0 0 100 ;
+C 179 ; WX 0 ; N threesuperior ; B 0 0 0 100 ;
+C 180 ; WX 278 ; N acute ; B 49 536 279 693 ;
+C 181 ; WX 614 ; N mu ; B -14 -231 558 501 ;
+C 182 ; WX 0 ; N paragraph ; B -35 -15 668 785 ;
+C 183 ; WX 254 ; N periodcentered ; B 43 278 227 456 ;
+C 184 ; WX 278 ; N cedilla ; B -8 -216 231 6 ;
+C 185 ; WX 0 ; N onesuperior ; B 0 0 0 100 ;
+C 186 ; WX 305 ; N ordmasculine ; B 16 373 291 702 ;
+C 187 ; WX 0 ; N guillemotright ; B 43 -16 747 162 ;
+C 188 ; WX 0 ; N onequarter ; B 0 0 0 100 ;
+C 189 ; WX 0 ; N onehalf ; B 0 0 0 100 ;
+C 190 ; WX 0 ; N threequarters ; B 0 0 0 100 ;
+C 191 ; WX 501 ; N questiondown ; B 15 -196 467 541 ;
+C 192 ; WX 743 ; N Agrave ; B -23 -14 754 893 ;
+C 193 ; WX 743 ; N Aacute ; B -23 -14 754 893 ;
+C 194 ; WX 743 ; N Acircumflex ; B -23 -14 754 877 ;
+C 195 ; WX 743 ; N Atilde ; B -23 -14 754 889 ;
+C 196 ; WX 743 ; N Adieresis ; B -23 -14 754 882 ;
+C 197 ; WX 743 ; N Aring ; B -23 -14 754 899 ;
+C 198 ; WX 1060 ; N AE ; B -29 -14 1053 708 ;
+C 199 ; WX 598 ; N Ccedilla ; B 27 -183 572 712 ;
+C 200 ; WX 608 ; N Egrave ; B -21 0 608 893 ;
+C 201 ; WX 608 ; N Eacute ; B -21 0 608 893 ;
+C 202 ; WX 608 ; N Ecircumflex ; B -21 0 608 877 ;
+C 203 ; WX 608 ; N Edieresis ; B -21 0 608 882 ;
+C 204 ; WX 308 ; N Igrave ; B 14 -15 264 893 ;
+C 205 ; WX 308 ; N Iacute ; B 14 -15 274 893 ;
+C 206 ; WX 308 ; N Icircumflex ; B 1 -15 307 877 ;
+C 207 ; WX 308 ; N Idieresis ; B -15 -15 313 882 ;
+C 208 ; WX 0 ; N Eth ; B 0 0 0 100 ;
+C 209 ; WX 817 ; N Ntilde ; B -42 -17 747 889 ;
+C 210 ; WX 729 ; N Ograve ; B 32 -16 698 893 ;
+C 211 ; WX 729 ; N Oacute ; B 32 -16 698 893 ;
+C 212 ; WX 729 ; N Ocircumflex ; B 32 -16 698 877 ;
+C 213 ; WX 729 ; N Otilde ; B 32 -16 698 889 ;
+C 214 ; WX 729 ; N Odieresis ; B 32 -16 698 882 ;
+C 215 ; WX 0 ; N multiply ; B 0 0 0 100 ;
+C 216 ; WX 729 ; N Oslash ; B 14 -24 724 709 ;
+C 217 ; WX 805 ; N Ugrave ; B 0 -19 804 893 ;
+C 218 ; WX 805 ; N Uacute ; B 0 -19 804 893 ;
+C 219 ; WX 805 ; N Ucircumflex ; B 0 -19 804 877 ;
+C 220 ; WX 805 ; N Udieresis ; B 0 -19 804 882 ;
+C 221 ; WX 0 ; N _235 ; B 0 0 0 100 ;
+C 222 ; WX 0 ; N Thorn ; B 0 0 0 100 ;
+C 223 ; WX 688 ; N germandbls ; B -35 -15 668 785 ;
+C 224 ; WX 581 ; N agrave ; B 21 -16 581 693 ;
+C 225 ; WX 581 ; N aacute ; B 21 -16 581 693 ;
+C 226 ; WX 581 ; N acircumflex ; B 21 -16 581 677 ;
+C 227 ; WX 581 ; N atilde ; B 21 -16 581 689 ;
+C 228 ; WX 581 ; N adieresis ; B 21 -16 581 682 ;
+C 229 ; WX 581 ; N aring ; B 21 -16 581 734 ;
+C 230 ; WX 792 ; N ae ; B 21 -23 773 494 ;
+C 231 ; WX 440 ; N ccedilla ; B 21 -183 422 490 ;
+C 232 ; WX 450 ; N egrave ; B 28 -23 428 693 ;
+C 233 ; WX 450 ; N eacute ; B 28 -23 428 693 ;
+C 234 ; WX 450 ; N ecircumflex ; B 28 -23 432 677 ;
+C 235 ; WX 450 ; N edieresis ; B 28 -23 428 682 ;
+C 236 ; WX 283 ; N igrave ; B -14 -15 244 693 ;
+C 237 ; WX 283 ; N iacute ; B -14 -15 269 693 ;
+C 238 ; WX 283 ; N icircumflex ; B -14 -15 297 677 ;
+C 239 ; WX 283 ; N idieresis ; B -25 -15 303 682 ;
+C 240 ; WX 0 ; N Yacute ; B 0 0 0 100 ;
+C 241 ; WX 595 ; N ntilde ; B -28 -15 574 689 ;
+C 242 ; WX 508 ; N ograve ; B 27 -17 485 693 ;
+C 243 ; WX 508 ; N oacute ; B 27 -17 485 693 ;
+C 244 ; WX 508 ; N ocircumflex ; B 27 -17 485 677 ;
+C 245 ; WX 508 ; N otilde ; B 27 -17 485 689 ;
+C 246 ; WX 508 ; N odieresis ; B 27 -17 485 682 ;
+C 247 ; WX 0 ; N divide ; B 35 0 760 727 ;
+C 248 ; WX 508 ; N oslash ; B -8 -54 496 589 ;
+C 249 ; WX 614 ; N ugrave ; B -14 -18 558 693 ;
+C 250 ; WX 614 ; N uacute ; B -14 -18 558 693 ;
+C 251 ; WX 614 ; N ucircumflex ; B -14 -18 558 677 ;
+C 252 ; WX 614 ; N udieresis ; B -14 -18 558 682 ;
+C 253 ; WX 0 ; N yacute ; B 0 0 0 100 ;
+C 254 ; WX 0 ; N thorn ; B 0 0 0 100 ;
+C 255 ; WX 597 ; N ydieresis ; B -21 -227 541 682 ;
+EndCharMetrics
+EndFontMetrics

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.php 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.php 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,24 @@
+<?php
+$type='TrueType';
+$name='Calligrapher-Regular';
+$desc=array('Ascent'=>899,'Descent'=>-234,'CapHeight'=>731,'Flags'=>32,'FontBBox'=>'[-50
 -234 1328 899]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>800);
+$up=-200;
+$ut=20;
+$cw=array(
+       
chr(0)=>800,chr(1)=>800,chr(2)=>800,chr(3)=>800,chr(4)=>800,chr(5)=>800,chr(6)=>800,chr(7)=>800,chr(8)=>800,chr(9)=>800,chr(10)=>800,chr(11)=>800,chr(12)=>800,chr(13)=>800,chr(14)=>800,chr(15)=>800,chr(16)=>800,chr(17)=>800,chr(18)=>800,chr(19)=>800,chr(20)=>800,chr(21)=>800,
+       
chr(22)=>800,chr(23)=>800,chr(24)=>800,chr(25)=>800,chr(26)=>800,chr(27)=>800,chr(28)=>800,chr(29)=>800,chr(30)=>800,chr(31)=>800,'
 
'=>282,'!'=>324,'"'=>405,'#'=>584,'$'=>632,'%'=>980,'&'=>776,'\''=>259,'('=>299,')'=>299,'*'=>377,'+'=>600,
+       
','=>259,'-'=>432,'.'=>254,'/'=>597,'0'=>529,'1'=>298,'2'=>451,'3'=>359,'4'=>525,'5'=>423,'6'=>464,'7'=>417,'8'=>457,'9'=>479,':'=>275,';'=>282,'<'=>600,'='=>600,'>'=>600,'?'=>501,'@'=>800,'A'=>743,
+       
'B'=>636,'C'=>598,'D'=>712,'E'=>608,'F'=>562,'G'=>680,'H'=>756,'I'=>308,'J'=>314,'K'=>676,'L'=>552,'M'=>1041,'N'=>817,'O'=>729,'P'=>569,'Q'=>698,'R'=>674,'S'=>618,'T'=>673,'U'=>805,'V'=>753,'W'=>1238,
+       
'X'=>716,'Y'=>754,'Z'=>599,'['=>315,'\\'=>463,']'=>315,'^'=>600,'_'=>547,'`'=>278,'a'=>581,'b'=>564,'c'=>440,'d'=>571,'e'=>450,'f'=>347,'g'=>628,'h'=>611,'i'=>283,'j'=>283,'k'=>560,'l'=>252,'m'=>976,
+       
'n'=>595,'o'=>508,'p'=>549,'q'=>540,'r'=>395,'s'=>441,'t'=>307,'u'=>614,'v'=>556,'w'=>915,'x'=>559,'y'=>597,'z'=>452,'{'=>315,'|'=>222,'}'=>315,'~'=>600,chr(127)=>800,chr(128)=>800,chr(129)=>800,chr(130)=>0,chr(131)=>0,
+       
chr(132)=>0,chr(133)=>780,chr(134)=>0,chr(135)=>0,chr(136)=>278,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>1064,chr(141)=>800,chr(142)=>800,chr(143)=>800,chr(144)=>800,chr(145)=>259,chr(146)=>259,chr(147)=>470,chr(148)=>470,chr(149)=>500,chr(150)=>300,chr(151)=>600,chr(152)=>278,chr(153)=>990,
+       
chr(154)=>0,chr(155)=>0,chr(156)=>790,chr(157)=>800,chr(158)=>800,chr(159)=>754,chr(160)=>282,chr(161)=>324,chr(162)=>450,chr(163)=>640,chr(164)=>518,chr(165)=>603,chr(166)=>0,chr(167)=>519,chr(168)=>254,chr(169)=>800,chr(170)=>349,chr(171)=>0,chr(172)=>0,chr(173)=>432,chr(174)=>800,chr(175)=>278,
+       
chr(176)=>0,chr(177)=>0,chr(178)=>0,chr(179)=>0,chr(180)=>278,chr(181)=>614,chr(182)=>0,chr(183)=>254,chr(184)=>278,chr(185)=>0,chr(186)=>305,chr(187)=>0,chr(188)=>0,chr(189)=>0,chr(190)=>0,chr(191)=>501,chr(192)=>743,chr(193)=>743,chr(194)=>743,chr(195)=>743,chr(196)=>743,chr(197)=>743,
+       
chr(198)=>1060,chr(199)=>598,chr(200)=>608,chr(201)=>608,chr(202)=>608,chr(203)=>608,chr(204)=>308,chr(205)=>308,chr(206)=>308,chr(207)=>308,chr(208)=>0,chr(209)=>817,chr(210)=>729,chr(211)=>729,chr(212)=>729,chr(213)=>729,chr(214)=>729,chr(215)=>0,chr(216)=>729,chr(217)=>805,chr(218)=>805,chr(219)=>805,
+       
chr(220)=>805,chr(221)=>0,chr(222)=>0,chr(223)=>688,chr(224)=>581,chr(225)=>581,chr(226)=>581,chr(227)=>581,chr(228)=>581,chr(229)=>581,chr(230)=>792,chr(231)=>440,chr(232)=>450,chr(233)=>450,chr(234)=>450,chr(235)=>450,chr(236)=>283,chr(237)=>283,chr(238)=>283,chr(239)=>283,chr(240)=>800,chr(241)=>595,
+       
chr(242)=>508,chr(243)=>508,chr(244)=>508,chr(245)=>508,chr(246)=>508,chr(247)=>0,chr(248)=>508,chr(249)=>614,chr(250)=>614,chr(251)=>614,chr(252)=>614,chr(253)=>0,chr(254)=>0,chr(255)=>597);
+$enc='cp1252';
+$diff='';
+$file='calligra.z';
+$originalsize=40120;
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.ttf
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.ttf
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.z
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/calligra.z
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/countries.txt
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/countries.txt
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/countries.txt
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,15 @@
+Austria;Vienna;83859;8075
+Belgium;Brussels;30518;10192
+Denmark;Copenhagen;43094;5295
+Finland;Helsinki;304529;5147
+France;Paris;543965;58728
+Germany;Berlin;357022;82057
+Greece;Athens;131625;10511
+Ireland;Dublin;70723;3694
+Italy;Roma;301316;57563
+Luxembourg;Luxembourg;2586;424
+Netherlands;Amsterdam;41526;15654
+Portugal;Lisbon;91906;9957
+Spain;Madrid;504790;39348
+Sweden;Stockholm;410934;8839
+United Kingdom;London;243820;58862


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/countries.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/index.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/index.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/index.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tutorials</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Tutorials</h1>
+<p>The different examples rapidly show how to use FPDF. You will find all main 
features explained.</p>
+<ul style="list-style-type:none; margin-left:0; padding-left:0">
+<li><a href="tuto1.htm">Tutorial 1</a>: Minimal example</li>
+<li><a href="tuto2.htm">Tutorial 2</a>: Header, footer, page break and 
image</li>
+<li><a href="tuto3.htm">Tutorial 3</a>: Line breaks and colors</li>
+<li><a href="tuto4.htm">Tutorial 4</a>: Multi-columns</li>
+<li><a href="tuto5.htm">Tutorial 5</a>: Tables</li>
+<li><a href="tuto6.htm">Tutorial 6</a>: Links and flowing text</li>
+<li><a href="tuto7.htm">Tutorial 7</a>: Adding new fonts and encoding 
support</li>
+</UL>
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/logo.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/logo.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/logo_pb.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/logo_pb.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/makefont.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/makefont.php 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/makefont.php 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,6 @@
+<?php
+//Generation of font definition file for tutorial 7
+require('../font/makefont/makefont.php');
+
+MakeFont('calligra.ttf','calligra.afm');
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/makefont.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,77 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Minimal example</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Minimal example</h1>
+Let's start with the classic example:
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span class="str">'fpdf.php'</span><span 
class="kw">);
+
+</span>$pdf<span class="kw">=new </span>FPDF<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>SetFont<span class="kw">(</span><span 
class="str">'Arial'</span><span class="kw">,</span><span 
class="str">'B'</span><span class="kw">,</span>16<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Cell<span class="kw">(</span>40<span 
class="kw">,</span>10<span class="kw">,</span><span class="str">'Hello 
World!'</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Output<span class="kw">();
+</span>?&gt;</code></pre>
+</div>
+<p class='demo'><a href='tuto1.php' target='_blank' class='demo'>[Demo]</a></p>
+After including the library file, we create an FPDF object.
+The <a href='../doc/fpdf.htm'>FPDF()</a> constructor is used here with the 
default values: pages are in A4 portrait and
+the unit of measure is millimeter. It could have been specified explicitly 
with:
+<div class="source">
+<pre><code>$pdf<span class="kw">=new </span>FPDF<span class="kw">(</span><span 
class="str">'P'</span><span class="kw">,</span><span 
class="str">'mm'</span><span class="kw">,</span><span 
class="str">'A4'</span><span class="kw">);
+</span></code></pre>
+</div>
+It is possible to use landscape (<code>L</code>), other page formats (such as 
<code>Letter</code> and
+<code>Legal</code>) and units of measure (<code>pt</code>, <code>cm</code>, 
<code>in</code>).
+<br>
+<br>
+There is no page for the moment, so we have to add one with <a 
href='../doc/addpage.htm'>AddPage()</a>. The origin
+is at the upper-left corner and the current position is by default placed at 1 
cm from the
+borders; the margins can be changed with <a 
href='../doc/setmargins.htm'>SetMargins()</a>.
+<br>
+<br>
+Before we can print text, it is mandatory to select a font with <a 
href='../doc/setfont.htm'>SetFont()</a>, otherwise the
+document would be invalid. We choose Arial bold 16:
+<div class="source">
+<pre><code>$pdf<span class="kw">-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">'B'</span><span class="kw">,</span>16<span 
class="kw">);
+</span></code></pre>
+</div>
+We could have specified italics with I, underlined with U or a regular font 
with an empty string
+(or any combination). Note that the font size is given in points, not 
millimeters (or another
+user unit); it is the only exception. The other standard fonts are Times, 
Courier, Symbol and
+ZapfDingbats.
+<br>
+<br>
+We can now print a cell with <a href='../doc/cell.htm'>Cell()</a>. A cell is a 
rectangular area, possibly framed,
+which contains a line of text. It is output at the current position. We 
specify its dimensions,
+its text (centered or aligned), if borders should be drawn, and where the 
current position
+moves after it (to the right, below or to the beginning of the next line). To 
add a frame, we would do this:
+<div class="source">
+<pre><code>$pdf<span class="kw">-&gt;</span>Cell<span 
class="kw">(</span>40<span class="kw">,</span>10<span class="kw">,</span><span 
class="str">'Hello World !'</span><span class="kw">,</span>1<span class="kw">);
+</span></code></pre>
+</div>
+To add a new cell next to it with centered text and go to the next line, we 
would do:
+<div class="source">
+<pre><code>$pdf<span class="kw">-&gt;</span>Cell<span 
class="kw">(</span>60<span class="kw">,</span>10<span class="kw">,</span><span 
class="str">'Powered by FPDF.'</span><span class="kw">,</span>0<span 
class="kw">,</span>1<span class="kw">,</span><span class="str">'C'</span><span 
class="kw">);
+</span></code></pre>
+</div>
+Remark: the line break can also be done with <a href='../doc/ln.htm'>Ln()</a>. 
This method additionnaly allows to specify
+the height of the break.
+<br>
+<br>
+Finally, the document is closed and sent to the browser with <a 
href='../doc/output.htm'>Output()</a>. We could have saved
+it to a file by passing the desired file name.
+<br>
+<br>
+<strong>Caution:</strong> in case when the PDF is sent to the browser, nothing 
else must be output by the
+script, neither before nor after (no HTML, not even a space or a carriage 
return). If you send something
+before, you will get the error message: "Some data has already been output, 
can't send PDF file". If you
+send something after, the document might not display.
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,9 @@
+<?php
+require('../fpdf.php');
+
+$pdf=new FPDF();
+$pdf->AddPage();
+$pdf->SetFont('Arial','B',16);
+$pdf->Cell(40,10,'Hello World!');
+$pdf->Output();
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto1.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,80 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Header, footer, page break and image</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Header, footer, page break and image</h1>
+Here is a two page example with header, footer and logo:
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span class="str">'fpdf.php'</span><span 
class="kw">);
+
+class </span>PDF <span class="kw">extends </span>FPDF
+<span class="kw">{
+</span><span class="cmt">//Page header
+</span><span class="kw">function </span>Header<span class="kw">()
+{
+    </span><span class="cmt">//Logo
+    </span>$<span class="kw">this-&gt;</span>Image<span 
class="kw">(</span><span class="str">'logo_pb.png'</span><span 
class="kw">,</span>10<span class="kw">,</span>8<span class="kw">,</span>33<span 
class="kw">);
+    </span><span class="cmt">//Arial bold 15
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">'B'</span><span class="kw">,</span>15<span 
class="kw">);
+    </span><span class="cmt">//Move to the right
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>80<span class="kw">);
+    </span><span class="cmt">//Title
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>30<span class="kw">,</span>10<span class="kw">,</span><span 
class="str">'Title'</span><span class="kw">,</span>1<span 
class="kw">,</span>0<span class="kw">,</span><span class="str">'C'</span><span 
class="kw">);
+    </span><span class="cmt">//Line break
+    </span>$<span class="kw">this-&gt;</span>Ln<span 
class="kw">(</span>20<span class="kw">);
+}
+
+</span><span class="cmt">//Page footer
+</span><span class="kw">function </span>Footer<span class="kw">()
+{
+    </span><span class="cmt">//Position at 1.5 cm from bottom
+    </span>$<span class="kw">this-&gt;</span>SetY<span 
class="kw">(-</span>15<span class="kw">);
+    </span><span class="cmt">//Arial italic 8
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">'I'</span><span class="kw">,</span>8<span 
class="kw">);
+    </span><span class="cmt">//Page number
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>10<span class="kw">,</span><span 
class="str">'Page '</span><span class="kw">.</span>$<span 
class="kw">this-&gt;</span>PageNo<span class="kw">().</span><span 
class="str">'/{nb}'</span><span class="kw">,</span>0<span 
class="kw">,</span>0<span class="kw">,</span><span class="str">'C'</span><span 
class="kw">);
+}
+}
+
+</span><span class="cmt">//Instanciation of inherited class
+</span>$pdf<span class="kw">=new </span>PDF<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>AliasNbPages<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>SetFont<span class="kw">(</span><span 
class="str">'Times'</span><span class="kw">,</span><span 
class="str">''</span><span class="kw">,</span>12<span class="kw">);
+for(</span>$i<span class="kw">=</span>1<span class="kw">;</span>$i<span 
class="kw">&lt;=</span>40<span class="kw">;</span>$i<span class="kw">++)
+    </span>$pdf<span class="kw">-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>10<span class="kw">,</span><span 
class="str">'Printing line number '</span><span class="kw">.</span>$i<span 
class="kw">,</span>0<span class="kw">,</span>1<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Output<span class="kw">();
+</span>?&gt;</code></pre>
+</div>
+<p class='demo'><a href='tuto2.php' target='_blank' class='demo'>[Demo]</a></p>
+This example makes use of the <a href='../doc/header.htm'>Header()</a> and <a 
href='../doc/footer.htm'>Footer()</a> methods to process page headers and
+footers. They are called automatically. They already exist in the FPDF class 
but do nothing,
+therefore we have to extend the class and override them.
+<br>
+<br>
+The logo is printed with the <a href='../doc/image.htm'>Image()</a> method by 
specifying its upper-left corner and
+its width. The height is calculated automatically to respect the image 
proportions.
+<br>
+<br>
+To print the page number, a null value is passed as the cell width. It means 
that the cell
+should extend up to the right margin of the page; it is handy to center text. 
The current page
+number is returned by the <a href='../doc/pageno.htm'>PageNo()</a> method; as 
for the total number of pages, it is obtained
+by means of the special value <code>{nb}</code> which will be substituted on 
document closure
+(provided you first called <a 
href='../doc/aliasnbpages.htm'>AliasNbPages()</a>).
+<br>
+Note the use of the <a href='../doc/sety.htm'>SetY()</a> method which allows 
to set position at an absolute location in
+the page, starting from the top or the bottom.
+<br>
+<br>
+Another interesting feature is used here: the automatic page breaking. As soon 
as a cell would
+cross a limit in the page (at 2 centimeters from the bottom by default), a 
break is performed
+and the font restored. Although the header and footer select their own font 
(Arial), the body
+continues with Times. This mechanism of automatic restoration also applies to 
colors and line
+width. The limit which triggers page breaks can be set with <a 
href='../doc/setautopagebreak.htm'>SetAutoPageBreak()</a>.
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,41 @@
+<?php
+require('../fpdf.php');
+
+class PDF extends FPDF
+{
+//Page header
+function Header()
+{
+       //Logo
+       $this->Image('logo_pb.png',10,8,33);
+       //Arial bold 15
+       $this->SetFont('Arial','B',15);
+       //Move to the right
+       $this->Cell(80);
+       //Title
+       $this->Cell(30,10,'Title',1,0,'C');
+       //Line break
+       $this->Ln(20);
+}
+
+//Page footer
+function Footer()
+{
+       //Position at 1.5 cm from bottom
+       $this->SetY(-15);
+       //Arial italic 8
+       $this->SetFont('Arial','I',8);
+       //Page number
+       $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
+}
+}
+
+//Instanciation of inherited class
+$pdf=new PDF();
+$pdf->AliasNbPages();
+$pdf->AddPage();
+$pdf->SetFont('Times','',12);
+for($i=1;$i<=40;$i++)
+       $pdf->Cell(0,10,'Printing line number '.$i,0,1);
+$pdf->Output();
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto2.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,116 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Line breaks and colors</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Line breaks and colors</h1>
+Let's continue with an example which prints justified paragraphs. It also 
illustrates the use
+of colors.
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span class="str">'fpdf.php'</span><span 
class="kw">);
+
+class </span>PDF <span class="kw">extends </span>FPDF
+<span class="kw">{
+function </span>Header<span class="kw">()
+{
+    global </span>$title<span class="kw">;
+
+    </span><span class="cmt">//Arial bold 15
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">'B'</span><span class="kw">,</span>15<span 
class="kw">);
+    </span><span class="cmt">//Calculate width of title and position
+    </span>$w<span class="kw">=</span>$<span 
class="kw">this-&gt;</span>GetStringWidth<span class="kw">(</span>$title<span 
class="kw">)+</span>6<span class="kw">;
+    </span>$<span class="kw">this-&gt;</span>SetX<span 
class="kw">((</span>210<span class="kw">-</span>$w<span 
class="kw">)/</span>2<span class="kw">);
+    </span><span class="cmt">//Colors of frame, background and text
+    </span>$<span class="kw">this-&gt;</span>SetDrawColor<span 
class="kw">(</span>0<span class="kw">,</span>80<span 
class="kw">,</span>180<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetFillColor<span 
class="kw">(</span>230<span class="kw">,</span>230<span 
class="kw">,</span>0<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>220<span class="kw">,</span>50<span 
class="kw">,</span>50<span class="kw">);
+    </span><span class="cmt">//Thickness of frame (1 mm)
+    </span>$<span class="kw">this-&gt;</span>SetLineWidth<span 
class="kw">(</span>1<span class="kw">);
+    </span><span class="cmt">//Title
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">,</span>9<span 
class="kw">,</span>$title<span class="kw">,</span>1<span 
class="kw">,</span>1<span class="kw">,</span><span class="str">'C'</span><span 
class="kw">,</span>true<span class="kw">);
+    </span><span class="cmt">//Line break
+    </span>$<span class="kw">this-&gt;</span>Ln<span 
class="kw">(</span>10<span class="kw">);
+}
+
+function </span>Footer<span class="kw">()
+{
+    </span><span class="cmt">//Position at 1.5 cm from bottom
+    </span>$<span class="kw">this-&gt;</span>SetY<span 
class="kw">(-</span>15<span class="kw">);
+    </span><span class="cmt">//Arial italic 8
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">'I'</span><span class="kw">,</span>8<span 
class="kw">);
+    </span><span class="cmt">//Text color in gray
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>128<span class="kw">);
+    </span><span class="cmt">//Page number
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>10<span class="kw">,</span><span 
class="str">'Page '</span><span class="kw">.</span>$<span 
class="kw">this-&gt;</span>PageNo<span class="kw">(),</span>0<span 
class="kw">,</span>0<span class="kw">,</span><span class="str">'C'</span><span 
class="kw">);
+}
+
+function </span>ChapterTitle<span class="kw">(</span>$num<span 
class="kw">,</span>$label<span class="kw">)
+{
+    </span><span class="cmt">//Arial 12
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">''</span><span class="kw">,</span>12<span 
class="kw">);
+    </span><span class="cmt">//Background color
+    </span>$<span class="kw">this-&gt;</span>SetFillColor<span 
class="kw">(</span>200<span class="kw">,</span>220<span 
class="kw">,</span>255<span class="kw">);
+    </span><span class="cmt">//Title
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>6<span class="kw">,</span><span 
class="str">"Chapter $num : $label"</span><span class="kw">,</span>0<span 
class="kw">,</span>1<span class="kw">,</span><span class="str">'L'</span><span 
class="kw">,</span>true<span class="kw">);
+    </span><span class="cmt">//Line break
+    </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">(</span>4<span 
class="kw">);
+}
+
+function </span>ChapterBody<span class="kw">(</span>$file<span class="kw">)
+{
+    </span><span class="cmt">//Read text file
+    </span>$f<span class="kw">=</span>fopen<span class="kw">(</span>$file<span 
class="kw">,</span><span class="str">'r'</span><span class="kw">);
+    </span>$txt<span class="kw">=</span>fread<span class="kw">(</span>$f<span 
class="kw">,</span>filesize<span class="kw">(</span>$file<span class="kw">));
+    </span>fclose<span class="kw">(</span>$f<span class="kw">);
+    </span><span class="cmt">//Times 12
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Times'</span><span 
class="kw">,</span><span class="str">''</span><span class="kw">,</span>12<span 
class="kw">);
+    </span><span class="cmt">//Output justified text
+    </span>$<span class="kw">this-&gt;</span>MultiCell<span 
class="kw">(</span>0<span class="kw">,</span>5<span 
class="kw">,</span>$txt<span class="kw">);
+    </span><span class="cmt">//Line break
+    </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+    </span><span class="cmt">//Mention in italics
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">''</span><span class="kw">,</span><span 
class="str">'I'</span><span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>5<span class="kw">,</span><span 
class="str">'(end of excerpt)'</span><span class="kw">);
+}
+
+function </span>PrintChapter<span class="kw">(</span>$num<span 
class="kw">,</span>$title<span class="kw">,</span>$file<span class="kw">)
+{
+    </span>$<span class="kw">this-&gt;</span>AddPage<span class="kw">();
+    </span>$<span class="kw">this-&gt;</span>ChapterTitle<span 
class="kw">(</span>$num<span class="kw">,</span>$title<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>ChapterBody<span 
class="kw">(</span>$file<span class="kw">);
+}
+}
+
+</span>$pdf<span class="kw">=new </span>PDF<span class="kw">();
+</span>$title<span class="kw">=</span><span class="str">'20000 Leagues Under 
the Seas'</span><span class="kw">;
+</span>$pdf<span class="kw">-&gt;</span>SetTitle<span 
class="kw">(</span>$title<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>SetAuthor<span 
class="kw">(</span><span class="str">'Jules Verne'</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>PrintChapter<span 
class="kw">(</span>1<span class="kw">,</span><span class="str">'A RUNAWAY 
REEF'</span><span class="kw">,</span><span class="str">'20k_c1.txt'</span><span 
class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>PrintChapter<span 
class="kw">(</span>2<span class="kw">,</span><span class="str">'THE PROS AND 
CONS'</span><span class="kw">,</span><span class="str">'20k_c2.txt'</span><span 
class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Output<span class="kw">();
+</span>?&gt;</code></pre>
+</div>
+<p class='demo'><a href='tuto3.php' target='_blank' class='demo'>[Demo]</a></p>
+The <a href='../doc/getstringwidth.htm'>GetStringWidth()</a> method allows to 
determine the length of a string in the current font,
+which is used here to calculate the position and the width of the frame 
surrounding the title.
+Then colors are set (via <a href='../doc/setdrawcolor.htm'>SetDrawColor()</a>, 
<a href='../doc/setfillcolor.htm'>SetFillColor()</a> and <a 
href='../doc/settextcolor.htm'>SetTextColor()</a>) and the
+thickness of the line is set to 1 mm (against 0.2 by default) with <a 
href='../doc/setlinewidth.htm'>SetLineWidth()</a>. Finally,
+we output the cell (the last parameter to <code>true</code> indicates that the 
background must
+be filled).
+<br>
+<br>
+The method used to print the paragraphs is <a 
href='../doc/multicell.htm'>MultiCell()</a>. Each time a line reaches the
+right extremity of the cell or a carriage return character is met, a line 
break is issued
+and a new cell automatically created under the current one. Text is justified 
by default.
+<br>
+<br>
+Two document properties are defined: the title (<a 
href='../doc/settitle.htm'>SetTitle()</a>) and the author (<a 
href='../doc/setauthor.htm'>SetAuthor()</a>).
+Properties can be viewed by two means. First is to open the document directly 
with Acrobat Reader,
+go to the File menu and choose the Document Properties option. The second, 
also available from
+the plug-in, is to right-click and select Document Properties.
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,83 @@
+<?php
+require('../fpdf.php');
+
+class PDF extends FPDF
+{
+function Header()
+{
+       global $title;
+
+       //Arial bold 15
+       $this->SetFont('Arial','B',15);
+       //Calculate width of title and position
+       $w=$this->GetStringWidth($title)+6;
+       $this->SetX((210-$w)/2);
+       //Colors of frame, background and text
+       $this->SetDrawColor(0,80,180);
+       $this->SetFillColor(230,230,0);
+       $this->SetTextColor(220,50,50);
+       //Thickness of frame (1 mm)
+       $this->SetLineWidth(1);
+       //Title
+       $this->Cell($w,9,$title,1,1,'C',true);
+       //Line break
+       $this->Ln(10);
+}
+
+function Footer()
+{
+       //Position at 1.5 cm from bottom
+       $this->SetY(-15);
+       //Arial italic 8
+       $this->SetFont('Arial','I',8);
+       //Text color in gray
+       $this->SetTextColor(128);
+       //Page number
+       $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
+}
+
+function ChapterTitle($num,$label)
+{
+       //Arial 12
+       $this->SetFont('Arial','',12);
+       //Background color
+       $this->SetFillColor(200,220,255);
+       //Title
+       $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true);
+       //Line break
+       $this->Ln(4);
+}
+
+function ChapterBody($file)
+{
+       //Read text file
+       $f=fopen($file,'r');
+       $txt=fread($f,filesize($file));
+       fclose($f);
+       //Times 12
+       $this->SetFont('Times','',12);
+       //Output justified text
+       $this->MultiCell(0,5,$txt);
+       //Line break
+       $this->Ln();
+       //Mention in italics
+       $this->SetFont('','I');
+       $this->Cell(0,5,'(end of excerpt)');
+}
+
+function PrintChapter($num,$title,$file)
+{
+       $this->AddPage();
+       $this->ChapterTitle($num,$title);
+       $this->ChapterBody($file);
+}
+}
+
+$pdf=new PDF();
+$title='20000 Leagues Under the Seas';
+$pdf->SetTitle($title);
+$pdf->SetAuthor('Jules Verne');
+$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt');
+$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt');
+$pdf->Output();
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto3.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,136 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Multi-columns</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Multi-columns</h1>
+This example is a variant of the previous one showing how to lay the text 
across multiple
+columns.
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span class="str">'fpdf.php'</span><span 
class="kw">);
+
+class </span>PDF <span class="kw">extends </span>FPDF
+<span class="kw">{
+</span><span class="cmt">//Current column
+</span><span class="kw">var </span>$col<span class="kw">=</span>0<span 
class="kw">;
+</span><span class="cmt">//Ordinate of column start
+</span><span class="kw">var </span>$y0<span class="kw">;
+
+function </span>Header<span class="kw">()
+{
+    </span><span class="cmt">//Page header
+    </span><span class="kw">global </span>$title<span class="kw">;
+
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">'B'</span><span class="kw">,</span>15<span 
class="kw">);
+    </span>$w<span class="kw">=</span>$<span 
class="kw">this-&gt;</span>GetStringWidth<span class="kw">(</span>$title<span 
class="kw">)+</span>6<span class="kw">;
+    </span>$<span class="kw">this-&gt;</span>SetX<span 
class="kw">((</span>210<span class="kw">-</span>$w<span 
class="kw">)/</span>2<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetDrawColor<span 
class="kw">(</span>0<span class="kw">,</span>80<span 
class="kw">,</span>180<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetFillColor<span 
class="kw">(</span>230<span class="kw">,</span>230<span 
class="kw">,</span>0<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>220<span class="kw">,</span>50<span 
class="kw">,</span>50<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetLineWidth<span 
class="kw">(</span>1<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">,</span>9<span 
class="kw">,</span>$title<span class="kw">,</span>1<span 
class="kw">,</span>1<span class="kw">,</span><span class="str">'C'</span><span 
class="kw">,</span>true<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Ln<span 
class="kw">(</span>10<span class="kw">);
+    </span><span class="cmt">//Save ordinate
+    </span>$<span class="kw">this-&gt;</span>y0<span class="kw">=</span>$<span 
class="kw">this-&gt;</span>GetY<span class="kw">();
+}
+
+function </span>Footer<span class="kw">()
+{
+    </span><span class="cmt">//Page footer
+    </span>$<span class="kw">this-&gt;</span>SetY<span 
class="kw">(-</span>15<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">'I'</span><span class="kw">,</span>8<span 
class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>128<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>10<span class="kw">,</span><span 
class="str">'Page '</span><span class="kw">.</span>$<span 
class="kw">this-&gt;</span>PageNo<span class="kw">(),</span>0<span 
class="kw">,</span>0<span class="kw">,</span><span class="str">'C'</span><span 
class="kw">);
+}
+
+function </span>SetCol<span class="kw">(</span>$col<span class="kw">)
+{
+    </span><span class="cmt">//Set position at a given column
+    </span>$<span class="kw">this-&gt;</span>col<span 
class="kw">=</span>$col<span class="kw">;
+    </span>$x<span class="kw">=</span>10<span class="kw">+</span>$col<span 
class="kw">*</span>65<span class="kw">;
+    </span>$<span class="kw">this-&gt;</span>SetLeftMargin<span 
class="kw">(</span>$x<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetX<span 
class="kw">(</span>$x<span class="kw">);
+}
+
+function </span>AcceptPageBreak<span class="kw">()
+{
+    </span><span class="cmt">//Method accepting or not automatic page break
+    </span><span class="kw">if(</span>$<span 
class="kw">this-&gt;</span>col<span class="kw">&lt;</span>2<span class="kw">)
+    {
+        </span><span class="cmt">//Go to next column
+        </span>$<span class="kw">this-&gt;</span>SetCol<span 
class="kw">(</span>$<span class="kw">this-&gt;</span>col<span 
class="kw">+</span>1<span class="kw">);
+        </span><span class="cmt">//Set ordinate to top
+        </span>$<span class="kw">this-&gt;</span>SetY<span 
class="kw">(</span>$<span class="kw">this-&gt;</span>y0<span class="kw">);
+        </span><span class="cmt">//Keep on page
+        </span><span class="kw">return </span>false<span class="kw">;
+    }
+    else
+    {
+        </span><span class="cmt">//Go back to first column
+        </span>$<span class="kw">this-&gt;</span>SetCol<span 
class="kw">(</span>0<span class="kw">);
+        </span><span class="cmt">//Page break
+        </span><span class="kw">return </span>true<span class="kw">;
+    }
+}
+
+function </span>ChapterTitle<span class="kw">(</span>$num<span 
class="kw">,</span>$label<span class="kw">)
+{
+    </span><span class="cmt">//Title
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Arial'</span><span 
class="kw">,</span><span class="str">''</span><span class="kw">,</span>12<span 
class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetFillColor<span 
class="kw">(</span>200<span class="kw">,</span>220<span 
class="kw">,</span>255<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>6<span class="kw">,</span><span 
class="str">"Chapter $num : $label"</span><span class="kw">,</span>0<span 
class="kw">,</span>1<span class="kw">,</span><span class="str">'L'</span><span 
class="kw">,</span>true<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">(</span>4<span 
class="kw">);
+    </span><span class="cmt">//Save ordinate
+    </span>$<span class="kw">this-&gt;</span>y0<span class="kw">=</span>$<span 
class="kw">this-&gt;</span>GetY<span class="kw">();
+}
+
+function </span>ChapterBody<span class="kw">(</span>$file<span class="kw">)
+{
+    </span><span class="cmt">//Read text file
+    </span>$f<span class="kw">=</span>fopen<span class="kw">(</span>$file<span 
class="kw">,</span><span class="str">'r'</span><span class="kw">);
+    </span>$txt<span class="kw">=</span>fread<span class="kw">(</span>$f<span 
class="kw">,</span>filesize<span class="kw">(</span>$file<span class="kw">));
+    </span>fclose<span class="kw">(</span>$f<span class="kw">);
+    </span><span class="cmt">//Font
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">'Times'</span><span 
class="kw">,</span><span class="str">''</span><span class="kw">,</span>12<span 
class="kw">);
+    </span><span class="cmt">//Output text in a 6 cm width column
+    </span>$<span class="kw">this-&gt;</span>MultiCell<span 
class="kw">(</span>60<span class="kw">,</span>5<span 
class="kw">,</span>$txt<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+    </span><span class="cmt">//Mention
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">''</span><span class="kw">,</span><span 
class="str">'I'</span><span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>0<span class="kw">,</span>5<span class="kw">,</span><span 
class="str">'(end of excerpt)'</span><span class="kw">);
+    </span><span class="cmt">//Go back to first column
+    </span>$<span class="kw">this-&gt;</span>SetCol<span 
class="kw">(</span>0<span class="kw">);
+}
+
+function </span>PrintChapter<span class="kw">(</span>$num<span 
class="kw">,</span>$title<span class="kw">,</span>$file<span class="kw">)
+{
+    </span><span class="cmt">//Add chapter
+    </span>$<span class="kw">this-&gt;</span>AddPage<span class="kw">();
+    </span>$<span class="kw">this-&gt;</span>ChapterTitle<span 
class="kw">(</span>$num<span class="kw">,</span>$title<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>ChapterBody<span 
class="kw">(</span>$file<span class="kw">);
+}
+}
+
+</span>$pdf<span class="kw">=new </span>PDF<span class="kw">();
+</span>$title<span class="kw">=</span><span class="str">'20000 Leagues Under 
the Seas'</span><span class="kw">;
+</span>$pdf<span class="kw">-&gt;</span>SetTitle<span 
class="kw">(</span>$title<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>SetAuthor<span 
class="kw">(</span><span class="str">'Jules Verne'</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>PrintChapter<span 
class="kw">(</span>1<span class="kw">,</span><span class="str">'A RUNAWAY 
REEF'</span><span class="kw">,</span><span class="str">'20k_c1.txt'</span><span 
class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>PrintChapter<span 
class="kw">(</span>2<span class="kw">,</span><span class="str">'THE PROS AND 
CONS'</span><span class="kw">,</span><span class="str">'20k_c2.txt'</span><span 
class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Output<span class="kw">();
+</span>?&gt;</code></pre>
+</div>
+<p class='demo'><a href='tuto4.php' target='_blank' class='demo'>[Demo]</a></p>
+The key method used is <a 
href='../doc/acceptpagebreak.htm'>AcceptPageBreak()</a>. It allows to accept or 
not an automatic page
+break. By refusing it and altering the margin and current position, the 
desired column layout
+is achieved.
+<br>
+For the rest, not many changes; two properties have been added to the class to 
save the current
+column number and the position where columns begin, and the MultiCell() call 
specifies a
+6 centimeter width.
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,113 @@
+<?php
+require('../fpdf.php');
+
+class PDF extends FPDF
+{
+//Current column
+var $col=0;
+//Ordinate of column start
+var $y0;
+
+function Header()
+{
+       //Page header
+       global $title;
+
+       $this->SetFont('Arial','B',15);
+       $w=$this->GetStringWidth($title)+6;
+       $this->SetX((210-$w)/2);
+       $this->SetDrawColor(0,80,180);
+       $this->SetFillColor(230,230,0);
+       $this->SetTextColor(220,50,50);
+       $this->SetLineWidth(1);
+       $this->Cell($w,9,$title,1,1,'C',true);
+       $this->Ln(10);
+       //Save ordinate
+       $this->y0=$this->GetY();
+}
+
+function Footer()
+{
+       //Page footer
+       $this->SetY(-15);
+       $this->SetFont('Arial','I',8);
+       $this->SetTextColor(128);
+       $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
+}
+
+function SetCol($col)
+{
+       //Set position at a given column
+       $this->col=$col;
+       $x=10+$col*65;
+       $this->SetLeftMargin($x);
+       $this->SetX($x);
+}
+
+function AcceptPageBreak()
+{
+       //Method accepting or not automatic page break
+       if($this->col<2)
+       {
+               //Go to next column
+               $this->SetCol($this->col+1);
+               //Set ordinate to top
+               $this->SetY($this->y0);
+               //Keep on page
+               return false;
+       }
+       else
+       {
+               //Go back to first column
+               $this->SetCol(0);
+               //Page break
+               return true;
+       }
+}
+
+function ChapterTitle($num,$label)
+{
+       //Title
+       $this->SetFont('Arial','',12);
+       $this->SetFillColor(200,220,255);
+       $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true);
+       $this->Ln(4);
+       //Save ordinate
+       $this->y0=$this->GetY();
+}
+
+function ChapterBody($file)
+{
+       //Read text file
+       $f=fopen($file,'r');
+       $txt=fread($f,filesize($file));
+       fclose($f);
+       //Font
+       $this->SetFont('Times','',12);
+       //Output text in a 6 cm width column
+       $this->MultiCell(60,5,$txt);
+       $this->Ln();
+       //Mention
+       $this->SetFont('','I');
+       $this->Cell(0,5,'(end of excerpt)');
+       //Go back to first column
+       $this->SetCol(0);
+}
+
+function PrintChapter($num,$title,$file)
+{
+       //Add chapter
+       $this->AddPage();
+       $this->ChapterTitle($num,$title);
+       $this->ChapterBody($file);
+}
+}
+
+$pdf=new PDF();
+$title='20000 Leagues Under the Seas';
+$pdf->SetTitle($title);
+$pdf->SetAuthor('Jules Verne');
+$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt');
+$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt');
+$pdf->Output();
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto4.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,133 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tables</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Tables</h1>
+This tutorial shows how to make tables easily.
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span class="str">'fpdf.php'</span><span 
class="kw">);
+
+class </span>PDF <span class="kw">extends </span>FPDF
+<span class="kw">{
+</span><span class="cmt">//Load data
+</span><span class="kw">function </span>LoadData<span 
class="kw">(</span>$file<span class="kw">)
+{
+    </span><span class="cmt">//Read file lines
+    </span>$lines<span class="kw">=</span>file<span 
class="kw">(</span>$file<span class="kw">);
+    </span>$data<span class="kw">=array();
+    foreach(</span>$lines <span class="kw">as </span>$line<span class="kw">)
+        </span>$data<span class="kw">[]=</span>explode<span 
class="kw">(</span><span class="str">';'</span><span 
class="kw">,</span>chop<span class="kw">(</span>$line<span class="kw">));
+    return </span>$data<span class="kw">;
+}
+
+</span><span class="cmt">//Simple table
+</span><span class="kw">function </span>BasicTable<span 
class="kw">(</span>$header<span class="kw">,</span>$data<span class="kw">)
+{
+    </span><span class="cmt">//Header
+    </span><span class="kw">foreach(</span>$header <span class="kw">as 
</span>$col<span class="kw">)
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>40<span class="kw">,</span>7<span 
class="kw">,</span>$col<span class="kw">,</span>1<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+    </span><span class="cmt">//Data
+    </span><span class="kw">foreach(</span>$data <span class="kw">as 
</span>$row<span class="kw">)
+    {
+        foreach(</span>$row <span class="kw">as </span>$col<span class="kw">)
+            </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>40<span class="kw">,</span>6<span 
class="kw">,</span>$col<span class="kw">,</span>1<span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+    }
+}
+
+</span><span class="cmt">//Better table
+</span><span class="kw">function </span>ImprovedTable<span 
class="kw">(</span>$header<span class="kw">,</span>$data<span class="kw">)
+{
+    </span><span class="cmt">//Column widths
+    </span>$w<span class="kw">=array(</span>40<span class="kw">,</span>35<span 
class="kw">,</span>40<span class="kw">,</span>45<span class="kw">);
+    </span><span class="cmt">//Header
+    </span><span class="kw">for(</span>$i<span class="kw">=</span>0<span 
class="kw">;</span>$i<span class="kw">&lt;</span>count<span 
class="kw">(</span>$header<span class="kw">);</span>$i<span class="kw">++)
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>$i<span 
class="kw">],</span>7<span class="kw">,</span>$header<span 
class="kw">[</span>$i<span class="kw">],</span>1<span class="kw">,</span>0<span 
class="kw">,</span><span class="str">'C'</span><span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+    </span><span class="cmt">//Data
+    </span><span class="kw">foreach(</span>$data <span class="kw">as 
</span>$row<span class="kw">)
+    {
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>0<span class="kw">],</span>6<span 
class="kw">,</span>$row<span class="kw">[</span>0<span 
class="kw">],</span><span class="str">'LR'</span><span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>1<span class="kw">],</span>6<span 
class="kw">,</span>$row<span class="kw">[</span>1<span 
class="kw">],</span><span class="str">'LR'</span><span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>2<span class="kw">],</span>6<span 
class="kw">,</span>number_format<span class="kw">(</span>$row<span 
class="kw">[</span>2<span class="kw">]),</span><span 
class="str">'LR'</span><span class="kw">,</span>0<span class="kw">,</span><span 
class="str">'R'</span><span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>3<span class="kw">],</span>6<span 
class="kw">,</span>number_format<span class="kw">(</span>$row<span 
class="kw">[</span>3<span class="kw">]),</span><span 
class="str">'LR'</span><span class="kw">,</span>0<span class="kw">,</span><span 
class="str">'R'</span><span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+    }
+    </span><span class="cmt">//Closure line
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>array_sum<span class="kw">(</span>$w<span 
class="kw">),</span>0<span class="kw">,</span><span class="str">''</span><span 
class="kw">,</span><span class="str">'T'</span><span class="kw">);
+}
+
+</span><span class="cmt">//Colored table
+</span><span class="kw">function </span>FancyTable<span 
class="kw">(</span>$header<span class="kw">,</span>$data<span class="kw">)
+{
+    </span><span class="cmt">//Colors, line width and bold font
+    </span>$<span class="kw">this-&gt;</span>SetFillColor<span 
class="kw">(</span>255<span class="kw">,</span>0<span class="kw">,</span>0<span 
class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>255<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetDrawColor<span 
class="kw">(</span>128<span class="kw">,</span>0<span class="kw">,</span>0<span 
class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetLineWidth<span 
class="kw">(</span>.3<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">''</span><span class="kw">,</span><span 
class="str">'B'</span><span class="kw">);
+    </span><span class="cmt">//Header
+    </span>$w<span class="kw">=array(</span>40<span class="kw">,</span>35<span 
class="kw">,</span>40<span class="kw">,</span>45<span class="kw">);
+    for(</span>$i<span class="kw">=</span>0<span class="kw">;</span>$i<span 
class="kw">&lt;</span>count<span class="kw">(</span>$header<span 
class="kw">);</span>$i<span class="kw">++)
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>$i<span 
class="kw">],</span>7<span class="kw">,</span>$header<span 
class="kw">[</span>$i<span class="kw">],</span>1<span class="kw">,</span>0<span 
class="kw">,</span><span class="str">'C'</span><span 
class="kw">,</span>true<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+    </span><span class="cmt">//Color and font restoration
+    </span>$<span class="kw">this-&gt;</span>SetFillColor<span 
class="kw">(</span>224<span class="kw">,</span>235<span 
class="kw">,</span>255<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>0<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">''</span><span class="kw">);
+    </span><span class="cmt">//Data
+    </span>$fill<span class="kw">=</span>false<span class="kw">;
+    foreach(</span>$data <span class="kw">as </span>$row<span class="kw">)
+    {
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>0<span class="kw">],</span>6<span 
class="kw">,</span>$row<span class="kw">[</span>0<span 
class="kw">],</span><span class="str">'LR'</span><span 
class="kw">,</span>0<span class="kw">,</span><span class="str">'L'</span><span 
class="kw">,</span>$fill<span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>1<span class="kw">],</span>6<span 
class="kw">,</span>$row<span class="kw">[</span>1<span 
class="kw">],</span><span class="str">'LR'</span><span 
class="kw">,</span>0<span class="kw">,</span><span class="str">'L'</span><span 
class="kw">,</span>$fill<span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>2<span class="kw">],</span>6<span 
class="kw">,</span>number_format<span class="kw">(</span>$row<span 
class="kw">[</span>2<span class="kw">]),</span><span 
class="str">'LR'</span><span class="kw">,</span>0<span class="kw">,</span><span 
class="str">'R'</span><span class="kw">,</span>$fill<span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>$w<span class="kw">[</span>3<span class="kw">],</span>6<span 
class="kw">,</span>number_format<span class="kw">(</span>$row<span 
class="kw">[</span>3<span class="kw">]),</span><span 
class="str">'LR'</span><span class="kw">,</span>0<span class="kw">,</span><span 
class="str">'R'</span><span class="kw">,</span>$fill<span class="kw">);
+        </span>$<span class="kw">this-&gt;</span>Ln<span class="kw">();
+        </span>$fill<span class="kw">=!</span>$fill<span class="kw">;
+    }
+    </span>$<span class="kw">this-&gt;</span>Cell<span 
class="kw">(</span>array_sum<span class="kw">(</span>$w<span 
class="kw">),</span>0<span class="kw">,</span><span class="str">''</span><span 
class="kw">,</span><span class="str">'T'</span><span class="kw">);
+}
+}
+
+</span>$pdf<span class="kw">=new </span>PDF<span class="kw">();
+</span><span class="cmt">//Column titles
+</span>$header<span class="kw">=array(</span><span 
class="str">'Country'</span><span class="kw">,</span><span 
class="str">'Capital'</span><span class="kw">,</span><span class="str">'Area 
(sq km)'</span><span class="kw">,</span><span class="str">'Pop. 
(thousands)'</span><span class="kw">);
+</span><span class="cmt">//Data loading
+</span>$data<span class="kw">=</span>$pdf<span 
class="kw">-&gt;</span>LoadData<span class="kw">(</span><span 
class="str">'countries.txt'</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>SetFont<span class="kw">(</span><span 
class="str">'Arial'</span><span class="kw">,</span><span 
class="str">''</span><span class="kw">,</span>14<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>BasicTable<span 
class="kw">(</span>$header<span class="kw">,</span>$data<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>ImprovedTable<span 
class="kw">(</span>$header<span class="kw">,</span>$data<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>FancyTable<span 
class="kw">(</span>$header<span class="kw">,</span>$data<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Output<span class="kw">();
+</span>?&gt;</code></pre>
+</div>
+<p class='demo'><a href='tuto5.php' target='_blank' class='demo'>[Demo]</a></p>
+A table being just a collection of cells, it is natural to build one from 
them. The first
+example is achieved in the most basic way possible: simple framed cells, all 
of the same size
+and left aligned. The result is rudimentary but very quick to obtain.
+<br>
+<br>
+The second table brings some improvements: each column has its own width, 
titles are centered
+and figures right aligned. Moreover, horizontal lines have been removed. This 
is done by means
+of the <code>border</code> parameter of the <a 
href='../doc/cell.htm'>Cell()</a> method, which specifies which sides of the
+cell must be drawn. Here we want the left (<code>L</code>) and right 
(<code>R</code>) ones. It remains
+the problem of the horizontal line to finish the table. There are two 
possibilities: either
+check for the last line in the loop, in which case we use <code>LRB</code> for 
the <code>border</code>
+parameter; or, as done here, add the line once the loop is over.
+<br>
+<br>
+The third table is similar to the second one but uses colors. Fill, text and 
line colors are
+simply specified. Alternate coloring for rows is obtained by using 
alternatively transparent
+and filled cells.
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,101 @@
+<?php
+require('../fpdf.php');
+
+class PDF extends FPDF
+{
+//Load data
+function LoadData($file)
+{
+       //Read file lines
+       $lines=file($file);
+       $data=array();
+       foreach($lines as $line)
+               $data[]=explode(';',chop($line));
+       return $data;
+}
+
+//Simple table
+function BasicTable($header,$data)
+{
+       //Header
+       foreach($header as $col)
+               $this->Cell(40,7,$col,1);
+       $this->Ln();
+       //Data
+       foreach($data as $row)
+       {
+               foreach($row as $col)
+                       $this->Cell(40,6,$col,1);
+               $this->Ln();
+       }
+}
+
+//Better table
+function ImprovedTable($header,$data)
+{
+       //Column widths
+       $w=array(40,35,40,45);
+       //Header
+       for($i=0;$i<count($header);$i++)
+               $this->Cell($w[$i],7,$header[$i],1,0,'C');
+       $this->Ln();
+       //Data
+       foreach($data as $row)
+       {
+               $this->Cell($w[0],6,$row[0],'LR');
+               $this->Cell($w[1],6,$row[1],'LR');
+               $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R');
+               $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R');
+               $this->Ln();
+       }
+       //Closure line
+       $this->Cell(array_sum($w),0,'','T');
+}
+
+//Colored table
+function FancyTable($header,$data)
+{
+       //Colors, line width and bold font
+       $this->SetFillColor(255,0,0);
+       $this->SetTextColor(255);
+       $this->SetDrawColor(128,0,0);
+       $this->SetLineWidth(.3);
+       $this->SetFont('','B');
+       //Header
+       $w=array(40,35,40,45);
+       for($i=0;$i<count($header);$i++)
+               $this->Cell($w[$i],7,$header[$i],1,0,'C',true);
+       $this->Ln();
+       //Color and font restoration
+       $this->SetFillColor(224,235,255);
+       $this->SetTextColor(0);
+       $this->SetFont('');
+       //Data
+       $fill=false;
+       foreach($data as $row)
+       {
+               $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill);
+               $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill);
+               $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill);
+               $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill);
+               $this->Ln();
+               $fill=!$fill;
+       }
+       $this->Cell(array_sum($w),0,'','T');
+}
+}
+
+$pdf=new PDF();
+//Column titles
+$header=array('Country','Capital','Area (sq km)','Pop. (thousands)');
+//Data loading
+$data=$pdf->LoadData('countries.txt');
+$pdf->SetFont('Arial','',14);
+$pdf->AddPage();
+$pdf->BasicTable($header,$data);
+$pdf->AddPage();
+$pdf->ImprovedTable($header,$data);
+$pdf->AddPage();
+$pdf->FancyTable($header,$data);
+$pdf->Output();
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto5.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,163 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Links and flowing text</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+</head>
+<body>
+<h1>Links and flowing text</h1>
+This tutorial explains how to insert links (internal and external) and shows a 
new text writing
+mode. It also contains a basic HTML parser.
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span class="str">'fpdf.php'</span><span 
class="kw">);
+
+class </span>PDF <span class="kw">extends </span>FPDF
+<span class="kw">{
+var </span>$B<span class="kw">;
+var </span>$I<span class="kw">;
+var </span>$U<span class="kw">;
+var </span>$HREF<span class="kw">;
+
+function </span>PDF<span class="kw">(</span>$orientation<span 
class="kw">=</span><span class="str">'P'</span><span 
class="kw">,</span>$unit<span class="kw">=</span><span 
class="str">'mm'</span><span class="kw">,</span>$format<span 
class="kw">=</span><span class="str">'A4'</span><span class="kw">)
+{
+    </span><span class="cmt">//Call parent constructor
+    </span>$<span class="kw">this-&gt;</span>FPDF<span 
class="kw">(</span>$orientation<span class="kw">,</span>$unit<span 
class="kw">,</span>$format<span class="kw">);
+    </span><span class="cmt">//Initialization
+    </span>$<span class="kw">this-&gt;</span>B<span class="kw">=</span>0<span 
class="kw">;
+    </span>$<span class="kw">this-&gt;</span>I<span class="kw">=</span>0<span 
class="kw">;
+    </span>$<span class="kw">this-&gt;</span>U<span class="kw">=</span>0<span 
class="kw">;
+    </span>$<span class="kw">this-&gt;</span>HREF<span 
class="kw">=</span><span class="str">''</span><span class="kw">;
+}
+
+function </span>WriteHTML<span class="kw">(</span>$html<span class="kw">)
+{
+    </span><span class="cmt">//HTML parser
+    </span>$html<span class="kw">=</span>str_replace<span 
class="kw">(</span><span class="str">"\n"</span><span class="kw">,</span><span 
class="str">' '</span><span class="kw">,</span>$html<span class="kw">);
+    </span>$a<span class="kw">=</span>preg_split<span class="kw">(</span><span 
class="str">'/&lt;(.*)&gt;/U'</span><span class="kw">,</span>$html<span 
class="kw">,-</span>1<span class="kw">,</span>PREG_SPLIT_DELIM_CAPTURE<span 
class="kw">);
+    foreach(</span>$a <span class="kw">as </span>$i<span 
class="kw">=&gt;</span>$e<span class="kw">)
+    {
+        if(</span>$i<span class="kw">%</span>2<span class="kw">==</span>0<span 
class="kw">)
+        {
+            </span><span class="cmt">//Text
+            </span><span class="kw">if(</span>$<span 
class="kw">this-&gt;</span>HREF<span class="kw">)
+                </span>$<span class="kw">this-&gt;</span>PutLink<span 
class="kw">(</span>$<span class="kw">this-&gt;</span>HREF<span 
class="kw">,</span>$e<span class="kw">);
+            else
+                </span>$<span class="kw">this-&gt;</span>Write<span 
class="kw">(</span>5<span class="kw">,</span>$e<span class="kw">);
+        }
+        else
+        {
+            </span><span class="cmt">//Tag
+            </span><span class="kw">if(</span>$e<span 
class="kw">{</span>0<span class="kw">}==</span><span 
class="str">'/'</span><span class="kw">)
+                </span>$<span class="kw">this-&gt;</span>CloseTag<span 
class="kw">(</span>strtoupper<span class="kw">(</span>substr<span 
class="kw">(</span>$e<span class="kw">,</span>1<span class="kw">)));
+            else
+            {
+                </span><span class="cmt">//Extract attributes
+                </span>$a2<span class="kw">=</span>explode<span 
class="kw">(</span><span class="str">' '</span><span class="kw">,</span>$e<span 
class="kw">);
+                </span>$tag<span class="kw">=</span>strtoupper<span 
class="kw">(</span>array_shift<span class="kw">(</span>$a2<span class="kw">));
+                </span>$attr<span class="kw">=array();
+                foreach(</span>$a2 <span class="kw">as </span>$v<span 
class="kw">)
+                {
+                    if(</span>preg_match<span class="kw">(</span><span 
class="str">'/([^=]*)=["\']?([^"\']*)/'</span><span class="kw">,</span>$v<span 
class="kw">,</span>$a3<span class="kw">))
+                        </span>$attr<span class="kw">[</span>strtoupper<span 
class="kw">(</span>$a3<span class="kw">[</span>1<span 
class="kw">])]=</span>$a3<span class="kw">[</span>2<span class="kw">];
+                }
+                </span>$<span class="kw">this-&gt;</span>OpenTag<span 
class="kw">(</span>$tag<span class="kw">,</span>$attr<span class="kw">);
+            }
+        }
+    }
+}
+
+function </span>OpenTag<span class="kw">(</span>$tag<span 
class="kw">,</span>$attr<span class="kw">)
+{
+    </span><span class="cmt">//Opening tag
+    </span><span class="kw">if(</span>$tag<span class="kw">==</span><span 
class="str">'B' </span><span class="kw">or </span>$tag<span 
class="kw">==</span><span class="str">'I' </span><span class="kw">or 
</span>$tag<span class="kw">==</span><span class="str">'U'</span><span 
class="kw">)
+        </span>$<span class="kw">this-&gt;</span>SetStyle<span 
class="kw">(</span>$tag<span class="kw">,</span>true<span class="kw">);
+    if(</span>$tag<span class="kw">==</span><span class="str">'A'</span><span 
class="kw">)
+        </span>$<span class="kw">this-&gt;</span>HREF<span 
class="kw">=</span>$attr<span class="kw">[</span><span 
class="str">'HREF'</span><span class="kw">];
+    if(</span>$tag<span class="kw">==</span><span class="str">'BR'</span><span 
class="kw">)
+        </span>$<span class="kw">this-&gt;</span>Ln<span 
class="kw">(</span>5<span class="kw">);
+}
+
+function </span>CloseTag<span class="kw">(</span>$tag<span class="kw">)
+{
+    </span><span class="cmt">//Closing tag
+    </span><span class="kw">if(</span>$tag<span class="kw">==</span><span 
class="str">'B' </span><span class="kw">or </span>$tag<span 
class="kw">==</span><span class="str">'I' </span><span class="kw">or 
</span>$tag<span class="kw">==</span><span class="str">'U'</span><span 
class="kw">)
+        </span>$<span class="kw">this-&gt;</span>SetStyle<span 
class="kw">(</span>$tag<span class="kw">,</span>false<span class="kw">);
+    if(</span>$tag<span class="kw">==</span><span class="str">'A'</span><span 
class="kw">)
+        </span>$<span class="kw">this-&gt;</span>HREF<span 
class="kw">=</span><span class="str">''</span><span class="kw">;
+}
+
+function </span>SetStyle<span class="kw">(</span>$tag<span 
class="kw">,</span>$enable<span class="kw">)
+{
+    </span><span class="cmt">//Modify style and select corresponding font
+    </span>$<span class="kw">this-&gt;</span>$tag<span 
class="kw">+=(</span>$enable <span class="kw">? </span>1 <span class="kw">: 
-</span>1<span class="kw">);
+    </span>$style<span class="kw">=</span><span class="str">''</span><span 
class="kw">;
+    foreach(array(</span><span class="str">'B'</span><span 
class="kw">,</span><span class="str">'I'</span><span class="kw">,</span><span 
class="str">'U'</span><span class="kw">) as </span>$s<span class="kw">)
+        if(</span>$<span class="kw">this-&gt;</span>$s<span 
class="kw">&gt;</span>0<span class="kw">)
+            </span>$style<span class="kw">.=</span>$s<span class="kw">;
+    </span>$<span class="kw">this-&gt;</span>SetFont<span 
class="kw">(</span><span class="str">''</span><span 
class="kw">,</span>$style<span class="kw">);
+}
+
+function </span>PutLink<span class="kw">(</span>$URL<span 
class="kw">,</span>$txt<span class="kw">)
+{
+    </span><span class="cmt">//Put a hyperlink
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>0<span class="kw">,</span>0<span class="kw">,</span>255<span 
class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetStyle<span 
class="kw">(</span><span class="str">'U'</span><span 
class="kw">,</span>true<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>Write<span 
class="kw">(</span>5<span class="kw">,</span>$txt<span 
class="kw">,</span>$URL<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetStyle<span 
class="kw">(</span><span class="str">'U'</span><span 
class="kw">,</span>false<span class="kw">);
+    </span>$<span class="kw">this-&gt;</span>SetTextColor<span 
class="kw">(</span>0<span class="kw">);
+}
+}
+
+</span>$html<span class="kw">=</span><span class="str">'You can now easily 
print text mixing different styles: &lt;b&gt;bold&lt;/b&gt;, 
&lt;i&gt;italic&lt;/i&gt;,
+&lt;u&gt;underlined&lt;/u&gt;, or &lt;b&gt;&lt;i&gt;&lt;u&gt;all at 
once&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;!&lt;br&gt;&lt;br&gt;You can also insert 
links on
+text, such as &lt;a href="http://www.fpdf.org"&gt;www.fpdf.org&lt;/a&gt;, or 
on an image: click on the logo.'</span><span class="kw">;
+
+</span>$pdf<span class="kw">=new </span>PDF<span class="kw">();
+</span><span class="cmt">//First page
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>SetFont<span class="kw">(</span><span 
class="str">'Arial'</span><span class="kw">,</span><span 
class="str">''</span><span class="kw">,</span>20<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Write<span class="kw">(</span>5<span 
class="kw">,</span><span class="str">'To find out what\'s new in this tutorial, 
click '</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>SetFont<span class="kw">(</span><span 
class="str">''</span><span class="kw">,</span><span class="str">'U'</span><span 
class="kw">);
+</span>$link<span class="kw">=</span>$pdf<span 
class="kw">-&gt;</span>AddLink<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>Write<span class="kw">(</span>5<span 
class="kw">,</span><span class="str">'here'</span><span 
class="kw">,</span>$link<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>SetFont<span class="kw">(</span><span 
class="str">''</span><span class="kw">);
+</span><span class="cmt">//Second page
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>SetLink<span 
class="kw">(</span>$link<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Image<span class="kw">(</span><span 
class="str">'logo.png'</span><span class="kw">,</span>10<span 
class="kw">,</span>12<span class="kw">,</span>30<span class="kw">,</span>0<span 
class="kw">,</span><span class="str">''</span><span class="kw">,</span><span 
class="str">'http://www.fpdf.org'</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>SetLeftMargin<span 
class="kw">(</span>45<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>SetFontSize<span 
class="kw">(</span>14<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>WriteHTML<span 
class="kw">(</span>$html<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Output<span class="kw">();
+</span>?&gt;</code></pre>
+</div>
+<p class='demo'><a href='tuto6.php' target='_blank' class='demo'>[Demo]</a></p>
+The new method to print text is <a href='../doc/write.htm'>Write()</a>. It is 
very close to <a href='../doc/multicell.htm'>MultiCell()</a>; the differences 
are:
+<ul>
+<li>The end of line is at the right margin and the next line begins at the 
left one</li>
+<li>The current position moves at the end of the text</li>
+</ul>
+So it allows to write a chunk of text, alter the font style, then continue 
from the exact
+place we left it. On the other hand, you cannot justify it.
+<br>
+<br>
+The method is used on the first page to put a link pointing to the second one. 
The beginning of
+the sentence is written in regular style, then we switch to underline and 
finish it. The link
+is created with <a href='../doc/addlink.htm'>AddLink()</a>, which returns a 
link identifier. The identifier is
+passed as third parameter of Write(). Once the second page is created, we use 
<a href='../doc/setlink.htm'>SetLink()</a> to
+make the link point to the beginning of the current page.
+<br>
+<br>
+Then we put an image with a link on it. An external link points to an URL 
(HTTP, mailto...).
+The URL is simply passed as last parameter of <a 
href='../doc/image.htm'>Image()</a>.
+<br>
+<br>
+Finally, the left margin is moved after the image with <a 
href='../doc/setleftmargin.htm'>SetLeftMargin()</a> and some text in
+HTML format is output. A very simple HTML parser is used for this, based on 
regular expressions.
+Recognized tags are &lt;b&gt;, &lt;i&gt;, &lt;u&gt;, &lt;a&gt; and &lt;br&gt;; 
the others are
+ignored. The parser also makes use of the Write() method. An external link is 
put the same way as
+an internal one (third parameter of Write()). Note that <a 
href='../doc/cell.htm'>Cell()</a> also allows to put links.
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,122 @@
+<?php
+require('../fpdf.php');
+
+class PDF extends FPDF
+{
+var $B;
+var $I;
+var $U;
+var $HREF;
+
+function PDF($orientation='P',$unit='mm',$format='A4')
+{
+       //Call parent constructor
+       $this->FPDF($orientation,$unit,$format);
+       //Initialization
+       $this->B=0;
+       $this->I=0;
+       $this->U=0;
+       $this->HREF='';
+}
+
+function WriteHTML($html)
+{
+       //HTML parser
+       $html=str_replace("\n",' ',$html);
+       $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
+       foreach($a as $i=>$e)
+       {
+               if($i%2==0)
+               {
+                       //Text
+                       if($this->HREF)
+                               $this->PutLink($this->HREF,$e);
+                       else
+                               $this->Write(5,$e);
+               }
+               else
+               {
+                       //Tag
+                       if($e{0}=='/')
+                               $this->CloseTag(strtoupper(substr($e,1)));
+                       else
+                       {
+                               //Extract attributes
+                               $a2=explode(' ',$e);
+                               $tag=strtoupper(array_shift($a2));
+                               $attr=array();
+                               foreach($a2 as $v)
+                               {
+                                       
if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
+                                               
$attr[strtoupper($a3[1])]=$a3[2];
+                               }
+                               $this->OpenTag($tag,$attr);
+                       }
+               }
+       }
+}
+
+function OpenTag($tag,$attr)
+{
+       //Opening tag
+       if($tag=='B' or $tag=='I' or $tag=='U')
+               $this->SetStyle($tag,true);
+       if($tag=='A')
+               $this->HREF=$attr['HREF'];
+       if($tag=='BR')
+               $this->Ln(5);
+}
+
+function CloseTag($tag)
+{
+       //Closing tag
+       if($tag=='B' or $tag=='I' or $tag=='U')
+               $this->SetStyle($tag,false);
+       if($tag=='A')
+               $this->HREF='';
+}
+
+function SetStyle($tag,$enable)
+{
+       //Modify style and select corresponding font
+       $this->$tag+=($enable ? 1 : -1);
+       $style='';
+       foreach(array('B','I','U') as $s)
+               if($this->$s>0)
+                       $style.=$s;
+       $this->SetFont('',$style);
+}
+
+function PutLink($URL,$txt)
+{
+       //Put a hyperlink
+       $this->SetTextColor(0,0,255);
+       $this->SetStyle('U',true);
+       $this->Write(5,$txt,$URL);
+       $this->SetStyle('U',false);
+       $this->SetTextColor(0);
+}
+}
+
+$html='You can now easily print text mixing different styles: <b>bold</b>, 
<i>italic</i>,
+<u>underlined</u>, or <b><i><u>all at once</u></i></b>!<br><br>You can also 
insert links on
+text, such as <a href="http://www.fpdf.org";>www.fpdf.org</a>, or on an image: 
click on the logo.';
+
+$pdf=new PDF();
+//First page
+$pdf->AddPage();
+$pdf->SetFont('Arial','',20);
+$pdf->Write(5,'To find out what\'s new in this tutorial, click ');
+$pdf->SetFont('','U');
+$link=$pdf->AddLink();
+$pdf->Write(5,'here',$link);
+$pdf->SetFont('');
+//Second page
+$pdf->AddPage();
+$pdf->SetLink($link);
+$pdf->Image('logo.png',10,12,30,0,'','http://www.fpdf.org');
+$pdf->SetLeftMargin(45);
+$pdf->SetFontSize(14);
+$pdf->WriteHTML($html);
+$pdf->Output();
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto6.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.htm
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.htm    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.htm    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,303 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Adding new fonts and encoding support</title>
+<link type="text/css" rel="stylesheet" href="../fpdf.css">
+<style type="text/css">
+table {border-collapse:collapse; border-style:solid; border-width:2px; 
border-color:#A0A0A0 #000000 #000000 #A0A0A0}
+table {margin:1.4em 0 1.4em 1em}
+th {background-color:#E0EBFF; color:#900000; text-align:left}
+th, td {border:1px solid #808080; padding:2px 10px}
+tr.alt0 {background-color:#FFFFEE}
+tr.alt1 {background-color:#FFFFE0}
+</style>
+</head>
+<body>
+<h1>Adding new fonts and encoding support</h1>
+This tutorial explains how to use TrueType or Type1 fonts so that you are not 
limited to the standard
+fonts any more. The other interest is that you can choose the font encoding, 
which allows you to
+use other languages than the Western ones (the standard fonts having too few 
available characters).
+<br>
+<br>
+There are two ways to use a new font: embedding it in the PDF or not. When a 
font is not
+embedded, it is searched in the system. The advantage is that the PDF file is 
lighter; on the other
+hand, if it is not available, a substitution font is used. So it is preferable 
to ensure that the
+needed font is installed on the client systems. If the file is to be viewed by 
a large audience,
+it is recommended to embed.
+<br>
+<br>
+Adding a new font requires three steps for TrueTypes:
+<ul>
+<li>Generation of the metric file (.afm)</li>
+<li>Generation of the font definition file (.php)</li>
+<li>Declaration of the font in the script</li>
+</ul>
+For Type1, the first one is theoretically not necessary because the AFM file 
is usually shipped
+with the font. In case you have only a metric file in PFM format, use the 
convertor available
+<a href="http://www.fpdf.org/fr/dl.php?id=34";>here</a>.
+<h2>Generation of the metric file</h2>
+The first step for a TrueType consists in generating the AFM file. A utility 
exists to do this
+task: <a href="http://ttf2pt1.sourceforge.net"; target="_blank">ttf2pt1</a>. 
The Windows binary
+is available <a href="http://www.fpdf.org/fr/dl.php?id=22";>here</a>. The 
command line to use is
+the following:
+<br>
+<br>
+<kbd>ttf2pt1 -a font.ttf font</kbd>
+<br>
+<br>
+For example, for Comic Sans MS Regular:
+<br>
+<br>
+<kbd>ttf2pt1 -a c:\windows\fonts\comic.ttf comic</kbd>
+<br>
+<br>
+Two files are created; the one we are interested in is comic.afm.
+<h2>Generation of the font definition file</h2>
+The second step consists in generating a PHP file containing all the 
information needed by FPDF;
+in addition, the font file is compressed. To do this, a helper script is 
provided in the font/makefont/
+directory of the package: makefont.php. It contains the following function:
+<br>
+<br>
+<code>MakeFont(<b>string</b> fontfile, <b>string</b> afmfile [, <b>string</b> 
enc [, <b>array</b> patch [, <b>string</b> type]]])</code>
+<dl class="param" style="margin-bottom:2em">
+<dt><code>fontfile</code></dt>
+<dd>
+<p>Path to the .ttf or .pfb file.</p>
+</dd>
+<dt><code>afmfile</code></dt>
+<dd>
+<p>Path to the .afm file.</p>
+</dd>
+<dt><code>enc</code></dt>
+<dd>
+<p>Name of the encoding to use. Default value: <code>cp1252</code>.</p>
+</dd>
+<dt><code>patch</code></dt>
+<dd>
+<p>Optional modification of the encoding. Empty by default.</p>
+</dd>
+<dt><code>type</code></dt>
+<dd>
+<p>Type of the font (<code>TrueType</code> or <code>Type1</code>). Default 
value: <code>TrueType</code>.</p>
+</dd>
+</dl>
+The first parameter is the name of the font file. The extension must be either 
.ttf or .pfb and
+determines the font type. If you own a Type1 font in ASCII format (.pfa), you 
can convert it to
+binary format with <a href="http://www.lcdf.org/~eddietwo/type/#t1utils"; 
target="_blank">t1utils</a>.
+<br>
+If you don't want to embed the font, pass an empty string. In this case, type 
is given by the
+<code>type</code> parameter.
+<br>
+Note: in the case of a font with the same name as a standard one, for instance 
arial.ttf, it is
+recommended to embed. If you don't, some versions of Acrobat will use their 
own fonts.
+<br>
+<br>
+The AFM file is the one previously generated.
+<br>
+<br>
+The encoding defines the association between a code (from 0 to 255) and a 
character. The first
+128 are fixed and correspond to ASCII; the following are variable. The 
encodings are stored in
+.map files. Those available are:
+<ul>
+<li>cp1250 (Central Europe)</li>
+<li>cp1251 (Cyrillic)</li>
+<li>cp1252 (Western Europe)</li>
+<li>cp1253 (Greek)</li>
+<li>cp1254 (Turkish)</li>
+<li>cp1255 (Hebrew)</li>
+<li>cp1257 (Baltic)</li>
+<li>cp1258 (Vietnamese)</li>
+<li>cp874 (Thai)</li>
+<li>ISO-8859-1 (Western Europe)</li>
+<li>ISO-8859-2 (Central Europe)</li>
+<li>ISO-8859-4 (Baltic)</li>
+<li>ISO-8859-5 (Cyrillic)</li>
+<li>ISO-8859-7 (Greek)</li>
+<li>ISO-8859-9 (Turkish)</li>
+<li>ISO-8859-11 (Thai)</li>
+<li>ISO-8859-15 (Western Europe)</li>
+<li>ISO-8859-16 (Central Europe)</li>
+<li>KOI8-R (Russian)</li>
+<li>KOI8-U (Ukrainian)</li>
+</ul>
+Of course, the font must contain the characters corresponding to the chosen 
encoding.
+<br>
+In the particular case of a symbolic font (that is to say which does not 
contain letters, such
+as Symbol or ZapfDingbats), pass an empty string.
+<br>
+The encodings which begin with cp are those used by Windows; Linux systems 
usually use ISO.
+<br>
+Remark: the standard fonts use cp1252.
+<br>
+<br>
+The fourth parameter gives the possibility to alter the encoding. Sometimes 
you may want to add
+some characters. For instance, ISO-8859-1 does not contain the euro symbol. To 
add it at position
+164, pass <code>array(164=>'Euro')</code>.
+<br>
+<br>
+The last parameter is used to give the type of the font in case it is not 
embedded (that is to
+say the first parameter is empty).
+<br>
+<br>
+After you have called the function (create a new file for this and include 
makefont.php, or
+simply add the call directly inside), a .php file is created, with the same 
name as the .afm one.
+You may rename it if you wish. If the case of embedding, the font file is 
compressed and gives a
+second file with .z as extension (except if the compression function is not 
available, it
+requires zlib). You may rename it too, but in this case you have to alter the 
variable <code>$file</code>
+in the .php file accordingly.
+<br>
+<br>
+Example:
+<div class="source">
+<pre><code>MakeFont<span class="kw">(</span><span 
class="str">'c:\\windows\\fonts\\comic.ttf'</span><span 
class="kw">,</span><span class="str">'comic.afm'</span><span 
class="kw">,</span><span class="str">'cp1252'</span><span class="kw">);
+</span></code></pre>
+</div>
+which gives the files comic.php and comic.z.
+<br>
+<br>
+Then you have to copy the generated file(s) to the font directory. If the font 
file
+could not be compressed, copy the .ttf or .pfb instead of the .z.
+<br>
+<br>
+Remark: for TTF fonts, you can generate the files online <a 
href="http://fpdf.fruit-lab.de"; target="_blank">here</a>
+instead of doing it manually.
+<h2>Declaration of the font in the script</h2>
+The last step is the most simple. You just need to call the <a 
href='../doc/addfont.htm'>AddFont()</a> method. For instance:
+<div class="source">
+<pre><code>$pdf<span class="kw">-&gt;</span>AddFont<span 
class="kw">(</span><span class="str">'Comic'</span><span 
class="kw">,</span><span class="str">''</span><span class="kw">,</span><span 
class="str">'comic.php'</span><span class="kw">);
+</span></code></pre>
+</div>
+or simply:
+<div class="source">
+<pre><code>$pdf<span class="kw">-&gt;</span>AddFont<span 
class="kw">(</span><span class="str">'Comic'</span><span class="kw">);
+</span></code></pre>
+</div>
+And the font is now available (in regular and underlined styles), usable like 
the others. If we
+had worked with Comic Sans MS Bold (comicbd.ttf), we would have put:
+<div class="source">
+<pre><code>$pdf<span class="kw">-&gt;</span>AddFont<span 
class="kw">(</span><span class="str">'Comic'</span><span 
class="kw">,</span><span class="str">'B'</span><span class="kw">,</span><span 
class="str">'comicbd.php'</span><span class="kw">);
+</span></code></pre>
+</div>
+<h2>Example</h2>
+Let's now see a small complete example. The font used is Calligrapher, 
available at
+<a href="http://www.abstractfonts.com/fonts/"; 
target="_blank">www.abstractfonts.com</a> (a site
+offering numerous free TrueType fonts). The first step is the generation of 
the AFM file:
+<br>
+<br>
+<kbd>ttf2pt1 -a calligra.ttf calligra</kbd>
+<br>
+<br>
+which gives calligra.afm (and calligra.t1a that we can delete). Then we 
generate the definition
+file:
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span 
class="str">'font/makefont/makefont.php'</span><span class="kw">);
+
+</span>MakeFont<span class="kw">(</span><span 
class="str">'calligra.ttf'</span><span class="kw">,</span><span 
class="str">'calligra.afm'</span><span class="kw">);
+</span>?&gt;</code></pre>
+</div>
+The function call gives the following report:
+<br>
+<br>
+<b>Warning:</b> character Euro is missing<br>
+<b>Warning:</b> character Zcaron is missing<br>
+<b>Warning:</b> character zcaron is missing<br>
+<b>Warning:</b> character eth is missing<br>
+Font file compressed (calligra.z)<br>
+Font definition file generated (calligra.php)<br>
+<br>
+The euro character is not present in the font (it is too old). Three other 
characters are missing
+too, but we are not interested in them anyway.
+<br>
+We can now copy the two files to the font directory and write the script:
+<div class="source">
+<pre><code>&lt;?php
+<span class="kw">require(</span><span class="str">'fpdf.php'</span><span 
class="kw">);
+
+</span>$pdf<span class="kw">=new </span>FPDF<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>AddFont<span class="kw">(</span><span 
class="str">'Calligrapher'</span><span class="kw">,</span><span 
class="str">''</span><span class="kw">,</span><span 
class="str">'calligra.php'</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>AddPage<span class="kw">();
+</span>$pdf<span class="kw">-&gt;</span>SetFont<span class="kw">(</span><span 
class="str">'Calligrapher'</span><span class="kw">,</span><span 
class="str">''</span><span class="kw">,</span>35<span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Cell<span class="kw">(</span>0<span 
class="kw">,</span>10<span class="kw">,</span><span class="str">'Enjoy new 
fonts with FPDF!'</span><span class="kw">);
+</span>$pdf<span class="kw">-&gt;</span>Output<span class="kw">();
+</span>?&gt;</code></pre>
+</div>
+<p class='demo'><a href='tuto7.php' target='_blank' class='demo'>[Demo]</a></p>
+<h2>About the euro symbol</h2>
+The euro character is not present in all encodings, and is not always placed 
at the same position:
+<table>
+<tr><th>Encoding</th><th>Position</th></tr>
+<tr class="alt0"><td>cp1250</td><td>128</td></tr>
+<tr class="alt1"><td>cp1251</td><td>136</td></tr>
+<tr class="alt0"><td>cp1252</td><td>128</td></tr>
+<tr class="alt1"><td>cp1253</td><td>128</td></tr>
+<tr class="alt0"><td>cp1254</td><td>128</td></tr>
+<tr class="alt1"><td>cp1255</td><td>128</td></tr>
+<tr class="alt0"><td>cp1257</td><td>128</td></tr>
+<tr class="alt1"><td>cp1258</td><td>128</td></tr>
+<tr class="alt0"><td>cp874</td><td>128</td></tr>
+<tr class="alt1"><td>ISO-8859-1</td><td>absent</td></tr>
+<tr class="alt0"><td>ISO-8859-2</td><td>absent</td></tr>
+<tr class="alt1"><td>ISO-8859-4</td><td>absent</td></tr>
+<tr class="alt0"><td>ISO-8859-5</td><td>absent</td></tr>
+<tr class="alt1"><td>ISO-8859-7</td><td>absent</td></tr>
+<tr class="alt0"><td>ISO-8859-9</td><td>absent</td></tr>
+<tr class="alt1"><td>ISO-8859-11</td><td>absent</td></tr>
+<tr class="alt0"><td>ISO-8859-15</td><td>164</td></tr>
+<tr class="alt1"><td>ISO-8859-16</td><td>164</td></tr>
+<tr class="alt0"><td>KOI8-R</td><td>absent</td></tr>
+<tr class="alt1"><td>KOI8-U</td><td>absent</td></tr>
+</table>
+ISO-8859-1 is widespread but does not include the euro sign. If you need it, 
the simplest thing
+to do is using cp1252 or ISO-8859-15 instead, which are nearly identical but 
contain the precious
+symbol.
+<br>
+As for ISO-8859-2, it is possible to use ISO-8859-16 instead, but it contains 
many differences.
+It is therefore simpler to patch the encoding to add the symbol to it, as 
explained above. The
+same is true for the other encodings.
+<h2>Font synthesis under Windows</h2>
+When a TrueType font is not available in a given style, Windows is able to 
synthesize it from the
+regular version. For instance, there is no Comic Sans MS Italic, but it can be 
built from Comic
+Sans MS Regular. This feature can be used in a PDF file, but unfortunately 
requires that the
+regular font be present in the system (you must not embed it). Here is how to 
do it:
+<ul>
+<li>Generate the definition file for the regular font without embedding (you 
may rename it to
+reflect the desired style)</li>
+<li>Open it and append to the variable <code>$name</code> a comma followed by 
the desired style
+(<code>Italic</code>, <code>Bold</code> or <code>BoldItalic</code>)</li>
+</ul>
+For instance, for the file comici.php:
+<br>
+<br>
+<code>$name='ComicSansMS,Italic';</code>
+<br>
+<br>
+It can then be used normally:
+<div class="source">
+<pre><code>$pdf<span class="kw">-&gt;</span>AddFont<span 
class="kw">(</span><span class="str">'Comic'</span><span 
class="kw">,</span><span class="str">'I'</span><span class="kw">,</span><span 
class="str">'comici.php'</span><span class="kw">);
+</span></code></pre>
+</div>
+<h2>Reducing the size of TrueType fonts</h2>
+Font files are often quite voluminous (more than 100, even 200KB); this is due 
to the fact that
+they contain the characters corresponding to many encodings. zlib compression 
reduces them but
+they remain fairly big. A technique exists to reduce them further. It consists 
in converting the
+font to the Type1 format with ttf2pt1 by specifying the encoding you are 
interested in; all other
+characters will be discarded.
+<br>
+For instance, the arial.ttf font shipped with Windows 98 is 267KB (it contains 
1296 characters).
+After compression it gives 147. Let's convert it to Type1 by keeping only 
cp1250 characters:
+<br>
+<br>
+<kbd>ttf2pt1 -b -L cp1250.map c:\windows\fonts\arial.ttf arial</kbd>
+<br>
+<br>
+The .map files are located in the font/makefont/ directory of the package. The 
command produces
+arial.pfb and arial.afm. The arial.pfb file is only 35KB, and 30KB after 
compression.
+<br>
+<br>
+It is possible to go even further. If you are interested only by a subset of 
the encoding (you
+probably don't need all 217 characters), you can open the .map file and remove 
the lines you are
+not interested in. This will reduce the file size accordingly.
+</body>
+</html>

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.php    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.php    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,11 @@
+<?php
+define('FPDF_FONTPATH','./');
+require('../fpdf.php');
+
+$pdf=new FPDF();
+$pdf->AddFont('Calligrapher','','calligra.php');
+$pdf->AddPage();
+$pdf->SetFont('Calligrapher','',35);
+$pdf->Cell(0,10,'Enjoy new fonts with FPDF!');
+$pdf->Output();
+?>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_fpdf/tutorial/tuto7.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_lisez_moi.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_lisez_moi.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_lisez_moi.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,227 @@
+*******************************************************
+** Ce programme est distribu\xE9 sous la licence LGPL,  **
+** reportez-vous au fichier _LGPL.txt ou \xE0           **
+** http://www.gnu.org/licenses/lgpl.html             **
+** pour en savoir plus.                              **
+**                                                   **
+**  Copyright 2000-2009 par Laurent Minguet          **
+*******************************************************
+********************************
+* HTML2PDF v3.25 - 07/10/2009 *
+********************************
+
+Utilisation :
+------------
+ - necessite au minimum PHP 4.3.10
+ 
+ - regardez les exemples fournis pour voir le fonctionnement.
+
+ - les formulaires ne marchent QUE avec ADOBE READER 8 et ADOBE READER 9.0
+ 
+ - il est TRES IMPORTANT de fournir du HTML 4.01 valide au convertisseur,
+   mais seulement ce que contient le <body>
+
+ - pour les borders : il est conseill\xE9 qu'ils soient au format "solid 1mm 
#000000"
+
+ - pour les paddings : ils ne sont applicables qu'aux balises table, th, td, 
div, li
+
+ - Vous pouvez pr\xE9ciser l'encodage. Une fonte compatible doit \xEAtre 
utilis\xE9e. Ceux accept\xE9s sont : 
+    cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1257, cp1258, cp874,
+    ISO-8859-1, ISO-8859-2, ISO-8859-4, ISO-8859-5, ISO-8859-7, ISO-8859-9,
+    ISO-8859-11, ISO-8859-15, ISO-8859-16, KOI8-R, KOI8-U
+  Pour l'utiliser : $html2pdf->setEncoding('cp1250');
+
+ - la possibilit\xE9 de prot\xE9g\xE9 vos PDF est pr\xE9sente, CF Exemple 7. 
Elle utilise le script
+   fpdf_protection de Klemen Vodopivec.
+
+ - Certains tests peuvent \xEAtre activ\xE9s (true) ou de 
d\xE9sactiv\xE9s(false) :
+     * m\xE9thode setTestIsImage : tester que les images doivent existent bien
+     * m\xE9thode setTestTdInOnePage : tester que le contenu des TDs rentre 
sur une seule page
+     
+ - Un mode DEBUG permettant de connaitre les ressources utilis\xE9es lors de 
la construction du PDF est pr\xE9sente.
+   Il est activable en rajoutant la commande suivante juste apr\xE8s le 
constructeur (cf exemple 0):
+      $htmlpdf->setModeDebug();
+     
+ - Certaines balises sp\xE9cifiques ont \xE9t\xE9 introduites :
+     * <page></page>  (CF Exemple 7) :
+      permet de d\xE9finir l'orientation, les marges left, right, top et 
bottom, l'image
+      et la couleur de fond d'une page, sa taille et position, le footer.
+      Il est egalement possible de garder les header et footer des pages 
pr\xE9c\xE9dentes,
+      grace \xE0 l'attribue pageset="old" (CF Exemple 3)
+ 
+     * <page_header></page_header> (CF Exemple 3)
+     
+     * <page_footer></page_footer> (CF Exemple 3)
+     
+     * <nobreak></nobreak> :
+         permet de forcer l'affichage d'une partie sur une m\xEAme page.
+         Si cette partie ne rentre pas dans le reste de la page, un saut de 
page est
+         effectu\xE9 avant.
+ 
+    * <barcode></barcode>  (CF Exemples 0 et 9) :
+         permet d'inserer des barcodes dans les pdfs, CF Exemples 0 et 9
+         Les types de codebar possible sont : EAN13, UPC_A, CODE39. Ceci 
utilise les
+         scripts de The-eh et Olivier 
+         
+     * <qrcode></qrcode> (CF Exemple 13) :
+         permet d'inserer un codebar \xE0 2 dimensions de type QRcode
+         voici un exemple d'utilisation :
+           <qrcode value="votre message ici" size="1mm" ec="M" style="color: 
black; background-color: white"></qrcode>
+         seul le parametre "value" est obligatoire
+         les diff\xE9rentes valeurs de type de correction sont L, M, Q, H
+         (QR Code is registered trademark of DENSO WAVE INCORPORATED | 
http://www.denso-wave.com/qrcode/)
+         ATTENTION : l'utilisation des QRCODE n\xE9cessite l'utilisation de 
PHP5
+
+     * <bookmark></bookmark>  (CF Exemples 7 et About) :
+         permet d'inserer des bookmark dans les pdfs, CF Exemple 7 et About.
+         Il est egalement possible de cr\xE9er un index automatiquement en fin 
de
+         document, CF exemple About.
+         Ceci utilise les scripts d'Olivier et de Min's
+         
+     * propri\xE9t\xE9 css "rotate" :
+         valeurs possibles : 0, 90, 180, 270
+         applicable uniquement sur les divs (cf exemple 8)
+         
+Modification :
+-------------
+ 3.25 : correctif sur le calcul des tableaux dans le page_footer
+        correctif sur l'interpr\xE9tation des espaces entre certaines balises
+        correction sur la gestion des balises H1, H2, H3, H4, H5, H6
+        correction sur la gestion de la balise table
+        support des balises xhtml du type <span />
+        ajout des balises COL (cf exemple 5), DEL, INS, et QRCODE (cf exemple 
13)
+        ajout de la propri\xE9t\xE9 css text-transform
+        ajout de la propri\xE9t\xE9 css rotate (uniquement sur les DIV, cf 
exemple 8)
+        ne plus rendre obligatoire l'existence d'une image (nouvelle 
m\xE9thode setTestIsImage)
+        ajout d'un mode DEBUG - les anciennes fonction d'analyse des 
ressources ont \xE9t\xE9 supprim\xE9es
+        ajout de la m\xE9thode setEncoding
+        ajout de la langue danoise DA (merci \xE0  Daniel K.)
+ 3.24 : correction sur le calcul de la largeur des divs
+        modification pour compatibilit\xE9 avec la localisation PHP
+        modification pour compatibilit\xE9 avec PHP 5.3.0
+ 3.23 : correction sur le calcul des DIVs
+        correction sur l'interpretation de certains styles CSS
+        correction de la fonction de creation d'index automatique CreateIndex
+        ATTENTION : la methode d'appel de CreateIndex a chang\xE9. Regardez 
l'exemple About !!!!
+ 3.22a: redistribution de HTML2PDF sous la licence LGPL !!! (au lieu de GPL)
+ 3.22 : correction sur le background-color
+        refonte totale de la gestion de text-align. les valeurs center et 
right marchent maintenant meme en cas de contenu riche
+ 3.21 : ajout de la propri\xE9t\xE9 css FLOAT pour la balise IMG
+        correction sur la gestion des TFOOT
+        correction sur le positionnement des images
+ 3.20 : ajout de la gestion des margins pour la balise DIV
+        ajout de la gestion de la propriete css LINE-HEIGHT
+        correction sur l'interpretation de la valeur de certains styles CSS 
(background-image, background-position, ...)
+        correction sur la reconnaissance des balises thead et tfoot
+        correction sur la balise select
+        correction sur les fichiers de langue (merci \xE0 Sinan)
+ 3.19 : optimisation du parseur HTML - merci \xE0 Jezelinside
+        ajout de la balise TFOOT
+        am\xE9lioration de la gestion des tableaux : les contenus des balises 
THEAD et TFOOT sont maintenant r\xE9p\xE9t\xE9s sur chaque page.
+        ajout de la balise sp\xE9cifique BOOKMARK afin de cr\xE9er des 
"marques-page"
+        possibilit\xE9 de rajouter un index automatique en fin de fichier
+        ajout de la langue turque TR (merci \xE0 Hidayet)
+        am\xE9lioration de la m\xE9thode Output. Elle est maintenant 
\xE9galement utilisable comme celle de FPDF
+ 3.18 : correction sur les sauts de page automatique pour les balises TABLE, 
UL, OL
+        correction sur l'interpretation des styles pour la balise HR
+        correction sur l'interpretation du style border-collapse pour la 
balise TABLE
+        prise en compte de margin:auto pour les tables et les divs
+        les commentaires dans les CSS sont accept\xE9s
+ 3.17 : ajout de la gestion des balises INPUT (text, radio, checkbox, button, 
hidden, ...), SELECT, OPTION, TEXTAREA (cf exemple 14)
+        ajout de la possibilit\xE9 de mettre des scripts dans le pdf, via 
$html2pdf->pdf->IncludeJS(...); (cf exemples JS)
+        correction sur le saut de page automatique pour les images
+        correction sur les sauts de lignes automatiques pour certaines balises 
(UL, P, ...)
+        ajout de la langue NL (merci \xE0 Roland)
+ 3.16 : ajout de la gestion de list-style: none (cf exemple 13)
+        correction dans la gestion des fontes ajout\xE9es \xE0 fpdf (via la 
m\xE9thode AddFont)
+        nombreuses corrections sur le calcul des largeurs des \xE9l\xE9ments 
table, div, hr, td, th
+        ajout de l'exemple about.php
+        (pour info, les PDF g\xE9n\xE9r\xE9s \xE0 partir des exemples sont 
maintenant dans le r\xE9pertoire /exemples/pdf/, et sont supprimables)
+ 3.15 : correction sur l'identification des styles en cas de valeurs multiples 
dans la propriete class
+        prise en compte de border-radius pour la limite des backgrounds (color 
et image)
+        ajout des proprietes CSS border-top-*, border-right-*, 
border-bottom-*, border-left-*
+        ajout de la propri\xE9t\xE9 CSS list-style-image (cf exemple 12)
+        pour la balise table, ajout de l'interpr\xE9tation de align="center" 
et align="right" (cf exemple 1)
+        correction dans le positionnement des images
+        correction de quelques bugs
+        ajout d'une fonction d'analyse des ressources HTML2PDFgetTimerDebug 
(cf d\xE9but du fichier html2pdf.class.php)        
+ 3.14 : ajout d'une langue (pt : Brazilian Portuguese language) et 
amelioration de la methode vueHTML (merci \xE0 Rodrigo)
+        correction du positionnement du contenu des DIVs. gestion des 
proprietes valign et align
+        ajout de la propriete CSS border-collapse (cf exemple 0)
+        ajout de la propriete CSS border-radius (cf exemple 1)
+        correction de quelques bugs
+ 3.13 : reecriture de la balise hr, avec prise en compte des styles (cf 
exemple 0)
+        ajout de la propriete backcolor pour la balise page (cf exemple 9)
+        ajout des proprietes backleft et backright pour la balise page afin de 
pouvoir changer les marges des pages (cf exemple 8)
+        nombreuses corrections sur les balises et les styles
+ 3.12 : ajout des balises ol, ul, li (cf exemple 12)
+        correction sur le calcul de la taille des td en cas de colspan et 
rowspan
+        ajout de la m\xE9thode setTestTdInOnePage afin de pouvoir desactiver 
le test sur la taille des TD (cf exemple 11)
+        correction de quelques bugs
+ 3.11 : ajout des balises div, p, pre, s
+        gestion des styles CSS position (relative, absolute), left, top, 
right, bottom  (cf exemple 10)
+        meilleur gestion des border : border-style, border-color, border-width 
 (cf exemple 10)
+        possibilit\xE9 d'indiquer les marges par d\xE9fault, via le 
constructeur (cf exemple 2)
+ 3.10a: correction pour compatibilit\xE9 php4 / php5
+ 3.10 : ajout des liens internes (cf exemple 7)
+        gestion complete des background : image, repeat, position, color (cf 
exemple 1)
+        gestion de underline, overline, linethrough (cf exemple 2)
+        correction de quelques bugs
+ 3.09 : mise \xE0 jour vers fpdf version 1.6, ajout de barcode, correction de 
l'affichage de certains caract\xE8res sp\xE9ciaux
+        correction du calcul de la hauteur de ligne de la balise br
+        detection en cas de contenu trop grand dans un TD
+        am\xE9lioration de la balise page (ajout de l'attribue pageset, avec 
les valeurs new et old)
+        ajout de FPDF_PROTECTION, accesible via $pdf->pdf->SetProtection(...)
+ 3.08 : version op\xE9rationnelle de page_header, ajout de page_footer, 
correction des borders des tableaux
+ 3.07 : correction de l'interpretation de cellspacing, am\xE9lioration de la 
balise page_header
+ 3.06 : premi\xE8re gestion de la balise page_header, correction des 
dimensions des tableaux
+ 3.05 : ajout de la propri\xE9t\xE9 vertical-align, ajout de la gestion des 
fichiers de langue
+ 3.04 : correction du saut de page automatique pour les tableaux. Ajout de 
propri\xE9t\xE9s \xE0 la balise PAGE
+ 3.03 : correction de bugs au niveau de la gestion des images PHP par FPDF, 
meilleure gestion des erreurs
+ 3.02 : ajout de la gestion des noms des couleurs, correction de la gestion 
des images g\xE9n\xE9r\xE9es par php, correction de quelques bugs
+ 3.01 : correction de quelques bugs, ajout d'une protection pour les balises 
non existantes
+ 3.00 : refont totale du calcul des tableaux. Prise en compte des colspan et 
rowspan
+ 2.85 : ajout de la propri\xE9t\xE9 cellspacing, nouvelle gestion des padding 
des tableaux (identique \xE0 l'html)
+ 2.80 : ajout des types de border dotted et dasheds
+ 2.75 : ajout des top, left, right, bottom pour padding et border
+ 2.70 : correction de la balise HR, ajout de la propri\xE9t\xE9 padding pour 
les table, th, td
+        correction des dimensions, les unit\xE9s px, mm, in, pt sont enfin 
r\xE9ellement reproduites, correction de font-size, border, ...
+        ajout d'une propri\xE9t\xE9 \xE0 la balise page : footer
+        correction dans l'affichage et le calcul des tables
+ 2.55 : v\xE9rification de la validit\xE9 du code (ouverture / fermeture) - 
ajout des unit\xE9s mm, in, pt
+ 2.50 : correction de nobreak, des marges, ajout de nombreuses balises
+ 2.40 : refonte totale de l'identification des styles CSS. Les h\xE9ritages 
marchent.
+ 2.39 : corrections diverses, ajout de certaines propri\xE9t\xE9s (bgcolor, 
...)
+ 2.38 : meilleur identification des propri\xE9t\xE9s border et color
+ 2.37 : nombreuses corrections : balise A, couleur de fond, retour \xE0 la 
ligne, gestion des images dans un texte, ...
+ 2.36 : ajout des balises STRONG, EM
+ 2.35 : am\xE9lioration de la gestion des feuilles de style
+ 2.31 : correction de quelques bugs
+ 2.30 : premi\xE8re version op\xE9rationnel des feuilles de style
+ 2.25 : ajout de la balise LINK pour le type text/css
+ 2.20 : premier jet de la gestion des feuilles de style, ajout de la balise 
STYLE
+ 2.15 : n'interpr\xE8te plus l'HTML en commentaire <!-- -->
+ 2.10 : ajout des balises H1 -> H6
+ 2.01 : correction de quelques bugs
+ 2.00 : premi\xE8re version diffus\xE9e
+
+Aide et Support :
+----------------
+ pour toutes questions et rapport de bug, merci d'utiliser exclusivement le 
lien de support ci-dessous.
+ Je ne r\xE9pondrais \xE0 aucune question en dehors, afin que tout le monde 
puisse profiter des r\xE9ponses.
+
+Informations :
+-------------
+ Programmation en PHP4
+
+ Programmeur : Spipu
+               email   : address@hidden
+               site    : http://html2pdf.fr/
+        wiki    : http://html2pdf.fr/wiki.php
+        support : http://html2pdf.fr/forum.php
+               
+Remerciement :
+-------------
+ * Olivier PLATHEY pour sa librairie Fpdf (http://www.fpdf.org/)
+ * yAronet pour l'hebergement du forum de support
+ * toutes les personnes qui m'ont aid\xE9 \xE0 d\xE9velopper cet librairie, et 
\xE0 traduire les diff\xE9rents textes


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_lisez_moi.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/00_fpdf_codebar.class.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/00_fpdf_codebar.class.php
                                (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/00_fpdf_codebar.class.php
        2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,237 @@
+<?php
+/*************************************************************************
+ * http://www.fpdf.org/en/script/script5.php
+ * 
+ * @author             Olivier
+ * 
+ * This script implements EAN13 and UPC-A barcodes (the second being a 
particular case of the first one). Bars are drawn directly in the PDF (no image 
is generated).
+ * EAN13(float x, float y, string barcode [, float h [, float w]])
+ * x: abscissa of barcode.
+ * y: ordinate of barcode.
+ * barcode: value of barcode.
+ * h: height of barcode. Default value: 16.
+ * w: width of a bar. Default value: 0.35.
+ * 
+ * UPC_A(float x, float y, string barcode [, float h [, float w]])
+ * 
+ * Same parameters.
+ * 
+ * An EAN13 barcode is made up of 13 digits, UPC-A of 12 (leading zeroes are 
added if necessary). The last digit is a check digit; if it's not supplied, it 
will be automatically computed. 
+ ************************************************************************/
+ 
+/*************************************************************************
+ * http://www.fpdf.org/en/script/script46.php
+ * 
+ * @author             The-eh
+ *
+ * This script implements Code 39 barcodes. A Code 39 barcode can encode a 
string with the following characters: digits (0 to 9), uppercase letters (A to 
Z) and 8 additional characters (- . space $ / + % *).
+ * Code39(float xpos, float ypos, string code [, float baseline [, float 
height]])
+ * xpos: abscissa of barcode
+ * ypos: ordinate of barcode
+ * code: value of barcode
+ * height: bar height
+ * baseline: corresponds to the width of a wide bar
+ ************************************************************************/
+
+
+if (!defined('__CLASS_FPDF_CODEBAR__'))
+{
+       define('__CLASS_FPDF_CODEBAR__', true);
+       
+       require_once(dirname(__FILE__).'/../_fpdf/fpdf.php');
+
+       class FPDF_Codebar extends FPDF
+       {
+               var $footer_param = array();
+               
+               function FPDF_Codebar($sens = 'P', $unit = 'mm', $format = 'A4')
+               {
+                       $this->FPDF($sens, $unit, $format);
+               }
+               
+               function BARCODE_EAN13($x,$y,$barcode,$h=10,$w=.35)
+               {
+                       return $this->Barcode($x,$y,$barcode,$h,$w,13);
+               }
+               
+               function BARCODE_UPC_A($x,$y,$barcode,$h=10,$w=.35)
+               {
+                       return $this->Barcode($x,$y,$barcode,$h,$w,12);
+               }
+               
+               function GetCheckDigit($barcode)
+               {
+                       //Compute the check digit
+                       $sum=0;
+                       for($i=1;$i<=11;$i+=2)
+                               $sum+=3*$barcode{$i};
+                       for($i=0;$i<=10;$i+=2)
+                               $sum+=$barcode{$i};
+                       $r=$sum%10;
+                       if($r>0)
+                               $r=10-$r;
+                       return $r;
+               }
+               
+               function TestCheckDigit($barcode)
+               {
+                       //Test validity of check digit
+                       $sum=0;
+                       for($i=1;$i<=11;$i+=2)
+                               $sum+=3*$barcode{$i};
+                       for($i=0;$i<=10;$i+=2)
+                               $sum+=$barcode{$i};
+                       return ($sum+$barcode{12})%10==0;
+               }
+               
+               function Barcode($x,$y,$barcode,$h,$w,$len)
+               {
+                       //Padding
+                       $barcode=str_pad($barcode,$len-1,'0',STR_PAD_LEFT);
+                       if($len==12)
+                               $barcode='0'.$barcode;
+                       //Add or control the check digit
+                       if(strlen($barcode)==12)
+                               $barcode.=$this->GetCheckDigit($barcode);
+                       elseif(!$this->TestCheckDigit($barcode))
+                               $this->Error('Incorrect check digit');
+                       //Convert digits to bars
+                       $codes=array(
+                               'A'=>array(
+                                       
'0'=>'0001101','1'=>'0011001','2'=>'0010011','3'=>'0111101','4'=>'0100011',
+                                       
'5'=>'0110001','6'=>'0101111','7'=>'0111011','8'=>'0110111','9'=>'0001011'),
+                               'B'=>array(
+                                       
'0'=>'0100111','1'=>'0110011','2'=>'0011011','3'=>'0100001','4'=>'0011101',
+                                       
'5'=>'0111001','6'=>'0000101','7'=>'0010001','8'=>'0001001','9'=>'0010111'),
+                               'C'=>array(
+                                       
'0'=>'1110010','1'=>'1100110','2'=>'1101100','3'=>'1000010','4'=>'1011100',
+                                       
'5'=>'1001110','6'=>'1010000','7'=>'1000100','8'=>'1001000','9'=>'1110100')
+                               );
+                       $parities=array(
+                               '0'=>array('A','A','A','A','A','A'),
+                               '1'=>array('A','A','B','A','B','B'),
+                               '2'=>array('A','A','B','B','A','B'),
+                               '3'=>array('A','A','B','B','B','A'),
+                               '4'=>array('A','B','A','A','B','B'),
+                               '5'=>array('A','B','B','A','A','B'),
+                               '6'=>array('A','B','B','B','A','A'),
+                               '7'=>array('A','B','A','B','A','B'),
+                               '8'=>array('A','B','A','B','B','A'),
+                               '9'=>array('A','B','B','A','B','A')
+                               );
+                       $code='101';
+                       $p=$parities[$barcode{0}];
+                       for($i=1;$i<=6;$i++)
+                               $code.=$codes[$p[$i-1]][$barcode{$i}];
+                       $code.='01010';
+                       for($i=7;$i<=12;$i++)
+                               $code.=$codes['C'][$barcode{$i}];
+                       $code.='101';
+                       //Draw bars
+                       for($i=0;$i<strlen($code);$i++)
+                       {
+                               if($code{$i}=='1')
+                                       $this->Rect($x+$i*$w,$y,$w,$h,'F');
+                       }
+                       
+                       $code_w = strlen($code)*$w;
+                       $code_t = substr($barcode,-$len);
+                       
+                       $code_f = $code_w/strlen($code_t)*$this->k/0.60;
+                       $code_h = $h+$code_f/$this->k;
+                       
+                       //Print text uder barcode
+                       $this->SetFont('Arial','',$code_f);
+                       $this->Text($x,$y+$h+0.90*$code_f/$this->k,$code_t);
+
+                       return array($code_w, $code_h);
+               }
+               
+               function BARCODE_CODE39($xpos, $ypos, $code,$height=10, 
$baseline=0.5 )
+               {
+               
+                       $wide = $baseline;
+                       $narrow = $baseline / 3 ; 
+                       $gap = $narrow;
+               
+                       $barChar['0'] = 'nnnwwnwnn';
+                       $barChar['1'] = 'wnnwnnnnw';
+                       $barChar['2'] = 'nnwwnnnnw';
+                       $barChar['3'] = 'wnwwnnnnn';
+                       $barChar['4'] = 'nnnwwnnnw';
+                       $barChar['5'] = 'wnnwwnnnn';
+                       $barChar['6'] = 'nnwwwnnnn';
+                       $barChar['7'] = 'nnnwnnwnw';
+                       $barChar['8'] = 'wnnwnnwnn';
+                       $barChar['9'] = 'nnwwnnwnn';
+                       $barChar['A'] = 'wnnnnwnnw';
+                       $barChar['B'] = 'nnwnnwnnw';
+                       $barChar['C'] = 'wnwnnwnnn';
+                       $barChar['D'] = 'nnnnwwnnw';
+                       $barChar['E'] = 'wnnnwwnnn';
+                       $barChar['F'] = 'nnwnwwnnn';
+                       $barChar['G'] = 'nnnnnwwnw';
+                       $barChar['H'] = 'wnnnnwwnn';
+                       $barChar['I'] = 'nnwnnwwnn';
+                       $barChar['J'] = 'nnnnwwwnn';
+                       $barChar['K'] = 'wnnnnnnww';
+                       $barChar['L'] = 'nnwnnnnww';
+                       $barChar['M'] = 'wnwnnnnwn';
+                       $barChar['N'] = 'nnnnwnnww';
+                       $barChar['O'] = 'wnnnwnnwn'; 
+                       $barChar['P'] = 'nnwnwnnwn';
+                       $barChar['Q'] = 'nnnnnnwww';
+                       $barChar['R'] = 'wnnnnnwwn';
+                       $barChar['S'] = 'nnwnnnwwn';
+                       $barChar['T'] = 'nnnnwnwwn';
+                       $barChar['U'] = 'wwnnnnnnw';
+                       $barChar['V'] = 'nwwnnnnnw';
+                       $barChar['W'] = 'wwwnnnnnn';
+                       $barChar['X'] = 'nwnnwnnnw';
+                       $barChar['Y'] = 'wwnnwnnnn';
+                       $barChar['Z'] = 'nwwnwnnnn';
+                       $barChar['-'] = 'nwnnnnwnw';
+                       $barChar['.'] = 'wwnnnnwnn';
+                       $barChar[' '] = 'nwwnnnwnn';
+                       $barChar['*'] = 'nwnnwnwnn';
+                       $barChar['$'] = 'nwnwnwnnn';
+                       $barChar['/'] = 'nwnwnnnwn';
+                       $barChar['+'] = 'nwnnnwnwn';
+                       $barChar['%'] = 'nnnwnwnwn';
+               
+                       $xpos_dep = $xpos;
+                       $code = '*'.strtoupper($code).'*';
+                       for($i=0; $i<strlen($code); $i++){
+                               $char = $code{$i};
+                               if(!isset($barChar[$char])){
+                                       $this->Error('Invalid character in 
barcode: '.$char);
+                               }
+                               $seq = $barChar[$char];
+                               for($bar=0; $bar<9; $bar++){
+                                       if($seq{$bar} == 'n'){
+                                               $lineWidth = $narrow;
+                                       }else{
+                                               $lineWidth = $wide;
+                                       }
+                                       if($bar % 2 == 0){
+                                               $this->Rect($xpos, $ypos, 
$lineWidth, $height, 'F');
+                                       }
+                                       $xpos += $lineWidth;
+                               }
+                               $xpos += $gap;
+                       }
+                       
+                       $code_w = $xpos-$xpos_dep;
+                       $code_t = $code;
+                       
+                       $code_f = $code_w/strlen($code_t)*$this->k/0.60/3;
+                       $code_h = $height+$code_f/$this->k;
+                       
+                       //Print text uder barcode
+                       $this->SetFont('Arial','',$code_f);
+                       
$this->Text($xpos_dep,$ypos+$height+0.90*$code_f/$this->k,$code_t);
+
+                       return array($code_w, $code_h);
+               }
+       }
+}
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/00_fpdf_codebar.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/01_fpdf_bookmark.class.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/01_fpdf_bookmark.class.php
                               (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/01_fpdf_bookmark.class.php
       2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,179 @@
+<?php
+/*************************************************************************
+ * http://www.fpdf.org/en/script/script1.php
+ * 
+ * @author             Olivier
+ * 
+ * This extension adds bookmark support. The method to add a bookmark is:
+ * 
+ * function Bookmark(string txt [, int level [, float y]])
+ * 
+ * txt: the bookmark title.
+ * level: the bookmark level (0 is top level, 1 is just below, and so on).
+ * y: the y position of the bookmark destination in the current page. -1 means 
the current position. Default value: 0.
+ * 
+ * The title must be encoded in ISO Latin-1.
+ ************************************************************************/
+/*************************************************************************
+ * http://www.fpdf.org/en/script/script13.php
+ * 
+ * @author             Min's
+ * 
+ * This class prints an index from the created bookmarks. 
+ ************************************************************************/
+ 
+if (!defined('__CLASS_FPDF_BOOKMARK__'))
+{
+       define('__CLASS_FPDF_BOOKMARK__', true);
+
+require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php');
+
+       class FPDF_BookMark extends FPDF_Codebar
+       {
+               var $outlines=array();
+               var $OutlineRoot;
+               
+               function FPDF_BookMark($orientation='P',$unit='mm',$format='A4')
+               {
+                       $this->FPDF_Codebar($orientation,$unit,$format);
+               
+               }
+               
+               function Bookmark($txt, $level=0, $y=0)
+               {
+                       if($y==-1) $y=$this->GetY();
+                       $this->outlines[]=array('t'=>$txt, 'l'=>$level, 
'y'=>($this->h-$y)*$this->k, 'p'=>$this->PageNo());
+               }
+               
+               function _putbookmarks()
+               {
+                       $nb=count($this->outlines);
+                       if($nb==0) return;
+                       $lru=array();
+                       $level=0;
+                       foreach($this->outlines as $i=>$o)
+                       {
+                               if($o['l']>0)
+                               {
+                                       $parent=$lru[$o['l']-1];
+                                       //Set parent and last pointers
+                                       $this->outlines[$i]['parent']=$parent;
+                                       $this->outlines[$parent]['last']=$i;
+                                       if($o['l']>$level)
+                                       {
+                                               //Level increasing: set first 
pointer
+                                               
$this->outlines[$parent]['first']=$i;
+                                       }
+                               }
+                               else
+                                       $this->outlines[$i]['parent']=$nb;
+                                       
+                               if($o['l']<=$level and $i>0)
+                               {
+                                       //Set prev and next pointers
+                                       $prev=$lru[$o['l']];
+                                       $this->outlines[$prev]['next']=$i;
+                                       $this->outlines[$i]['prev']=$prev;
+                               }
+                               $lru[$o['l']]=$i;
+                               $level=$o['l'];
+                       }
+                       
+                       //Outline items
+                       $n=$this->n+1;
+                       foreach($this->outlines as $i=>$o)
+                       {
+                               $this->_newobj();
+                               $this->_out('<</Title 
'.$this->_textstring($o['t']));
+                               $this->_out('/Parent '.($n+$o['parent']).' 0 
R');
+                               if(isset($o['prev']))
+                               $this->_out('/Prev '.($n+$o['prev']).' 0 R');
+                               if(isset($o['next']))
+                               $this->_out('/Next '.($n+$o['next']).' 0 R');
+                               if(isset($o['first']))
+                               $this->_out('/First '.($n+$o['first']).' 0 R');
+                               if(isset($o['last']))
+                               $this->_out('/Last '.($n+$o['last']).' 0 R');
+                               $this->_out(sprintf('/Dest [%d 0 R /XYZ 0 %.2F 
null]',1+2*$o['p'],$o['y']));
+                               $this->_out('/Count 0>>');
+                               $this->_out('endobj');
+                       }
+                       
+                       //Outline root
+                       $this->_newobj();
+                       $this->OutlineRoot=$this->n;
+                       $this->_out('<</Type /Outlines /First '.$n.' 0 R');
+                       $this->_out('/Last '.($n+$lru[0]).' 0 R>>');
+                       $this->_out('endobj');
+               }
+               
+               function _putresources()
+               {
+                       parent::_putresources();
+                       $this->_putbookmarks();
+               }
+               
+               function _putcatalog()
+               {
+                       parent::_putcatalog();
+                       if(count($this->outlines)>0)
+                       {
+                               $this->_out('/Outlines '.$this->OutlineRoot.' 0 
R');
+                               $this->_out('/PageMode /UseOutlines');
+                       }
+               }
+               
+               function CreateIndex(&$obj, $titre = 'Index', $size_title = 20, 
$size_bookmark = 15, $bookmark_title = true, $display_page = true)
+               {
+                       if ($bookmark_title) $this->Bookmark($titre, 0, -1);
+                       
+                       //Index title
+                       $this->SetFontSize($size_title);
+                       $this->Cell(0,5,$titre,0,1,'C');
+                       $this->SetFontSize($size_bookmark);
+                       $this->Ln(10);
+                       
+                       $size=sizeof($this->outlines);
+                       $PageCellSize=$this->GetStringWidth('p. 
'.$this->outlines[$size-1]['p'])+2;
+                       for ($i=0;$i<$size;$i++)
+                       {
+                               if ($this->getY()+$this->FontSize>=($this->h - 
$this->bMargin))
+                               {
+                                       $obj->setNewPage();
+                                       $this->SetFontSize($size_bookmark);
+                               }
+                               
+                               //Offset
+                               $level=$this->outlines[$i]['l'];
+                               if($level>0) $this->Cell($level*8);
+                               
+                               //Caption
+                               $str=$this->outlines[$i]['t'];
+                               $strsize=$this->GetStringWidth($str);
+                               
$avail_size=$this->w-$this->lMargin-$this->rMargin-$PageCellSize-($level*8)-4;
+                               while ($strsize>=$avail_size)
+                               {
+                                       $str=substr($str,0,-1);
+                                       $strsize=$this->GetStringWidth($str);
+                               }
+                               if ($display_page)
+                               {
+                                       
$this->Cell($strsize+2,$this->FontSize+2,$str);
+                               
+                                       //Filling dots
+                                       
$w=$this->w-$this->lMargin-$this->rMargin-$PageCellSize-($level*8)-($strsize+2);
+                                       $nb=$w/$this->GetStringWidth('.');
+                                       $dots=str_repeat('.',$nb);
+                                       
$this->Cell($w,$this->FontSize+2,$dots,0,0,'R');
+
+                                       //Page number
+                                       
$this->Cell($PageCellSize,$this->FontSize+2,'p. 
'.$this->outlines[$i]['p'],0,1,'R');
+                               }
+                               else
+                               {
+                                       
$this->Cell($strsize+2,$this->FontSize+2,$str, 0, 1);                           
        
+                               }
+                       }
+               }
+       }
+}


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/01_fpdf_bookmark.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/02_fpdf_formulaire.class.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/02_fpdf_formulaire.class.php
                             (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/02_fpdf_formulaire.class.php
     2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,227 @@
+<?php
+/**
+ * Logiciel : HTML2PDF - classe FPDF_Formulaire
+ * 
+ * permet la gestion de champs de formulaire dans un PDF 
+ * Inspir\xE9 des sources de http://fpdf.org/fr/script/script36.php et 
http://fpdf.org/fr/script/script40.php
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ */
+
+if (!defined('__CLASS_FPDF_FORMULAIRE__'))
+{
+       define('__CLASS_FPDF_FORMULAIRE__', true);
+       
+       require_once(dirname(__FILE__).'/01_fpdf_bookmark.class.php');
+       
+       class FPDF_Formulaire extends FPDF_BookMark
+       {
+               var $javascript = '';   //javascript code
+               var $n_js;                              //num\xE9ro de l'objet 
javascript
+               var $n_cata;                    //num\xE9ro de l'objet catalogue
+               var $ur;                                //
+               
+               function 
FPDF_Formulaire($orientation='P',$unit='mm',$format='A4')
+               {
+                       $this->FPDF_BookMark($orientation,$unit,$format);
+                       $this->PDFVersion='1.6';
+                       
+                       $this->ur = false;
+               }
+               
+                function _putuserrights()
+               {
+                       if (!$this->ur) return;
+                       $this->_out('/Perms<<');
+                       
+                       $this->_out('/UR3<<');
+                       $this->_out('/Reference[<<');
+                       $this->_out('/Type /SigRef');
+                       $this->_out('/TransformMethod /UR3');
+                       $this->_out('/TransformParams<<');
+                       $this->_out('/Type /TransformParams');
+                       $this->_out('/Annots[ /Create /Delete /Modify /Copy 
/Import /Export ]');
+                       $this->_out('/Document [ /FullSave ]');
+                       $this->_out('/Form[ /Add /FillIn /Delete 
/SubmitStandalone ]');
+                       $this->_out('/Signature[ /Modify ]');
+                       $this->_out('/V /2.2');
+                       $this->_out('>>');
+                       $this->_out('>>]');
+                       $this->_out('>>');
+                       $this->_out('>>');
+               }
+               
+               function _putresources()
+               {
+               
+                       parent::_putresources();
+                       $this->_putjavascript();
+               }
+               
+               function _putcatalog()
+               {
+                       $this->n_cata = $this->n;
+                       
+                       parent::_putcatalog();
+                       
+                       if (!empty($this->javascript)) $this->_out('/Names 
<</JavaScript '.($this->n_js).' 0 R>>');
+                       $this->_putuserrights();
+               }
+
+               /*
+               * Create a javascript PDF string.
+               * @access protected
+               * @author Johannes G\xFCntert, Nicola Asuni
+               */
+               function _putjavascript()
+               {
+                       if (empty($this->javascript)) return;
+                       
+                       // the following two lines are used to avoid form 
fields duplication after saving
+                       if ($this->ur)
+                       {
+                               $js1 = "if(!this.getField('pdfoldsaved')) 
this.addField('pdfoldsaved','text',0, [0, 1, 0, 1]);";
+                               $js2 = "getField('pdfoldsaved').value = 
'saved';";
+                       }
+                       else
+                       {
+                               $js1 = '';
+                               $js2 = '';      
+                       }
+               
+                       $this->_newobj();
+                       $this->n_js = $this->n;
+                       $this->_out('<<');
+                       $this->_out('/Names [(EmbeddedJS) '.($this->n + 1).' 0 
R ]');
+                       $this->_out('>>');
+                       $this->_out('endobj');
+                       $this->_newobj();
+                       $this->_out('<<');
+                       $this->_out('/S /JavaScript');
+                       $this->_out('/JS 
'.$this->_textstring($js1."\n".$this->javascript."\n".$js2));
+                       $this->_out('>>');
+                       $this->_out('endobj');
+               }
+               
+               /*
+               * Convert color to javascript color.
+               * @param string $color color name or #RRGGBB
+               * @access protected
+               * @author Denis Van Nuffelen, Nicola Asuni
+               */
+               function _JScolor($color)
+               {
+                       static $aColors = array('transparent', 'black', 
'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'dkGray', 'gray', 
'ltGray');
+                       if (substr($color,0,1) == '#')
+                       {
+                               return sprintf("['RGB',%.3F,%.3F,%.3F]", 
hexdec(substr($color,1,2))/255, hexdec(substr($color,3,2))/255, 
hexdec(substr($color,5,2))/255);
+                       }
+                       if (!in_array($color,$aColors))
+                       {
+                               $this->Error('Invalid color: '.$color);
+                       }
+                       
+                       return 'color.'.$color;
+               }
+               
+               /*
+               * Adds a javascript form field.
+               * @param string $type field type
+               * @param string $name field name
+               * @param int $x horizontal position
+               * @param int $y vertical position
+               * @param int $w width
+               * @param int $h height
+               * @param array $prop array of properties. Possible values are 
(http://www.adobe.com/devnet/acrobat/pdfs/js_developer_guide.pdf): 
<ul><li>rect: Position and size of field on page.</li><li>borderStyle: 
Rectangle border appearance.</li><li>strokeColor: Color of bounding 
rectangle.</li><li>lineWidth: Width of the edge of the surrounding 
rectangle.</li><li>rotation: Rotation of field in 90-degree 
increments.</li><li>fillColor: Background color of field (gray, transparent, 
RGB, or CMYK).</li><li>userName: Short description of field that appears on 
mouse-over.</li><li>readonly: Whether the user may change the field 
contents.</li><li>doNotScroll: Whether text fields may scroll.</li><li>display: 
Whether visible or hidden on screen or in print.</li><li>textFont: Text 
font.</li><li>textColor: Text color.</li><li>textSize: Text 
size.</li><li>richText: Rich text.</li><li>richValue: Text.</li><li>comb: Text 
comb format.</li><li>multiline: Text multiline.</li><li>charLimit: Text limit 
to number of characters.</li><li>fileSelect: Text file selection 
format.</li><li>password: Text password format.</li><li>alignment: Text layout 
in text fields.</li><li>buttonAlignX: X alignment of icon on button 
face.</li><li>buttonAlignY: Y alignment of icon on button 
face.</li><li>buttonFitBounds: Relative scaling of an icon to fit inside a 
button face.</li><li>buttonScaleHow: Relative scaling of an icon to fit inside 
a button face.</li><li>buttonScaleWhen: Relative scaling of an icon to fit 
inside a button face.</li><li>highlight: Appearance of a button when 
pushed.</li><li>style: Glyph style for checkbox and radio 
buttons.</li><li>numItems: Number of items in a combo box or list 
box.</li><li>editable: Whether the user can type in a combo 
box.</li><li>multipleSelection: Whether multiple list box items may be 
selected.</li></ul>
+               * @access protected
+               * @author Denis Van Nuffelen, Nicola Asuni
+               */
+               function _addfield($type, $name, $x, $y, $w, $h, $prop, 
$js_after = '')
+               {
+                       if (!isset($prop['textSize']))          
$prop['textSize']               = $this->FontSizePt;
+                       if (!isset($prop['strokeColor']))       
$prop['strokeColor']    = 'ltGray';
+                       if (isset($prop['value']))                      
$prop['value']                  = str_replace('"', '', $prop['value']);
+
+                       $this->SetFillColor(240);
+                       if ($w>0 && $h>0)
+                       {
+                               $d = 1/$this->k;
+                               $r = 0.1;
+                               $this->Rect($x+$d*0.5+$r, $y-$d*0.5+$r, 
$w-$d-2*$r, $h-$d-2*$r, 'F');
+                       }
+                       
+                       // javascript inclus                    
+                       $this->ur = true;
+                       
+                       // the followind avoid fields duplication after saving 
the document
+                       $this->javascript .= "if(this.getField('pdfoldsaved') 
&& this.getField('pdfoldsaved').value != 'saved') {";
+                       $this->javascript .= 
sprintf("f".$name."=this.addField('%s','%s',%d,[%.2F,%.2F,%.2F,%.2F]);", $name, 
$type, $this->PageNo()-1, $x*$this->k, ($this->h-$y)*$this->k+1, 
($x+$w)*$this->k, ($this->h-$y-$h)*$this->k+1)."\n";
+                       $this->javascript .= 
'f'.$name.'.textSize='.$this->FontSizePt.";\n";
+                       while (list($key, $val) = each($prop))
+                       {
+                               if (strcmp(substr($key, -5), 'Color') == 0)
+                                       $val = $this->_JScolor($val);
+                               else
+                                       $val = '"'.$val.'"';
+                               $this->javascript .= 
'f'.$name.'.'.$key.'='.$val.";\n";
+                       }
+                       
+                       $this->javascript .= '}';
+                       $this->javascript.= "\n".$js_after;
+               }
+               
+               function IncludeJS($script)
+               {
+                       $this->javascript .= $script;
+               }
+               
+               function form_InputHidden($name, $value)
+               {
+                       $prop = array('value' => $value);
+                       $js_after = '';
+                       $this->_addfield('checkbox', $name, 0, 0, 0.1, 0.1, 
$prop, $js_after);
+               }
+               
+               function form_InputCheckBox($name, $x, $y, $w, $checked)
+               {
+                       $prop = array();
+                       $prop['value'] = ($checked ? 'Yes' : 'Off');
+                       $js_after = '';
+                       $this->_addfield('checkbox', $name, $x, $y, $w, $w, 
$prop, $js_after);
+               }
+               
+               function form_InputRadio($name, $x, $y, $w)
+               {
+                       $prop = array();
+                       $js_after = '';
+                       $this->_addfield('radiobutton', $name, $x, $y, $w, $w, 
$prop, $js_after);
+               }
+               
+               function form_InputText($name, $x, $y, $w, $h, $prop)
+               {
+                       $js_after = '';
+                       $this->_addfield('text', $name, $x, $y, $w, $h, $prop, 
$js_after);
+               }
+               
+               function form_InputButton($name, $x, $y, $w, $h, $caption, 
$action, $prop)
+               {
+                       if (!isset($prop['borderStyle']))       
$prop['borderStyle']    = 'beveled';
+                       if (!isset($prop['fillColor']))         
$prop['fillColor']              = 'ltGray';
+                       if (!isset($prop['strokeColor']))       
$prop['strokeColor']    = 'black';
+
+                       $js_after = 
'f'.$name.".buttonSetCaption('".addslashes($caption)."');\n";
+                       $js_after.= 
'f'.$name.".setAction('MouseUp','".addslashes($action)."');\n";
+                       $js_after.= 'f'.$name.".highlight='push';\n";
+                       $js_after.= 'f'.$name.".print=false;\n";
+                       $this->_addfield('button', $name, $x, $y, $w, $h, 
$prop, $js_after);
+               }
+
+               function form_Select($name, $x, $y, $w, $h, $values, 
$multiligne, $prop)
+               {
+                       $type = ($multiligne ? 'listbox' : 'combobox');         
                
+                       $s = ''; foreach ($values as $value) { $s .= ($s ? ',' 
: '')."'".addslashes($value)."'"; }
+                       $js_after = 'f'.$name.'.setItems(['.$s."]);\n";
+                       $this->_addfield($type, $name, $x, $y, $w, $h, $prop, 
$js_after);
+               }
+       }
+}


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/02_fpdf_formulaire.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/99_fpdf_protection.class.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/99_fpdf_protection.class.php
                             (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/99_fpdf_protection.class.php
     2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,228 @@
+<?php
+/*************************************************************************
+ * http://www.fpdf.org/fr/script/script37.php
+ * 
+ * @author             Klemen Vodopivec
+ * 
+ * Ce script permet de prot\xE9ger le PDF, c'est-\xE0-dire emp\xEAcher 
l'utilisateur de copier son contenu, de l'imprimer ou de le modifier.
+ * 
+ * SetProtection([array permissions [, string user_pass [, string 
owner_pass]]])
+ * 
+ * permissions : l'ensemble des permissions. Vide par d\xE9faut (seule la 
lecture est autoris\xE9e).
+ * user_pass : mot de passe utilisateur. Vide par d\xE9faut.
+ * owner_pass : mot de passe propri\xE9taire. Par d\xE9faut, une valeur 
al\xE9atoire est choisie.
+ * 
+ * Le tableau des permissions est compos\xE9 de valeurs prises parmi les 
suivantes :
+ *             * copy : copie du texte et des images dans le presse-papier
+ *             * print : impression du document
+ *             * modify : modification (autre ques les annotations et les 
formulaires)
+ *             * annot-forms : ajout d'annotations ou de formulaires 
+ * 
+ * Remarque : la protection contre la modification concerne les personnes 
poss\xE9dant la version compl\xE8te d'Acrobat.
+ * 
+ * Si vous ne sp\xE9cifiez pas de mot de passe, le document s'ouvrira 
normalement. Si vous indiquez un mot de passe utilisateur,
+ * le lecteur de PDF le demandera avant d'afficher le document. Le mot de 
passe propri\xE9taire, s'il est diff\xE9rent de celui utilisateur,
+ * permet d'obtenir l'acc\xE8s complet.
+ * 
+ * Note : prot\xE9ger un document n\xE9cessite de le crypter, ce qui augmente 
le temps de traitement de mani\xE8re importante.
+ * Cela peut dans certains cas entra\xEEner un time-out au niveau de PHP, en 
particulier si le document contient des
+ * images ou des polices.
+ ************************************************************************/
+
+if (!defined('__CLASS_FPDF_PROTECTION__'))
+{
+       define('__CLASS_FPDF_PROTECTION__', true);
+       
+       require_once(dirname(__FILE__).'/02_fpdf_formulaire.class.php');
+       
+       class FPDF_Protection extends FPDF_Formulaire
+       {
+               var $encrypted;                 //whether document is protected
+               var $Uvalue;                    //U entry in pdf document
+               var $Ovalue;                    //O entry in pdf document
+               var $Pvalue;                    //P entry in pdf document
+               var $enc_obj_id;                //encryption object id
+               var $last_rc4_key;              //last RC4 key encrypted 
(cached for optimisation)
+               var $last_rc4_key_c;    //last RC4 computed key
+       
+               function 
FPDF_Protection($orientation='P',$unit='mm',$format='A4')
+               {
+                       $this->FPDF_Formulaire($orientation,$unit,$format);
+       
+                       $this->encrypted=false;
+                       $this->last_rc4_key='';
+                       
$this->padding="\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08".
+                                                       
"\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
+               }
+       
+               /**
+               * Function to set permissions as well as user and owner 
passwords
+               *
+               * - permissions is an array with values taken from the 
following list:
+               *       copy, print, modify, annot-forms
+               *       If a value is present it means that the permission is 
granted
+               * - If a user password is set, user will be prompted before 
document is opened
+               * - If an owner password is set, document can be opened in 
privilege mode with no
+               *       restriction if that password is entered
+               */
+               function 
SetProtection($permissions=array(),$user_pass='',$owner_pass=null)
+               {
+                       $options = array('print' => 4, 'modify' => 8, 'copy' => 
16, 'annot-forms' => 32 );
+                       $protection = 192;
+                       foreach($permissions as $permission){
+                               if (!isset($options[$permission]))
+                                       $this->Error('Incorrect permission: 
'.$permission);
+                               $protection += $options[$permission];
+                       }
+                       if ($owner_pass === null)
+                               $owner_pass = uniqid(rand());
+                       $this->encrypted = true;
+                       $this->_generateencryptionkey($user_pass, $owner_pass, 
$protection);
+               }
+
+/****************************************************************************
+*                                                                              
                                                                        *
+*                                                              Private methods 
                                                        *
+*                                                                              
                                                                        *
+****************************************************************************/
+
+               function _putstream($s)
+               {
+                       if ($this->encrypted) {
+                               $s = $this->_RC4($this->_objectkey($this->n), 
$s);
+                       }
+                       parent::_putstream($s);
+               }
+       
+               function _textstring($s)
+               {
+                       if ($this->encrypted) {
+                               $s = $this->_RC4($this->_objectkey($this->n), 
$s);
+                       }
+                       return parent::_textstring($s);
+               }
+       
+               /**
+               * Compute key depending on object number where the encrypted 
data is stored
+               */
+               function _objectkey($n)
+               {
+                       return 
substr($this->_md5_16($this->encryption_key.pack('VXxx',$n)),0,10);
+               }
+       
+               function _putresources()
+               {
+                       parent::_putresources();
+                       if ($this->encrypted) {
+                               $this->_newobj();
+                               $this->enc_obj_id = $this->n;
+                               $this->_out('<<');
+                               $this->_putencryption();
+                               $this->_out('>>');
+                               $this->_out('endobj');
+                       }
+               }
+       
+               function _putencryption()
+               {
+                       $this->_out('/Filter /Standard');
+                       $this->_out('/V 1');
+                       $this->_out('/R 2');
+                       $this->_out('/O ('.$this->_escape($this->Ovalue).')');
+                       $this->_out('/U ('.$this->_escape($this->Uvalue).')');
+                       $this->_out('/P '.$this->Pvalue);
+               }
+       
+               function _puttrailer()
+               {
+                       parent::_puttrailer();
+                       if ($this->encrypted) {
+                               $this->_out('/Encrypt '.$this->enc_obj_id.' 0 
R');
+                               $this->_out('/ID [()()]');
+                       }
+               }
+       
+               /**
+               * RC4 is the standard encryption algorithm used in PDF format
+               */
+               function _RC4($key, $text)
+               {
+                       if ($this->last_rc4_key != $key) {
+                               $k = str_repeat($key, 256/strlen($key)+1);
+                               $rc4 = range(0,255);
+                               $j = 0;
+                               for ($i=0; $i<256; $i++){
+                                       $t = $rc4[$i];
+                                       $j = ($j + $t + ord($k{$i})) % 256;
+                                       $rc4[$i] = $rc4[$j];
+                                       $rc4[$j] = $t;
+                               }
+                               $this->last_rc4_key = $key;
+                               $this->last_rc4_key_c = $rc4;
+                       } else {
+                               $rc4 = $this->last_rc4_key_c;
+                       }
+       
+                       $len = strlen($text);
+                       $a = 0;
+                       $b = 0;
+                       $out = '';
+                       for ($i=0; $i<$len; $i++){
+                               $a = ($a+1)%256;
+                               $t= $rc4[$a];
+                               $b = ($b+$t)%256;
+                               $rc4[$a] = $rc4[$b];
+                               $rc4[$b] = $t;
+                               $k = $rc4[($rc4[$a]+$rc4[$b])%256];
+                               $out.=chr(ord($text{$i}) ^ $k);
+                       }
+       
+                       return $out;
+               }
+       
+               /**
+               * Get MD5 as binary string
+               */
+               function _md5_16($string)
+               {
+                       return pack('H*',md5($string));
+               }
+       
+               /**
+               * Compute O value
+               */
+               function _Ovalue($user_pass, $owner_pass)
+               {
+                       $tmp = $this->_md5_16($owner_pass);
+                       $owner_RC4_key = substr($tmp,0,5);
+                       return $this->_RC4($owner_RC4_key, $user_pass);
+               }
+       
+               /**
+               * Compute U value
+               */
+               function _Uvalue()
+               {
+                       return $this->_RC4($this->encryption_key, 
$this->padding);
+               }
+       
+               /**
+               * Compute encryption key
+               */
+               function _generateencryptionkey($user_pass, $owner_pass, 
$protection)
+               {
+                       // Pad passwords
+                       $user_pass = substr($user_pass.$this->padding,0,32);
+                       $owner_pass = substr($owner_pass.$this->padding,0,32);
+                       // Compute O value
+                       $this->Ovalue = $this->_Ovalue($user_pass,$owner_pass);
+                       // Compute encyption key
+                       $tmp = 
$this->_md5_16($user_pass.$this->Ovalue.chr($protection)."\xFF\xFF\xFF");
+                       $this->encryption_key = substr($tmp,0,5);
+                       // Compute U value
+                       $this->Uvalue = $this->_Uvalue();
+                       // Compute P value
+                       $this->Pvalue = -(($protection^255)+1);
+               }
+       }
+}


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/99_fpdf_protection.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/mypdf.class.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/mypdf.class.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/mypdf.class.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,527 @@
+<?php
+/**
+ * Logiciel : HTML2PDF - classe MyPDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * @version            3.25 - 07/10/2009
+ */
+
+if (!defined('__CLASS_MYPDF__'))
+{
+       define('__CLASS_MYPDF__', true);
+       
+       require_once(dirname(__FILE__).'/99_fpdf_protection.class.php');        
        // classe fpdf_protection
+
+       class MyPDF extends FPDF_Protection
+       {
+               var $footer_param = array();
+               
+               var $underline          = false;
+               var $overline           = false;
+               var $linethrough        = false;
+                       
+               function MyPDF($sens = 'P', $unit = 'mm', $format = 'A4')
+               {
+                       $this->underline        = false;
+                       $this->overline         = false;
+                       $this->linethrough      = false;
+                       
+                       $this->FPDF_Protection($sens, $unit, $format);
+                       $this->AliasNbPages();
+                       $this->SetMyFooter();
+               }
+               
+               function SetMyFooter($page = null, $date = null, $heure = null, 
$form = null)
+               {
+                       if ($page===null)       $page   = null;
+                       if ($date===null)       $date   = null;
+                       if ($heure===null)      $heure  = null;
+                       if ($form===null)       $form   = null;
+                       
+                       $this->footer_param = array('page' => $page, 'date' => 
$date, 'heure' => $heure, 'form' => $form);      
+               }
+               
+               function Footer()
+               { 
+                       $txt = '';
+                       if ($this->footer_param['form'])        $txt = 
(@HTML2PDF::textGET('pdf05'));
+                       if ($this->footer_param['date'] && 
$this->footer_param['heure'])        $txt.= ($txt ? ' - ' : 
'').(@HTML2PDF::textGET('pdf03'));
+                       if ($this->footer_param['date'] && 
!$this->footer_param['heure'])       $txt.= ($txt ? ' - ' : 
'').(@HTML2PDF::textGET('pdf01'));
+                       if (!$this->footer_param['date'] && 
$this->footer_param['heure'])       $txt.= ($txt ? ' - ' : 
'').(@HTML2PDF::textGET('pdf02'));
+                       if ($this->footer_param['page'])        $txt.= ($txt ? 
' - ' : '').(@HTML2PDF::textGET('pdf04'));
+                       
+                       $txt = str_replace('[[date_d]]',        date('d'),      
                $txt);
+                       $txt = str_replace('[[date_m]]',        date('m'),      
                $txt);
+                       $txt = str_replace('[[date_y]]',        date('Y'),      
                $txt);
+                       $txt = str_replace('[[date_h]]',        date('H'),      
                $txt);
+                       $txt = str_replace('[[date_i]]',        date('i'),      
                $txt);
+                       $txt = str_replace('[[date_s]]',        date('s'),      
                $txt);
+                       $txt = str_replace('[[current]]',       
$this->PageNo(),        $txt);
+                       $txt = str_replace('[[nb]]',            '{nb}',         
                $txt);
+
+                       if (strlen($txt)>0)
+                       {
+                               $this->SetY(-11);
+                               $this->setOverline(false);
+                               $this->setLinethrough(false);
+                               $this->SetFont('Arial','I',8);
+                               $this->Cell(0, 10, $txt, 0, 0, 'R');
+                       }
+               }
+               
+               // red\xE9finition de la fonction Image de FPDF afin de 
rajouter la gestion des fichiers PHP
+               function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', 
$link='')
+               {
+                       //Put an image on the page
+                       if(!isset($this->images[$file]))
+                       {
+                               //First use of this image, get info
+                               if($type=='')
+                               {
+                                       /* MODIFICATION HTML2PDF pour le 
support des images PHP */
+                                       $type = explode('?', $file);
+                                       $type = pathinfo($type[0]);
+                                       if (!isset($type['extension']) || 
!$type['extension'])
+                                               $this->Error('Image file has no 
extension and no type was specified: '.$file);
+                                               
+                                       $type = $type['extension'];
+                                       /* FIN MODIFICATION */
+                               }
+
+                               $type=strtolower($type);
+
+                               /* MODIFICATION HTML2PDF pour le support des 
images PHP */
+                               if ($type=='php')
+                               {
+                                       // identification des infos
+                                       address@hidden($file);
+                                       if (!$infos) $this->Error('Unsupported 
image : '.$file);
+                               
+                                       // identification du type
+                                       $type = explode('/', $infos['mime']);
+                                       if ($type[0]!='image') 
$this->Error('Unsupported image : '.$file);
+                                       $type = $type[1];
+                               }
+                               /* FIN MODIFICATION */
+                               
+                               if($type=='jpeg')
+                                       $type='jpg';
+                               $mtd='_parse'.$type;
+                               if(!method_exists($this,$mtd))
+                                       $this->Error('Unsupported image type: 
'.$type);
+                               $info=$this->$mtd($file);
+                               $info['i']=count($this->images)+1;
+                               $this->images[$file]=$info;
+                       }
+                       else
+                               $info=$this->images[$file];
+                       //Automatic width and height calculation if needed
+                       if($w==0 && $h==0)
+                       {
+                               //Put image at 72 dpi
+                               $w=$info['w']/$this->k;
+                               $h=$info['h']/$this->k;
+                       }
+                       elseif($w==0)
+                               $w=$h*$info['w']/$info['h'];
+                       elseif($h==0)
+                               $h=$w*$info['h']/$info['w'];
+                       //Flowing mode
+                       if($y===null)
+                       {
+                               if($this->y+$h>$this->PageBreakTrigger && 
!$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
+                               {
+                                       //Automatic page break
+                                       $x2=$this->x;
+                                       
$this->AddPage($this->CurOrientation,$this->CurPageFormat);
+                                       $this->x=$x2;
+                               }
+                               $y=$this->y;
+                               $this->y+=$h;
+                       }
+                       if($x===null)
+                               $x=$this->x;
+                               
+                       $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d 
Do 
Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
+                       if($link)
+                               $this->Link($x,$y,$w,$h,$link);
+               }
+               
+               // Draw a polygon
+               // Auteur       : Andrew Meier
+               // Licence      : Freeware
+               function Polygon($points, $style='D')
+               {
+                       if($style=='F')                                         
        $op='f';
+                       elseif($style=='FD' or $style=='DF')    $op='b';
+                       else                                                    
                $op='s';
+               
+                       $h = $this->h;
+                       $k = $this->k;
+               
+                       $points_string = '';
+                       for($i=0; $i<count($points); $i+=2)
+                       {
+                               $points_string .= sprintf('%.2F %.2F', 
$points[$i]*$k, ($h-$points[$i+1])*$k);
+                               if($i==0)       $points_string .= ' m ';
+                               else            $points_string .= ' l ';
+                       }
+                       $this->_out($points_string . $op);
+               }
+               
+               function setOverline($value = true)
+               {
+                       $this->overline = $value;
+               }
+
+               function setLinethrough($value = true)
+               {
+                       $this->linethrough = $value;
+               }
+               
+               // red\xE9finition de la methode Text de FPDF afin de rajouter 
la gestion des overline et linethrough
+               function Text($x, $y, $txt)
+               {
+                       //Output a string
+                       $s=sprintf('BT %.2F %.2F Td (%s) Tj 
ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
+
+                       /* MODIFICATION HTML2PDF pour le support de underline, 
overline, linethrough */
+                       if ($txt!='')
+                       {
+                               if($this->underline)    $s.=' 
'.$this->_dounderline($x,$y,$txt);
+                               if($this->overline)             $s.=' 
'.$this->_dooverline($x,$y,$txt);
+                               if($this->linethrough)  $s.=' 
'.$this->_dolinethrough($x,$y,$txt);
+                       }
+                       /* FIN MODIFICATION */
+
+                       if($this->ColorFlag)
+                               $s='q '.$this->TextColor.' '.$s.' Q';
+                       $this->_out($s);
+               }
+
+               // red\xE9finition de la methode Cell de FPDF afin de rajouter 
la gestion des overline et linethrough
+               function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', 
$fill=false, $link='')
+               {
+                       //Output a cell
+                       $k=$this->k;
+                       if($this->y+$h>$this->PageBreakTrigger && 
!$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
+                       {
+                               //Automatic page break
+                               $x=$this->x;
+                               $ws=$this->ws;
+                               if($ws>0)
+                               {
+                                       $this->ws=0;
+                                       $this->_out('0 Tw');
+                               }
+                               
$this->AddPage($this->CurOrientation,$this->CurPageFormat);
+                               $this->x=$x;
+                               if($ws>0)
+                               {
+                                       $this->ws=$ws;
+                                       $this->_out(sprintf('%.3F Tw',$ws*$k));
+                               }
+                       }
+                       if($w==0)
+                               $w=$this->w-$this->rMargin-$this->x;
+                       $s='';
+                       if($fill || $border==1)
+                       {
+                               if($fill)
+                                       $op=($border==1) ? 'B' : 'f';
+                               else
+                                       $op='S';
+                               $s=sprintf('%.2F %.2F %.2F %.2F re %s 
',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
+                       }
+                       if(is_string($border))
+                       {
+                               $x=$this->x;
+                               $y=$this->y;
+                               if(strpos($border,'L')!==false)
+                                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
+                               if(strpos($border,'T')!==false)
+                                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
+                               if(strpos($border,'R')!==false)
+                                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+                               if(strpos($border,'B')!==false)
+                                       $s.=sprintf('%.2F %.2F m %.2F %.2F l S 
',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+                       }
+                       if($txt!=='')
+                       {
+                               if($align=='R')
+                                       
$dx=$w-$this->cMargin-$this->GetStringWidth($txt);
+                               elseif($align=='C')
+                                       $dx=($w-$this->GetStringWidth($txt))/2;
+                               else
+                                       $dx=$this->cMargin;
+                               if($this->ColorFlag)
+                                       $s.='q '.$this->TextColor.' ';
+                               
$txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
+                               $s.=sprintf('BT %.2F %.2F Td (%s) Tj 
ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
+                               
+                               /* MODIFICATION HTML2PDF pour le support de 
underline, overline, linethrough */
+                               if($this->underline)    $s.=' 
'.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
+                               if($this->overline)             $s.=' 
'.$this->_dooverline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
+                               if($this->linethrough)  $s.=' 
'.$this->_dolinethrough($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
+                               /* FIN MODIFICATION */
+                               
+                               if($this->ColorFlag)
+                                       $s.=' Q';
+                               if($link)
+                                       
$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
+                       }
+                       if($s)
+                               $this->_out($s);
+                       $this->lasth=$h;
+                       if($ln>0)
+                       {
+                               //Go to next line
+                               $this->y+=$h;
+                               if($ln==1)
+                                       $this->x=$this->lMargin;
+                       }
+                       else
+                               $this->x+=$w;
+               }
+
+               function _dounderline($x, $y, $txt)
+               {
+                       //Underline text
+                       $up=$this->CurrentFont['up'];
+                       $ut=$this->CurrentFont['ut'];
+
+                       $p_x = $x*$this->k;
+                       $p_y = 
($this->h-($y-$up/1000*$this->FontSize))*$this->k;
+                       $p_w = 
($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k;
+                       $p_h = -$ut/1000*$this->FontSizePt;
+
+                       return sprintf('%.2F %.2F %.2F %.2F re 
f',$p_x,$p_y,$p_w,$p_h);
+               }
+               
+               function _dooverline($x, $y, $txt)
+               {
+                       //Overline text
+                       $up=$this->CurrentFont['up'];
+                       $ut=$this->CurrentFont['ut'];
+
+                       $p_x = $x*$this->k;
+                       $p_y = 
($this->h-($y-(1000+1.5*$up)/1000*$this->FontSize))*$this->k;
+                       $p_w = 
($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k;
+                       $p_h = -$ut/1000*$this->FontSizePt;
+                       
+                       return sprintf('%.2F %.2F %.2F %.2F re 
f',$p_x,$p_y,$p_w,$p_h);
+               }
+               
+               function _dolinethrough($x, $y, $txt)
+               {
+                       //Linethrough text
+                       $up=$this->CurrentFont['up'];
+                       $ut=$this->CurrentFont['ut'];
+
+                       $p_x = $x*$this->k;
+                       $p_y = 
($this->h-($y-(1000+2.5*$up)/2000*$this->FontSize))*$this->k;
+                       $p_w = 
($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k;
+                       $p_h = -$ut/1000*$this->FontSizePt;
+                       
+                       return sprintf('%.2F %.2F %.2F %.2F re 
f',$p_x,$p_y,$p_w,$p_h);
+               }
+               
+               function clippingPathOpen($x = null, $y = null, $w = null, $h = 
null, $coin_TL=null, $coin_TR=null, $coin_BL=null, $coin_BR=null)
+               {
+                       $path = '';
+                       if ($x!==null && $y!==null && $w!==null && $h!==null)
+                       {
+                               $x1 = $x*$this->k;
+                               $y1 = ($this->h-$y)*$this->k;
+
+                               $x2 = ($x+$w)*$this->k;
+                               $y2 = ($this->h-$y)*$this->k;
+
+                               $x3 = ($x+$w)*$this->k;
+                               $y3 = ($this->h-$y-$h)*$this->k;
+
+                               $x4 = $x*$this->k;
+                               $y4 = ($this->h-$y-$h)*$this->k;
+                               
+                               if ($coin_TL || $coin_TR || $coin_BL || 
$coin_BR)
+                               {
+                                       if ($coin_TL) { $coin_TL[0] = 
$coin_TL[0]*$this->k; $coin_TL[1] =-$coin_TL[1]*$this->k; }
+                                       if ($coin_TR) { $coin_TR[0] = 
$coin_TR[0]*$this->k; $coin_TR[1] =-$coin_TR[1]*$this->k; }
+                                       if ($coin_BL) { $coin_BL[0] = 
$coin_BL[0]*$this->k; $coin_BL[1] =-$coin_BL[1]*$this->k; }
+                                       if ($coin_BR) { $coin_BR[0] = 
$coin_BR[0]*$this->k; $coin_BR[1] =-$coin_BR[1]*$this->k; }
+
+                                       $MyArc = 4/3 * (sqrt(2) - 1);
+                                       
+                                       if ($coin_TL)
+                                               $path.= sprintf('%.2F %.2F m ', 
$x1+$coin_TL[0], $y1);
+                                       else
+                                               $path.= sprintf('%.2F %.2F m ', 
$x1, $y1);
+                                       
+                                       if ($coin_TR)
+                                       {
+                                               $xt1 = 
($x2-$coin_TR[0])+$coin_TR[0]*$MyArc;
+                                               $yt1 = 
($y2+$coin_TR[1])-$coin_TR[1];
+                                               $xt2 = 
($x2-$coin_TR[0])+$coin_TR[0];
+                                               $yt2 = 
($y2+$coin_TR[1])-$coin_TR[1]*$MyArc;
+
+                                               $path.= sprintf('%.2F %.2F l ', 
$x2-$coin_TR[0], $y2);                                          
+                                               $path.= sprintf('%.2F %.2F %.2F 
%.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x2, $y2+$coin_TR[1]);
+                                       }
+                                       else
+                                               $path.= sprintf('%.2F %.2F l ', 
$x2, $y2);
+
+                                       if ($coin_BR)
+                                       {
+                                               $xt1 = 
($x3-$coin_BR[0])+$coin_BR[0];
+                                               $yt1 = 
($y3-$coin_BR[1])+$coin_BR[1]*$MyArc;
+                                               $xt2 = 
($x3-$coin_BR[0])+$coin_BR[0]*$MyArc;
+                                               $yt2 = 
($y3-$coin_BR[1])+$coin_BR[1];
+
+                                               $path.= sprintf('%.2F %.2F l ', 
$x3, $y3-$coin_BR[1]);                                          
+                                               $path.= sprintf('%.2F %.2F %.2F 
%.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x3-$coin_BR[0], $y3);
+                                       }
+                                       else
+                                               $path.= sprintf('%.2F %.2F l ', 
$x3, $y3);
+
+                                       if ($coin_BL)
+                                       {
+                                               $xt1 = 
($x4+$coin_BL[0])-$coin_BL[0]*$MyArc;
+                                               $yt1 = 
($y4-$coin_BL[1])+$coin_BL[1];
+                                               $xt2 = 
($x4+$coin_BL[0])-$coin_BL[0];
+                                               $yt2 = 
($y4-$coin_BL[1])+$coin_BL[1]*$MyArc;
+
+                                               $path.= sprintf('%.2F %.2F l ', 
$x4+$coin_BL[0], $y4);                                          
+                                               $path.= sprintf('%.2F %.2F %.2F 
%.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x4, $y4-$coin_BL[1]);
+                                       }
+                                       else
+                                               $path.= sprintf('%.2F %.2F l ', 
$x4, $y4);
+                               
+                                       if ($coin_TL)
+                                       {
+                                               $xt1 = 
($x1+$coin_TL[0])-$coin_TL[0];
+                                               $yt1 = 
($y1+$coin_TL[1])-$coin_TL[1]*$MyArc;
+                                               $xt2 = 
($x1+$coin_TL[0])-$coin_TL[0]*$MyArc;
+                                               $yt2 = 
($y1+$coin_TL[1])-$coin_TL[1];
+
+                                               $path.= sprintf('%.2F %.2F l ', 
$x1, $y1+$coin_TL[1]);                                          
+                                               $path.= sprintf('%.2F %.2F %.2F 
%.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x1+$coin_TL[0], $y1);
+                                       }
+                               }
+                               else
+                               {
+                                       $path.= sprintf('%.2F %.2F m ', $x1, 
$y1);
+                                       $path.= sprintf('%.2F %.2F l ', $x2, 
$y2);
+                                       $path.= sprintf('%.2F %.2F l ', $x3, 
$y3);
+                                       $path.= sprintf('%.2F %.2F l ', $x4, 
$y4);
+                               }
+
+                               $path.= ' h W n';
+                       }
+                       $this->_out('q '.$path.' ');                    
+               }
+               
+               function clippingPathClose()
+               {
+                       $this->_out(' Q');
+               }
+               
+               function drawCourbe($ext1_x, $ext1_y, $ext2_x, $ext2_y, 
$int1_x, $int1_y, $int2_x, $int2_y, $cen_x, $cen_y)
+               {
+                       $MyArc = 4/3 * (sqrt(2) - 1);
+                       
+                       $ext1_x = $ext1_x*$this->k; $ext1_y = 
($this->h-$ext1_y)*$this->k;
+                       $ext2_x = $ext2_x*$this->k; $ext2_y = 
($this->h-$ext2_y)*$this->k;
+                       $int1_x = $int1_x*$this->k; $int1_y = 
($this->h-$int1_y)*$this->k;
+                       $int2_x = $int2_x*$this->k; $int2_y = 
($this->h-$int2_y)*$this->k;
+                       $cen_x  = $cen_x*$this->k;      $cen_y  = 
($this->h-$cen_y) *$this->k;
+                       
+                       $path = '';
+                       
+                       if ($ext1_x-$cen_x!=0)
+                       {
+                               $xt1 = $cen_x+($ext1_x-$cen_x);
+                               $yt1 = $cen_y+($ext2_y-$cen_y)*$MyArc;
+                               $xt2 = $cen_x+($ext1_x-$cen_x)*$MyArc;
+                               $yt2 = $cen_y+($ext2_y-$cen_y);
+                       }
+                       else
+                       {
+                               $xt1 = $cen_x+($ext2_x-$cen_x)*$MyArc;
+                               $yt1 = $cen_y+($ext1_y-$cen_y);
+                               $xt2 = $cen_x+($ext2_x-$cen_x);
+                               $yt2 = $cen_y+($ext1_y-$cen_y)*$MyArc;
+
+                       }
+
+                       $path.= sprintf('%.2F %.2F m ', $ext1_x, $ext1_y);
+                       $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', 
$xt1, $yt1, $xt2, $yt2, $ext2_x, $ext2_y);
+
+                       if ($int1_x-$cen_x!=0)
+                       {
+                               $xt1 = $cen_x+($int1_x-$cen_x)*$MyArc;
+                               $yt1 = $cen_y+($int2_y-$cen_y);
+                               $xt2 = $cen_x+($int1_x-$cen_x);
+                               $yt2 = $cen_y+($int2_y-$cen_y)*$MyArc;
+                       }
+                       else
+                       {
+                               $xt1 = $cen_x+($int2_x-$cen_x);
+                               $yt1 = $cen_y+($int1_y-$cen_y)*$MyArc;
+                               $xt2 = $cen_x+($int2_x-$cen_x)*$MyArc;
+                               $yt2 = $cen_y+($int1_y-$cen_y);
+
+                       }
+                       
+                       $path.= sprintf('%.2F %.2F l ', $int2_x, $int2_y);
+                       $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', 
$xt1, $yt1, $xt2, $yt2, $int1_x, $int1_y);
+
+                       $this->_out($path . 'f');
+               }
+               
+               function startTransform()
+               {
+                       $this->_out('q');
+               }
+               
+               function stopTransform()
+               {
+                       $this->_out('Q');
+               }
+
+               function setTranslate($t_x, $t_y)
+               {
+                       // matrice de transformation
+                       $tm[0]=1;
+                       $tm[1]=0;
+                       $tm[2]=0;
+                       $tm[3]=1;
+                       $tm[4]=$t_x*$this->k;
+                       $tm[5]=-$t_y*$this->k;
+                       
+                       $this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F cm', 
$tm[0],$tm[1],$tm[2],$tm[3],$tm[4],$tm[5]));
+               }
+
+               
+               function setRotation($angle, $x='', $y='')
+               {
+                       if($x === '') $x=$this->x;
+                       if($y === '') $y=$this->y;
+                       
+                       $y=($this->h-$y)*$this->k;
+                       $x*=$this->k;
+                       
+                       // matrice de transformation
+                       $tm[0]=cos(deg2rad($angle));
+                       $tm[1]=sin(deg2rad($angle));
+                       $tm[2]=-$tm[1];
+                       $tm[3]=$tm[0];
+                       $tm[4]=$x+$tm[1]*$y-$tm[0]*$x;
+                       $tm[5]=$y-$tm[0]*$y-$tm[1]*$x;
+                       
+                       $this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F cm', 
$tm[0],$tm[1],$tm[2],$tm[3],$tm[4],$tm[5]));
+               }
+       }
+}


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_mypdf/mypdf.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/_read_me.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/_read_me.txt            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/_read_me.txt    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,106 @@
+*********************************************************
+** This program is distributed under the LGPL License, **
+** for more information see file _LGPL.txt or          **
+** http://www.gnu.org/licenses/lgpl.html               **
+**                                                     **
+**  Copyright 2000-2009 by Laurent Minguet             **
+*********************************************************
+*******************************
+* HTML2PDF v3.25 - 2009-10-07 *
+*******************************
+
+How to use :
+------------
+ - You need at least PHP 4.3.10
+ 
+ - Look at the examples provided to see how it works.
+
+ - forms work only with ADOBE READER 8 and 9.0
+ 
+ - It is very important to provide valid HTML 4.01 to the converter,
+   but only what is in the <body>
+
+ - for borders: it is advised that they are like "solid 1mm #000000"
+
+ - for padding, they are applicable only on tags table, th, td, div, li
+
+ - You can chose the encoding. A specific font must be used. The encodings 
available are: 
+    cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1257, cp1258, cp874,
+    ISO-8859-1, ISO-8859-2, ISO-8859-4, ISO-8859-5, ISO-8859-7, ISO-8859-9,
+    ISO-8859-11, ISO-8859-15, ISO-8859-16, KOI8-R, KOI8-U
+  To use it: $html2pdf->setEncoding('cp1250');
+  
+ - The possibility to protect your PDF is present, CF Example 7. It uses the 
script
+   fpdf_protection of Klemen Vodopivec.
+       
+ - Some tests can be enabled (true) or disabled (false) :
+     * setTestIsImage method: test that images must exist
+     * setTestTdInOnePage method: test that the contents of TDs fit on one page
+
+ - A DEBUG mode to know the resources used is present
+   It is activated by adding the following command just after the contructor 
(see Example 0):
+      $htmlpdf->setModeDebug();
+      
+ - Some specific tags have been introduced:
+     * <page></page>  (CF Exemple 7) :
+       determines the orientation, margins left, right, top and bottom, the 
background image
+       and the background color of a page, its size and position, the footer.
+       It is also possible to keep the header and footer of the previous pages,
+       through the attribut pageset="old" (see Example 3)
+ 
+     * <page_header></page_header> (CF Example 3)
+     
+     * <page_footer></page_footer> (CF Example 3)
+     
+     * <nobreak></nobreak> :
+         used to force the display of a section on the same page.
+         If this section does not fit into the rest of the page, a page break 
is done before.
+ 
+     * <barcode></barcode>  (CF Examples 0 et 9) :
+         can insert barcodes in pdfs, CF Examples 0 and 9
+         The possible types od codebar are: EAN13, UPC_A, CODE39.
+         This uses the scripts of The-eh and Olivier
+
+     * <qrcode></qrcode> (CF Exemple 13) :
+         permet d'inserer un codebar \xE0 2 dimensions de type QRcode
+         voici un exemple d'utilisation :
+           <qrcode value="votre message ici" size="1mm" ec="M" style="color: 
black; background-color: white"></qrcode>
+         seul le parametre "value" est obligatoire
+         les diff\xE9rentes valeurs de type de correction sont L, M, Q, H
+         (QR Code is registered trademark of DENSO WAVE INCORPORATED | 
http://www.denso-wave.com/qrcode/)
+         ATTENTION : l'utilisation des QRCODE n\xE9cessite l'utilisation de 
PHP5
+
+     * <bookmark></bookmark>  (CF Examples 7 et About) :
+         can insert bookmark in pdfs, CF Example 7 and About.
+         It is also possible to automatically create an index at the end of
+         documentv  CF Example About.
+         This uses the scripts of Olivier and Min's
+          
+     * css property "rotate" :
+         values : 0, 90, 180, 270
+         works only on div (cf example 8)
+                 
+change log :
+-----------
+ see on this page : http://localhost/en/download
+
+Help & Support :
+---------------
+ For questions and bug reports, thank you to use only the support link below.
+ I will answer to your questions only on it... 
+
+Informations :
+-------------
+ Programming in PHP4
+
+ Programmer : Spipu
+      email    : address@hidden
+      web site : http://html2pdf.fr/
+      wiki     : http://html2pdf.fr/wiki.php
+      support  : http://html2pdf.fr/forum.php
+
+Thanks :
+-------
+ * Olivier PLATHEY for his library Fpdf (http://www.fpdf.org/)
+ * yAronet for hosting support forum
+ * everyone who helped me to develop this library and to bring the texts


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/_read_me.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/about.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/about.php      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/about.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ */
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+
+       // r\xE9cup\xE9ration de l'html
+       ob_start();
+       include(dirname('__FILE__').'/res/about.php');
+       $content = ob_get_clean();
+
+       // initialisation de HTML2PDF
+       $html2pdf = new HTML2PDF('P','A4','fr', array(0, 0, 0, 0));
+       
+       // affichage de la page en entier
+       $html2pdf->pdf->SetDisplayMode('fullpage');
+       
+       // conversion
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       
+       // ajout de l'index (obligatoirement en fin de document)
+       $html2pdf->setNewPage();
+       $html2pdf->CreateIndex('Index', 25, 12);
+       
+       // envoie du PDF
+       $html2pdf->Output('about.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/about.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple00.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple00.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple00.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple00.php');
+       $content = ob_get_clean();
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+//     $html2pdf->setModeDebug();
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple00.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple00.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple01.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple01.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple01.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple01.php');
+       $content = ob_get_clean();
+       
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4', 'fr');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple01.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple01.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple02.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple02.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple02.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple02.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4', 'fr', array(30, 30, 20, 20));
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple02.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple02.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple03.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple03.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple03.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple03.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4', 'fr');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple03.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple03.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple04.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple04.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple04.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple04.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4', 'fr');
+       $html2pdf->pdf->SetDisplayMode('fullpage');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple04.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple04.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple05.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple05.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple05.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ *
+ * SetDisplayMode : permet de choisir le mode d'affichage par defaut
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple05.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4', 'fr');
+       $html2pdf->pdf->SetDisplayMode('fullpage');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple05.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple05.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple06.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple06.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple06.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple06.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4', 'fr');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple06.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple06.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple07.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple07.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple07.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * SetDisplayMode : permet de choisir le mode d'affichage par defaut
+ * SetProtection : permet de proteger le document \xE0 l'ouverture avec un mot 
de passe, et de ne donner que certains droits d'action
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple07a.php');
+       include(dirname(__FILE__).'/res/exemple07b.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+
+       $html2pdf = new HTML2PDF('P', 'A4', 'fr');
+       $html2pdf->pdf->SetDisplayMode('fullpage');
+//     $html2pdf->pdf->SetProtection(array('print'), 'spipu');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple07.pdf');
+


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple07.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple08.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple08.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple08.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple08.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4', 'fr', array(0, 0, 0, 0));
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple08.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple08.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple09.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple09.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple09.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+ 
+ $generate = isset($_GET['make_pdf']);
+ $nom = isset($_GET['nom']) ? $_GET['nom'] : 'inconnu';
+ 
+ $nom = substr(preg_replace('/[^a-zA-Z0-9]/isU', '', $nom), 0, 26);
+ 
+ if ($generate)
+ {
+       ob_start();
+ }
+ else
+ {
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; 
charset=iso-8859-1" >       
+               <title>Exemple d'auto g\xE9n\xE9ration de PDF</title>
+       </head>
+       <body>
+<?php  
+ }
+?>
+<br>
+Ceci est un exemple de g\xE9n\xE9ration de PDF via un bouton :)<br>
+<br>
+<img src="<?php echo 
'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI']); 
?>/res/exemple09.png.php?px=5&amp;py=20" alt="image_php" ><br>
+<br>
+<?php if ($generate) { ?>
+Bonjour <b><?php echo $nom; ?></b>, ton nom peut s'\xE9crire : <br>
+<barcode type="CODE39" value="<?php echo strtoupper($nom); ?>" style="color: 
#770000"></barcode><hr>
+<br>
+<?php } ?>
+<br>
+<?php
+       if ($generate)
+       {
+               $content = ob_get_clean();
+               require_once(dirname(__FILE__).'/../html2pdf.class.php');
+               $html2pdf = new HTML2PDF('P','A4', 'fr');
+               $html2pdf->WriteHTML($content);
+               $html2pdf->Output('exemple09.pdf');
+               exit;
+       }
+?>
+               <form method="get" action="">
+                       <input type="hidden" name="make_pdf" value="">
+                       Ton nom : <input type="text" name="nom" value=""> - 
+                       <input type="submit" value="Generer le PDF" >
+               </form>
+       </body>
+</html>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple09.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple10.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple10.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple10.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple10.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple10.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple10.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple11.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple11.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple11.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ *
+ * setTestTdInOnePage : permet de desactiver le test sur la taille des TD afin 
qu'ils rentrent sur une seule page
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple11.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->setTestTdInOnePage(false);
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple11.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple11.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple12.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple12.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple12.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple12.php');
+       $content = ob_get_clean();
+
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple12.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple12.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple13.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple13.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple13.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple13.php');
+       $content = ob_get_clean();
+       
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple13.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple13.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple14.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple14.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple14.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       include(dirname(__FILE__).'/res/exemple14.php');
+       $content = ob_get_clean();
+       
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->pdf->SetDisplayMode('fullpage');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('exemple14.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/exemple14.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js1.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js1.php        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js1.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * IncludeJS : permet d'inclure du Javascript au format PDF
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       ob_start();
+?>
+<page>
+       <h1>Test de JavaScript 1</h1><br>
+       <br>
+       Normalement la fenetre d'impression devrait apparaitre automatiquement
+</page>
+<?php
+       $content = ob_get_clean();
+       
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->pdf->IncludeJS("print(true);");
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('js1.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js1.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js2.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js2.php        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js2.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ *  IncludeJS : permet d'inclure du Javascript au format PDF
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       ob_start();
+?>
+<page>
+       <h1>Test de JavaScript 2</h1><br>
+       <br>
+       Normalement une alerte devrait apparaitre, indiquant "coucou"
+</page>
+<?php
+       $content = ob_get_clean();
+       
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->pdf->IncludeJS("app.alert('coucou');");
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('js2.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js2.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js3.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js3.php        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js3.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ *  IncludeJS : permet d'inclure du Javascript au format PDF
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       ob_start();
+?>
+<page>
+       <h1>Test de JavaScript 3</h1><br>
+       <br>
+       Normalement une valeur devrait vous \xEAtre demand\xE9e, puis 
affich\xE9e
+</page>
+<?php
+       $content = ob_get_clean();
+
+       $script = "
+var rep = app.response('Donnez votre nom');
+app.alert('Vous vous appelez '+rep);
+";     
+
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->pdf->IncludeJS($script);
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('js3.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/js3.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/qrcode.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/qrcode.php     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/qrcode.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+       $msg = "Le site de html2pdf\r\nhttp://html2pdf.fr/";;
+?>
+<page backtop="10mm" >
+       <page_header>
+               <table style="width: 100%; border: solid 1px black;">
+                       <tr>
+                               <td style="text-align: left;    width: 
50%">html2pdf</td>
+                               <td style="text-align: right;   width: 
50%">Exemples de QRcode</td>
+                       </tr>
+               </table>
+       </page_header>
+       <h1>Exemples de QRcode</h1>
+       <h3>Message avec Correction d'erreur L, M, Q, H (valeur par d\xE9faut : 
H)</h3>
+       <qrcode value="<?php echo $msg; ?>" ec="L" ></qrcode>
+       <qrcode value="<?php echo $msg; ?>" ec="M" ></qrcode>
+       <qrcode value="<?php echo $msg; ?>" ec="Q" ></qrcode>
+       <qrcode value="<?php echo $msg; ?>" ec="H" ></qrcode>
+       <br>
+       <h3>Message de taille 0.3mm, 0.6mm, 1mm, 2mm (valeur par d\xE9faut : 
0.6mm)</h3>
+       <qrcode value="<?php echo $msg; ?>" size="0.3mm"></qrcode>
+       <qrcode value="<?php echo $msg; ?>" size="0.6mm"></qrcode>
+       <qrcode value="<?php echo $msg; ?>" size="1mm"></qrcode>
+       <qrcode value="<?php echo $msg; ?>" size="2mm"></qrcode>
+       <br>
+       <h3>Message de diff\xE9rentes couleurs</h3>
+       <qrcode value="<?php echo $msg; ?>" style="background-color: white;   
color: black;"></qrcode>
+       <qrcode value="<?php echo $msg; ?>" style="background-color: yellow;  
color: red"></qrcode>
+       <qrcode value="<?php echo $msg; ?>" style="background-color: #FFCCFF; 
color: #003300"></qrcode>
+       <qrcode value="<?php echo $msg; ?>" style="background-color: #CCFFFF; 
color: #003333"></qrcode>
+       <br>
+</page>
+<?php
+       $content = ob_get_clean();
+       
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('P','A4','fr');
+       $html2pdf->pdf->SetDisplayMode('fullpage');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('qrcode.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/qrcode.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/regle.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/regle.php      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/regle.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Logiciel : exemple d'utilisation de HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * 
+ * isset($_GET['vuehtml']) n'est pas obligatoire
+ * il permet juste d'afficher le r\xE9sultat au format HTML
+ * si le param\xE8tre 'vuehtml' est pass\xE9 en param\xE8tre _GET
+ */
+       // r\xE9cup\xE9ration du contenu HTML
+       ob_start();
+?>
+<style type="text/css">
+<!--
+       table
+       {
+               padding: 0;
+               margin: 0;
+               border: none;
+               border-right: solid 0.2mm black;
+       }
+       td
+       {
+               padding: 0;
+               margin: 0;
+               border: none;
+       }
+       
+       img
+       {
+               width: 10mm;
+       }
+-->
+</style>
+<page>
+<table cellpadding="0" cellspacing="0"><tr>
+<?php for($k=0; $k<28; $k++) echo '<td><img src="./res/regle.png" alt="" 
><br>'.$k.'</td>'; ?>
+</tr></table>
+</page>
+<?php
+       $content = ob_get_clean();
+       
+       // conversion HTML => PDF
+       require_once(dirname(__FILE__).'/../html2pdf.class.php');
+       $html2pdf = new HTML2PDF('L','A4','fr', array(10, 10, 10, 10));
+       $html2pdf->pdf->SetDisplayMode('fullpage');
+       $html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
+       $html2pdf->Output('regle.pdf');


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/regle.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/about.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/about.php  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/about.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,228 @@
+<style type="text/css">
+<!--
+       table.page_header {width: 100%; border: none; background-color: 
#DDDDFF; border-bottom: solid 1mm #AAAADD; padding: 2mm }
+       table.page_footer {width: 100%; border: none; background-color: 
#DDDDFF; border-top: solid 1mm #AAAADD; padding: 2mm}
+       div.note {border: solid 1mm #DDDDDD;background-color: #EEEEEE; padding: 
2mm; border-radius: 2mm 2mm; width: 100%; }
+       ul.main { width: 95%; list-style-type: square; }
+       ul.main li { padding-bottom: 2mm; }
+       h1 { text-align: center; font-size: 20mm}
+       h3 { text-align: center; font-size: 14mm}
+-->
+</style>
+<page backtop="14mm" backbottom="14mm" backleft="10mm" backright="10mm" 
style="font-size: 12pt">
+       <page_header>
+               <table class="page_header">
+                       <tr>
+                               <td style="width: 50%; text-align: left">
+                                       A propos de ...
+                               </td>
+                               <td style="width: 50%; text-align: right">
+                                       HTML2PDF v<?php echo 
__CLASS_HTML2PDF__; ?>
+                               </td>
+                       </tr>
+               </table>
+       </page_header>
+       <page_footer>
+               <table class="page_footer">
+                       <tr>
+                               <td style="width: 33%; text-align: left;">
+                                       http://html2pdf.fr/
+                               </td>
+                               <td style="width: 34%; text-align: center">
+                                       page [[page_cu]]/[[page_nb]]
+                               </td>
+                               <td style="width: 33%; text-align: right">
+                                       &copy;Spipu 2008-2009
+                               </td>
+                       </tr>
+               </table>
+       </page_footer>
+       <bookmark title="Pr\xE9sentation" level="0" ></bookmark>        
+       <br><br><br><br><br><br><br><br>
+       <h1>HTML2PDF</h1>
+       <h3>v<?php echo __CLASS_HTML2PDF__; ?></h3><br>
+       <br><br><br><br><br>
+       <div style="text-align: center; width: 100%;">
+               <br>
+               <img src="./res/logoHTMLtoPDF.gif" alt="Logo HTML2PDF" 
style="width: 150mm">
+               <br>
+       </div>
+       <br><br><br><br><br>
+       <div class="note">
+               HTML2PDF est un convertisseur de code HTML vers PDF \xE9crit en 
PHP4, utilisant la librairie <a href="http://fpdf.org";>Fpdf d'Olivier 
PLATHEY.</a><br>
+               <br>
+               Il permet la conversion d'HTML 4.01 valide au format PDF, et 
est distribu\xE9 sous licence LGPL.<br>
+               <br>
+               Cette librairie a \xE9t\xE9 con\xE7ue pour g\xE9rer 
principalement les TABLE imbriqu\xE9es afin de g\xE9n\xE9rer des factures, bon 
de livraison, et autres documents officiels.<br>
+               <br>
+               Vous pouvez t\xE9l\xE9charger la derni\xE8re version de 
HTML2PDF ici : <a href="http://html2pdf.fr/";>http://html2pdf.fr/</a>.<br>
+       </div>
+</page>
+<page pageset="old">
+       <bookmark title="Compatibilit\xE9" level="0" ></bookmark>       
+       <bookmark title="Balises HTML" level="1" ></bookmark>   
+       <bookmark title="Balises classiques" level="2" ></bookmark>     
+       <div class="note">
+               La liste des balises HTML utilisables est la suivante :<br>
+       </div>
+       <br>
+       <ul class="main">
+               <li>&lt;a&gt; :         Ceci est un lien vers <a 
href="http://html2pdf.fr";>le site de HTML2PDF</a></li>
+               <li>&lt;b&gt;, &lt;strong&gt; :         Ecrire en 
<b>gras</b>.</li>
+               <li>&lt;big&gt; :       Ecrire plus <big>gros</big>.</li>
+               <li>&lt;br&gt; :        Permet d'aller \xE0 la ligne</li>
+               <li>&lt;cite&gt; :      <cite>Ceci est une citation</cite></li>
+               <li>&lt;code&gt;, &lt;pre&gt;</li>
+               <li>&lt;div&gt; :&nbsp;<div style="border: solid 1px #AADDAA; 
background: #DDFFDD; text-align: center; width: 50mm">exemple de DIV</div></li>
+               <li>&lt;em&gt;, &lt;i&gt;, &lt;samp&gt; :       Ecrire en 
<em>italique</em>.</li>
+               <li>&lt;font&gt;, &lt;span&gt; :        <font style="color: 
#000066; font-family: times">Exemple d'utilisation</font></li>
+               <li>&lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;, &lt;h5&gt;, 
&lt;h6&gt;</li>
+               <li>&lt;hr&gt; :        barre horizontale</li>
+               <li>&lt;img&gt; :       <img 
src="../_fpdf/tutorial/logo_pb.png" style="width: 10mm"></li>
+               <li>&lt;p&gt; :         Ecrire dans un paragraphe</li>
+               <li>&lt;s&gt; :         Texte <s>barr\xE9</s></li>
+               <li>&lt;small&gt; :     Ecrire plus <small>petit</small>.</li>
+               <li>&lt;style&gt;</li>
+               <li>&lt;sup&gt; :       Exemple<sup>haut</sup>.</li>
+               <li>&lt;sub&gt; :       Exemple<sub>bas</sub>.</li>
+               <li>&lt;u&gt; :         Texte <u>soulign\xE9</u></li>
+               <li>&lt;table&gt;, &lt;td&gt;, &lt;th&gt;, &lt;tr&gt;, 
&lt;thead&gt;, &lt;tbody&gt;, &lt;tfoot&gt;, &lt;col&gt; </li>
+               <li>&lt;ol&gt;, &lt;ul&gt;, &lt;li&gt;</li>
+               <li>&lt;form&gt;, &lt;input&gt;, &lt;textarea&gt;, 
&lt;select&gt;, &lt;option&gt;</li>
+               <li>&lt;del&gt;, &lt;ins&gt;</li>
+       </ul>
+       <bookmark title="Balises sp\xE9cifiques" level="2" ></bookmark> 
+       <div class="note">
+               Les balises sp\xE9cifiques suivantes ont \xE9t\xE9 ajout\xE9es 
:<br>
+       </div>
+       <br>
+       <ul class="main" >
+               <li>&lt;page&gt;</li>
+               <li>&lt;page_header&gt;</li>
+               <li>&lt;page_footer&gt;</li>
+               <li>&lt;nobreak&gt;</li>
+               <li>&lt;barcode&gt;</li>
+               <li>&lt;bookmark&gt;</li>
+       </ul>
+</page>
+<page pageset="old">
+       <bookmark title="Styles CSS" level="1" ></bookmark>     
+       <div class="note">
+               La liste des styles CSS utilisables est la suivante :<br>
+       </div>
+       <br>
+       <table style="width: 100%">
+               <tr style="vertical-align: top">
+                       <td style="width: 50%">
+                               <ul class="main">
+                                       <li>color</li>
+                                       <li>font-family</li>
+                                       <li>font-weight</li>
+                                       <li>font-style</li>
+                                       <li>font-size</li>
+                                       <li>text-decoration</li>
+                                       <li>text-indent</li>
+                                       <li>text-align</li>
+                                       <li>text-transform</li>
+                                       <li>vertical-align</li>
+                                       <li>width</li>
+                                       <li>height</li>
+                                       <li>line-height</li>
+                                       <li>padding</li>
+                                       <li>padding-top</li>
+                                       <li>padding-right</li>
+                                       <li>padding-bottom</li>
+                                       <li>padding-left</li>
+                                       <li>margin</li>
+                                       <li>margin-top</li>
+                                       <li>margin-right</li>
+                                       <li>margin-bottom</li>
+                                       <li>margin-left</li>
+                                       <li>position</li>
+                                       <li>top</li>
+                                       <li>bottom</li>
+                                       <li>left</li>
+                                       <li>right</li>
+                                       <li>float</li>
+                                       <li>rotate</li>
+                               </ul>
+                       </td>
+                       <td style="width: 50%">
+                               <ul class="main">
+                                       <li>background</li>
+                                       <li>background-color</li>
+                                       <li>background-image</li>
+                                       <li>background-position</li>
+                                       <li>background-repeat</li>
+                                       <li>border</li>
+                                       <li>border-style</li>
+                                       <li>border-color</li>
+                                       <li>border-width</li>
+                                       <li>border-collapse</li>
+                                       <li>border-radius</li>
+                                       <li>border-top</li>
+                                       <li>border-top-style</li>
+                                       <li>border-top-color</li>
+                                       <li>border-top-width</li>
+                                       <li>border-right</li>
+                                       <li>border-right-style</li>
+                                       <li>border-right-color</li>
+                                       <li>border-right-width</li>
+                                       <li>border-bottom</li>
+                                       <li>border-bottom-style</li>
+                                       <li>border-bottom-color</li>
+                                       <li>border-bottom-width</li>
+                                       <li>border-left</li>
+                                       <li>border-left-style</li>
+                                       <li>border-left-color</li>
+                                       <li>border-left-width</li>
+                                       <li>list-style</li>
+                                       <li>list-style-type</li>
+                                       <li>list-style-image</li>
+                               </ul>
+                       </td>
+               </tr>
+       </table>
+       <bookmark title="Propri\xE9t\xE9s" level="1" ></bookmark>       
+       <div class="note">
+               La liste des propri\xE9t\xE9s utilisables est la suivante :<br>
+       </div>
+       <br>
+       <table style="width: 100%">
+               <tr style="vertical-align: top">
+                       <td style="width: 50%">
+                               <ul class="main">
+                                       <li>cellpadding</li>
+                                       <li>cellspacing</li>
+                                       <li>colspan</li>
+                                       <li>rowspan</li>        
+                                       <li>width</li>
+                                       <li>height</li>
+                               </ul>
+                       </td>
+                       <td style="width: 50%">
+                               <ul class="main">
+                                       <li>align</li>
+                                       <li>valign</li>
+                                       <li>bgcolor</li>
+                                       <li>bordercolor</li>
+                                       <li>border</li>
+                                       <li>type</li>
+                               </ul>
+                       </td>
+               </tr>
+       </table>
+</page>
+<page pageset="old">
+       <bookmark title="Limitations" level="0" ></bookmark>    
+       <div class="note">
+               Cette librairie comporte des limitations :<br>
+       </div>
+       <br>
+       <ul class="main">
+               <li>Les float ne sont g\xE9r\xE9s que pour la balise IMG.</li>
+               <li>Elle ne permet g\xE9n\xE9ralement pas la conversion directe 
d'une page HTML en PDF, ni la conversion du r\xE9sultat d'un WYSIWYG en 
PDF.</li>
+               <li>Cette librairie est l\xE0 pour faciliter la 
g\xE9n\xE9ration de documents PDF, pas pour convertir n'importe quelle page 
HTML.</li>
+               <li>Les formulaires ne marchent qu'\xE0 partir de la version 
<b>9</b> de <b>Adobe Reader</b>.</li>
+       </ul>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/about.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/bas_page.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/bas_page.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple00.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple00.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple00.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,86 @@
+<style type="text/Css">
+<!--
+.test1
+{
+       border:                         solid 1px #FF0000;
+       background:                     #FFFFFF;
+       border-collapse:        collapse;
+}
+-->
+</style>
+<page style="font-size: 14px">
+       <span style="font-weight: bold; font-size: 18pt; color: 
#FF0000">Bonjour, voici quelques exemples<br></span>
+       <br>
+       Retours \xE0 la ligne autoris\xE9s : &lt;br&gt;, &lt;br &gt;, 
&lt;br/&gt;, &lt;br /&gt; <br />
+       <br>
+       Barre horizontale &lt;hr&gt;<hr style="height: 4mm; background: 
#AA5500; border: solid 1mm #0055AA">
+       Exemple de lien : <a href="http://html2pdf.fr/"; >le site 
HTML2PDF</a><br>
+       <br>
+       Image : <img src="./res/logoHTMLtoPDF.gif" alt="Logo" width=150 /><br>
+       <br>
+       Alignement horizontal des DIVs et TABLEs<br />
+       <table style="text-align: center; border: solid 2px red; background: 
#FFEEEE;width: 40%" align="center"><tr><td style="width: 100%">Test 
1</td></tr></table><br />
+       <table style="text-align: center; border: solid 2px red; background: 
#FFEEEE;width: 40%; margin: auto"><tr><td style="width: 100%">Test 
2</td></tr></table><br />
+       <div style="text-align: center; border: solid 2px red; background: 
#FFEEEE;width: 40%; margin: auto">Test 3</div><br />
+       test de tableau imbriqu\xE9 :<br>
+       <table border="1" bordercolor="#000077" bgcolor="#AAAAAA" 
align="center">
+               <tr>
+                       <td border="1">
+                               <table style="border: solid 1px #FF0000; 
background: #FFFFFF;">
+                                       <tr>
+                                               <th style="border: solid 1px 
#007700;">C1 \x80 \xAB</th>
+                                               <td style="border: solid 1px 
#007700;">C2 \x80 \xAB</td>
+                                       </tr>
+                                       <tr>
+                                               <td style="border: solid 1px 
#007700">D1 &euro; &laquo;</td>
+                                               <th style="border: solid 1px 
#007700">D2 &euro; &laquo;</th>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td border="1">A2</td>
+                       <td border="1">AAAAAAAA</td>
+               </tr>
+               <tr>
+                       <td border="1">B1</td>
+                       <td border="1" rowspan="2">
+                               <table class="test1">
+                                       <tr>
+                                               <td style="border: solid 2px 
#007700">E1</td>
+                                               <td style="border: solid 2px 
#000077; padding: 2mm">
+                                                       <table style="border: 
solid 1px #445500">
+                                                               <tr>
+                                                                       <td>
+                                                                               
<img src="./res/logoHTMLtoPDF.gif" alt="Logo" width=100 />
+                                                                       </td>
+                                                               </tr>
+                                                       </table>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="border: solid 2px 
#770000">F1</td>
+                                               <td style="border: solid 2px 
#007777">F2</td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td border="1"><barcode type="EAN13" value="45" 
bar_h="10mm" bar_w="0.35mm"></barcode></td>
+               </tr>
+               <tr>
+                       <td border="1">B2</td>
+                       <td border="1">A2</td>
+               </tr>
+       </table>
+       <br>
+       Exemple avec border et padding : <br>
+       <table style="border: solid 5mm #770000; padding: 5mm;" cellspacing="0" 
>
+               <tr>
+                       <td style="border: solid 3mm #007700; padding: 
2mm;"><img src="./res/off.png" alt="" style="width: 20mm"></td>
+               </tr>
+       </table>
+       <img src="./res/off.png" style="width: 10mm;"><img src="./res/off.png" 
style="width: 10mm;"><img src="./res/off.png" style="width: 10mm;"><img 
src="./res/off.png" style="width: 10mm;"><img src="./res/off.png" style="width: 
10mm;"><br>
+       <br>
+       <table style="border: solid 1px #440000; width: 150px"  
cellspacing="0"><tr><td style="width: 100%">Largeur : 
150px</td></tr></table><br>
+       <table style="border: solid 1px #440000; width: 150pt"  
cellspacing="0"><tr><td style="width: 100%">Largeur : 
150pt</td></tr></table><br>
+       <table style="border: solid 1px #440000; width: 100mm"  
cellspacing="0"><tr><td style="width: 100%">Largeur : 
100mm</td></tr></table><br>
+       <table style="border: solid 1px #440000; width: 5in"    
cellspacing="0"><tr><td style="width: 100%">Largeur : 5in</td></tr></table><br>
+       <table style="border: solid 1px #440000; width: 80%"    
cellspacing="0"><tr><td style="width: 100%">Largeur : 80% </td></tr></table><br>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple00.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple01.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple01.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple01.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,101 @@
+<style type="text/css">
+<!--
+table.morpion
+{
+       border:         dashed 1px #444444;
+}
+
+table.morpion td
+{
+       font-size:              15pt;
+       font-weight:    bold;
+       border:                 solid 1px #000000;
+       padding:                1px;
+       text-align:             center;
+       width:                  25px;
+}
+
+table.morpion td.j1 { color: #0A0; }
+table.morpion td.j2 { color: #A00; }
+
+-->
+</style>
+<page style="font-size: 10pt">
+       <span style="font-weight: bold; font-size: 20pt; color: #F00">Bonjour, 
voici quelques exemples</span><br>
+       Bonjour, ceci est un test <b>de gras</b>, <i>d'italic</i>, <b><i>et des 
2 ensembles</i></b>.<br>
+       <br>
+       <span style="background: RGB(255, 0, 0); color: 
RGB(100%,100%,100%);">Ceci est un message important</span><br>
+       <br>
+       <small>Texte \xE9crit avec small</small>, Texte \xE9crit normalement, 
<big>Texte \xE9crit avec big</big><br>
+       <br>
+       <span style="font-size: 20px">A<sub>test d'<b>indice</b></sub> et 
N<sup>test d'<b>exposant</b></sup>, 
+               test<sub>test<sub>test</sub></sub>, 
+               test<sup>test<sup>test</sup></sup>, 
+               test<sub>test<sup>test</sup></sub>.
+       </span><br>
+       <br>
+       <table align="center" style="border-radius: 6mm 6mm; border-top: solid 
3mm #000077; border-right: solid 2mm #007700; border-bottom: solid 1mm #770000; 
 border-left: solid 2mm #007777; background: #DDDDAA;" ><tr><td style="width: 
100mm; height: 20mm; text-align: center; ">Coucou ! ceci est un border solid 
avec un radius !!! </td></tr></table>
+       <br>
+       <table align="center" style="border-radius: 6mm 6mm; border: none; 
background: #DDDDAA;" ><tr><td style="width: 100mm; height: 20mm; text-align: 
center; ">Coucou ! ceci est un background avec un radius !!! </td></tr></table>
+       <br>
+       <table align="center" style="border: solid 1px #000000;"><tr><td 
style=" border-top: solid 4mm #000077; border-right: solid 3mm #007700;        
border-bottom: solid 2mm #770000;       border-left:    solid 1mm #007777;      
padding: 2mm 4mm 6mm 8mm; width: 100mm; background: #FFDDDD">Coucou ! ceci est 
un border solid</td></tr></table>
+       <br>
+       <table align="center" style="border: solid 1px #000000;"><tr><td 
style=" border-top: dotted 4mm #000077;        border-right: dotted 3mm 
#007700;       border-bottom: dotted 2mm #770000;      border-left:    dotted 
1mm #007777;     padding: 2mm 4mm 6mm 8mm; width: 100mm; background: 
#FFDDDD">Coucou ! ceci est un border dotted</td></tr></table>
+       <br>
+       <table align="center" style="border: solid 1px #000000;"><tr><td 
style=" border-top: dashed 4mm #000077;        border-right: dashed 3mm 
#007700;       border-bottom: dashed 2mm #770000;      border-left:    dashed 
1mm #007777;     padding: 2mm 4mm 6mm 8mm; width: 100mm; background: 
#FFDDDD">Coucou ! ceci est un border dashed</td></tr></table>
+       <br>
+<?php $back = 'background-image: url(./res/off.png); background-position: left 
top; background-repeat: repeat; '; ?>
+       <table style="background: #FFAAAA; color: #000022; border: 3px solid 
#555555;">
+               <tr>
+                       <td style="width: 40mm; border: solid 1px #000000; 
<?php echo $back; ?>color: #003300">Case A1</td>
+                       <td style="width: 50mm; border: solid 1px #000000; 
<?php echo $back; ?>font-weight: bold;">Case A2</td>
+                       <td style="width: 60mm; border: solid 1px #000000; 
<?php echo $back; ?>font-size: 20px;">Case A3</td>
+               </tr>
+               <tr>
+                       <td style="border: solid 1px #000000; text-align: left; 
        <?php echo $back; ?>vertical-align: top;        ">Case B1</td>
+                       <td style="border: solid 1px #000000; text-align: 
center;       <?php echo $back; ?>vertical-align: middle; height: 20mm">Case 
B2<hr style="color: #22AA22">test de hr</td>
+                       <td style="border: solid 1px #000000; text-align: 
right;        <?php echo $back; ?>vertical-align: bottom; border-radius: 3mm; 
">Case B3</td>
+               </tr>
+       </table>
+       <br>
+       <table style="border: solid 2px #550000; background: #000022 
url(./res/logoHTMLtoPDF.gif) center center no-repeat; color: #FFFFFF;">
+               <tr >
+                       <td style="border: solid 1px #AAAAAA;">Case A1<BR>avec 
tests diverses</td>
+                       <td style="border: solid 1px #AAAAAA;">Case A2</td>
+                       <td style="border: solid 1px #AAAAAA;">Case A3 
classic</td>
+               </tr>
+               <tr>
+                       <td style="border: solid 1px #AAAAAA;">Case 
B1<br>toto</td>
+                       <td style="border: solid 1px #AAAAAA;background: 
#FF0000">Case B2</td>
+                       <td style="border: solid 1px #AAAAAA;">Case B3</td>
+               </tr>
+       </table>
+       <br>
+       <table class="morpion" cellspacing="5px">
+               <tr>
+                       <td class="j1">X</td>
+                       <td class="j2">O</td>
+                       <td class="j1">X</td>
+               </tr>
+               <tr>
+                       <td class="j2">O</td>
+                       <td class="j1">X</td>
+                       <td ></td>
+               </tr>
+               <tr>
+                       <td class="j2">O</td>
+                       <td></td>
+                       <td class="j1">X</td>
+               </tr>
+       </table>
+       <br>
+       <table style="border: dotted 1mm #FFFFFF; background: #AAAAFF">
+               <tr>
+                       <td style="width: 42mm; text-align: center;font-size: 
5mm">
+                               Ceci est un test
+                       </td>
+               </tr>
+       </table>
+       <br>
+       <u>Fin de l'exemple</u>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple01.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple02.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple02.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple02.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,38 @@
+<page style="font-size: 10pt">
+       <span style="font-size: 16pt ; font-weight: bold">D\xE9monstration des 
images<br></span>
+       <br>
+       <br>
+       <b>Dans un tableau :</b><br>
+       <table style="width: 50%;border: solid 3px #5544DD" align="center">
+               <tr>
+                       <td style="width: 30%; text-align: left; ">Text \xE0 
gauche<br>avec retour \xE0<br>la ligne</td>
+                       <td style="width: 40%; text-align: center;"><img 
src="./res/logoHTMLtoPDF.gif" alt="" ><br><i>l\xE9gende</i></td>
+                       <td style="width: 30%; text-align: right; ">Texte \xE0 
droite</td>
+               </tr>
+       </table>
+       <br>
+       Texte <span style="text-decoration: underline">soulign\xE9</span>,
+       texte <span style="text-decoration: overline">surlign\xE9</span>,
+       texte <span style="text-decoration: line-through">barr\xE9</span>,
+       texte <span style="text-decoration: underline overline 
line-through">avec les trois</span>.<br>
+       <br>
+       <b>Dans un texte :</b><br>
+       texte \xE0 la suite d'une image, <img src="./res/logoHTMLtoPDF.gif" 
alt="" style="height: 10mm">
+       texte \xE0 la suite d'une image, r\xE9p\xE9titif car besoin d'un retour 
\xE0 la ligne
+       texte \xE0 la suite d'une image, r\xE9p\xE9titif car besoin d'un retour 
\xE0 la ligne
+       texte \xE0 la suite d'une image, r\xE9p\xE9titif car besoin d'un retour 
\xE0 la ligne
+       texte \xE0 la suite d'une image, r\xE9p\xE9titif car besoin d'un retour 
\xE0 la ligne<br>
+       <br>
+       <br>
+       Test diff\xE9rentes tailles texte
+       <span style="font-size: 18pt;">Test Size</span>
+       <span style="font-size: 16pt;">Test Size</span>
+       <span style="font-size: 14pt;">Test Size</span>
+       <span style="font-size: 12pt;">Test Size</span>
+       Test diff\xE9rentes tailles texte, r\xE9p\xE9titif car besoin d'un 
retour \xE0 la ligne
+       Test diff\xE9rentes tailles texte, r\xE9p\xE9titif car besoin d'un 
retour \xE0 la ligne
+       Test diff\xE9rentes tailles texte, r\xE9p\xE9titif car besoin d'un 
retour \xE0 la ligne
+       Test diff\xE9rentes tailles texte, r\xE9p\xE9titif car besoin d'un 
retour \xE0 la ligne
+       <br>
+       <br>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple02.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple03.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple03.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple03.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,66 @@
+<page backtop="10mm" backbottom="10mm">
+       <page_header>
+               <table style="width: 100%; border: solid 1px black;">
+                       <tr>
+                               <td style="text-align: left;    width: 
33%">html2pdf</td>
+                               <td style="text-align: center;  width: 
34%">Test d'header</td>
+                               <td style="text-align: right;   width: 
33%"><?php echo date('d/m/Y'); ?></td>
+                       </tr>
+               </table>
+       </page_header>
+       <page_footer>
+               <table style="width: 100%; border: solid 1px black;">
+                       <tr>
+                               <td style="text-align: left;    width: 
50%">html2pdf.fr</td>
+                               <td style="text-align: right;   width: 
50%">page [[page_cu]]/[[page_nb]]</td>
+                       </tr>
+               </table>
+       </page_footer>
+       <span style="font-size: 20px; font-weight: bold">D\xE9monstration des 
retour \xE0 la ligne automatique, ainsi que des sauts de page 
automatique<br></span>
+       <br>
+       <br>
+       <table style="width: 80%;border: solid 1px #5544DD; border-collapse: 
collapse" align="center">
+<?php for($k=0; $k<13; $k++) { ?>
+               <tr>
+                       <td style="width: 30%; text-align: left; border: solid 
1px #55DD44">
+                               test de texte assez long pour engendrer des 
retours \xE0 la ligne automatique...
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                       </td>
+                       <td style="width: 70%; text-align: left; border: solid 
1px #55DD44">
+                               test de texte assez long pour engendrer des 
retours \xE0 la ligne automatique...
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                               
+                       </td>
+               </tr>
+<?php } ?>
+       </table>
+       <br>
+       Ca marche !!!<br>
+       refaisons un test : <br>
+       <table style="width: 80%;border: solid 1px #5544DD">
+<?php for($k=0; $k<12; $k++) { ?>
+
+               <tr>
+                       <td style="width: 30%; text-align: left; border: solid 
1px #55DD44">
+                               test de texte assez long pour engendrer des 
retours \xE0 la ligne automatique...
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                       </td>
+                       <td style="width: 70%; text-align: left; border: solid 
1px #55DD44">
+                               test de texte assez long pour engendrer des 
retours \xE0 la ligne automatique...
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                               a b c d e f g h i j k l m n o p q r s t u v w x 
y z
+                               
+                       </td>
+               </tr>
+<?php } ?>
+       </table>
+       <br>
+       Ca marche toujours ?!<br>
+       De plus, vous pouvez faire des sauts de page manuellement en utilisant 
les balises &lt;page&gt; &lt;/page&gt;, comme ici par exemple :
+</page>
+<page pageset="old">
+       Nouvelle page !!!!
+</page>


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple03.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple04.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple04.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple04.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,59 @@
+<page style="font-size: 16px">
+       Vous pouvez choisir l'orientation de votre document, en utilisant ceci 
:<br>
+       <br>
+       &lt;page orientation="portrait" &gt; <i>code de la page</i> 
&lt;/page&gt; : mode portrait<br>
+       <br>
+       &lt;page orientation="paysage" &gt; <i>code de la page</i> 
&lt;/page&gt; : mode paysage<br>
+       <br>
+       En voici un petit exemple !
+</page>
+<page orientation="paysage" style="font-size: 18px">
+       Ceci est une page en paysage<br>
+       <table style="width: 100%; border: solid 1px #FFFFFF;">
+               <tr>
+                       <td style="width: 30%; border: solid 1px 
#FF0000;">AAA</td>
+                       <td style="width: 40%; border: solid 1px 
#00FF00;">BBB</td>
+                       <td style="width: 30%; border: solid 1px 
#0000FF;">CCC</td>
+               </tr>
+               <tr>
+                       <td style="width: 30%; border: solid 1px 
#FF0000;">AAA</td>
+                       <td style="width: 40%; border: solid 1px 
#00FF00;">BBB</td>
+                       <td style="width: 30%; border: solid 1px 
#0000FF;">CCC</td>
+               </tr>
+               <tr>
+                       <td style="width: 30%; border: solid 1px 
#FF0000;">AAA</td>
+                       <td style="width: 40%; border: solid 1px 
#00FF00;">BBB</td>
+                       <td style="width: 30%; border: solid 1px 
#0000FF;">CCC</td>
+               </tr>
+       </table>
+       <div style="width: 70%; border: solid 1mm #770000; margin: 1mm; 
padding: 2mm; font-size: 4mm; line-height: normal;">
+               <img src="./res/logoHTMLtoPDF.gif" alt="logo html2pdf" 
style="float: left; width: 60mm; margin: 2mm; ">
+               Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed 
elementum, nibh eu ultricies scelerisque, est lorem dignissim elit, quis tempus 
tortor eros non ipsum. Mauris convallis augue ac sapien. In scelerisque 
dignissim elit. Donec consequat semper lectus. Sed in quam. Nunc molestie 
hendrerit ipsum. Curabitur elit risus, rhoncus ut, mattis a, convallis eu, 
neque. Morbi luctus est sit amet nunc. In nisl. Donec magna libero, aliquet eu, 
vestibulum ut, mollis sed, felis.
+               Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed 
elementum, nibh eu ultricies scelerisque, est lorem dignissim elit, quis tempus 
tortor eros non ipsum. Mauris convallis augue ac sapien. In scelerisque 
dignissim elit. Donec consequat semper lectus. Sed in quam. Nunc molestie 
hendrerit ipsum. Curabitur elit risus, rhoncus ut, mattis a, convallis eu, 
neque. Morbi luctus est sit amet nunc. In nisl. Donec magna libero, aliquet eu, 
vestibulum ut, mollis sed, felis.
+       </div>
+       <div style="width: 70%; border: solid 1mm #770000; margin: 1mm; 
padding: 2mm; font-size: 4mm; line-height: 150%;text-align: right;">
+               <img src="./res/logoHTMLtoPDF.gif" alt="logo html2pdf" 
style="float: right; width: 60mm; margin: 2mm; ">
+               Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed 
elementum, nibh eu ultricies scelerisque, est lorem dignissim elit, quis tempus 
tortor eros non ipsum. Mauris convallis augue ac sapien. In scelerisque 
dignissim elit. Donec consequat semper lectus. Sed in quam. Nunc molestie 
hendrerit ipsum. Curabitur elit risus, rhoncus ut, mattis a, convallis eu, 
neque. Morbi luctus est sit amet nunc. In nisl. Donec magna libero, aliquet eu, 
vestibulum ut, mollis sed, felis.
+               Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed 
elementum, nibh eu ultricies scelerisque, est lorem dignissim elit, quis tempus 
tortor eros non ipsum. Mauris convallis augue ac sapien. In scelerisque 
dignissim elit. Donec consequat semper lectus. Sed in quam. Nunc molestie 
hendrerit ipsum. Curabitur elit risus, rhoncus ut, mattis a, convallis eu, 
neque. Morbi luctus est sit amet nunc. In nisl. Donec magna libero, aliquet eu, 
vestibulum ut, mollis sed, felis.
+       </div>
+</page>
+<page orientation="portrait" style="font-size: 18px">
+       Ceci est une page en portrait<br>
+       <table style="width: 100%; border: solid 1px #FFFFFF;">
+               <tr>
+                       <td style="width: 30%; border: solid 1px 
#FF0000;">AAA</td>
+                       <td style="width: 40%; border: solid 1px 
#00FF00;">BBB</td>
+                       <td style="width: 30%; border: solid 1px 
#0000FF;">CCC</td>
+               </tr>
+               <tr>
+                       <td style="width: 30%; border: solid 1px 
#FF0000;">AAA</td>
+                       <td style="width: 40%; border: solid 1px 
#00FF00;">BBB</td>
+                       <td style="width: 30%; border: solid 1px 
#0000FF;">CCC</td>
+               </tr>
+               <tr>
+                       <td style="width: 30%; border: solid 1px 
#FF0000;">AAA</td>
+                       <td style="width: 40%; border: solid 1px 
#00FF00;">BBB</td>
+                       <td style="width: 30%; border: solid 1px 
#0000FF;">CCC</td>
+               </tr>
+       </table>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple04.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple05.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple05.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple05.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,67 @@
+<style type="text/css">
+<!--
+table
+{
+       width:  100%;
+       border: solid 1px #5544DD;
+}
+
+th
+{
+       text-align:     center;
+       border:         solid 1px #113300;
+       background:     #EEFFEE;
+}
+
+td
+{
+       text-align:     left;
+       border:         solid 1px #55DD44;
+}
+
+td.col1
+{
+       border: solid 1px red;
+       text-align: right;
+}
+
+-->
+</style>
+<span style="font-size: 20px; font-weight: bold">D\xE9monstration des retour 
\xE0 la ligne automatique, ainsi que des sauts de page automatique<br></span>
+<br>
+<br>
+<table>
+       <col style="width: 5%" class="col1">
+       <col style="width: 25%">
+       <col style="width: 30%">
+       <col style="width: 40%">
+       <thead>
+               <tr>
+                       <th rowspan="2">n\xB0</th>
+                       <th colspan="3" style="font-size: 16px;">
+                               Titre du tableau
+                       </th>
+               </tr>
+               <tr>
+                       <th>Colonne 1</th>
+                       <th>Colonne 2</th>
+                       <th>Colonne 3</th>
+               </tr>
+       </thead>
+<?php for($k=0; $k<50; $k++) { ?>
+       <tr>
+               <td><?php echo $k; ?></td>
+               <td>test de texte assez long pour engendrer des retours \xE0 la 
ligne automatique...</td>
+               <td>test de texte assez long pour engendrer des retours \xE0 la 
ligne automatique...</td>
+               <td>test de texte assez long pour engendrer des retours \xE0 la 
ligne automatique...</td>
+       </tr>
+<?php } ?>
+       <tfoot>
+               <tr>
+                       <th colspan="4" style="font-size: 16px;">
+                               bas du tableau
+                       </th>
+               </tr>
+       </tfoot>
+</table>
+Cool non ?<br>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple05.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.css
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.css  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.css  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,12 @@
+.titre
+{
+       text-decoration: underline;
+}
+
+*      {color: #FF0000; }
+H1     {color: #AA0055; }
+H2     {color: #990066; }
+H3     {color: #880077; }
+H4     {color: #770088; }
+H5     {color: #660099; }
+H6     {color: #5500AA; }
\ No newline at end of file

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,45 @@
+<link type="text/css" href="./res/exemple06.css" rel="stylesheet" >
+<style type="text/css">
+<!--
+/* commentaire dans un css */
+table, td      { border: solid 1px #000000; color: #0000AA; }
+td.col1                { color: #00AA00; }
+
+/* autre commentaire */
+table.liste                            { border: solid 2px #FF0000; }
+table.liste td                 { background: #DDDDDD; }
+table.liste td.col1    { color: #FF0000; }
+-->
+</style>
+<page>
+       <table>
+               <tr>
+                       <td>Ceci est un</td>
+                       <td class="col1">test de style</td>
+               </tr>
+       </table>
+       <br>
+       <table class="liste">
+               <tr>
+                       <td>Ceci est un</td>
+                       <td class="col1">test de style</td>
+               </tr>
+       </table>
+       <br>
+       <H1>Essai de titre en H1</H1>
+       <H2>Essai de titre en H2</H2>
+       <H3>Essai de titre en H3</H3>
+       <H4>Essai de titre en H4</H4>
+       <H5>Essai de titre en H5</H5>
+       <H6>Essai de titre en H6</H6>
+       <H6 class="titre">Essai de titre en H6</H6>
+       <H5 class="titre">Essai de titre en H5</H5>
+       <H4 class="titre">Essai de titre en H4</H4>
+       <H3 class="titre">Essai de titre en H3</H3>
+       <H2 class="titre">Essai de titre en H2</H2>
+       <H1 class="titre">Essai de titre en H1</H1>
+       <br>
+       <s>Texte barr\xE9 !</s><br>
+       <br>
+       <span>Texte avec la couleur par d\xE9fault (style *)</span><br>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple06.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07a.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07a.php 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07a.php 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,133 @@
+<style type="text/css">
+<!--
+table  { vertical-align: top; }
+tr             { vertical-align: top; }
+td             { vertical-align: top; }
+}
+-->
+</style>
+<page backcolor="#FEFEFE" backimg="./res/bas_page.png" backimgx="center" 
backimgy="bottom" backimgw="100%" backtop="0" backbottom="30mm" 
footer="date;heure;page" style="font-size: 12pt">
+       <bookmark title="Lettre" level="0" ></bookmark>
+       <table cellspacing="0" style="width: 100%; text-align: center; 
font-size: 14px">
+               <tr>
+                       <td style="width: 75%;">
+                       </td>
+                       <td style="width: 25%; color: #444444;">
+                               <img style="width: 100%;" 
src="./res/logoHTMLtoPDF.gif" alt="Logo fpdf"><br>
+                               RELATION CLIENT
+                       </td>
+               </tr>
+       </table>
+       <br>
+       <br>
+       <table cellspacing="0" style="width: 100%; text-align: left; font-size: 
11pt;">
+               <tr>
+                       <td style="width:50%;"></td>
+                       <td style="width:14%; ">Client :</td>
+                       <td style="width:36%">M. Albert Dupont</td>
+               </tr>
+               <tr>
+                       <td style="width:50%;"></td>
+                       <td style="width:14%; ">Adresse :               </td>
+                       <td style="width:36%">
+                               R\xE9sidence perdue<br>
+                               1, rue sans nom<br>
+                               00 000 - Pas de Ville<br>
+                       </td>
+               </tr>
+               <tr>
+                       <td style="width:50%;"></td>
+                       <td style="width:14%; ">Email :         </td>
+                       <td style="width:36%">address@hidden</td>
+               </tr>
+               <tr>
+                       <td style="width:50%;"></td>
+                       <td style="width:14%; ">Tel :           </td>
+                       <td style="width:36%">33 (0) 1 00 00 00 00</td>
+               </tr>
+       </table>
+       <br>
+       <br>
+       <table cellspacing="0" style="width: 100%; text-align: left;font-size: 
10pt">
+               <tr>
+                       <td style="width:50%;"></td>
+                       <td style="width:50%; ">Spipu Ville, le <?php echo 
date('d/m/Y'); ?></td>
+               </tr>
+       </table>
+       <br>
+       <i>
+               <b><u>Objet </u>: &laquo; Bon de Retour &raquo;</b><br>
+               Compte client : 00C4520100A<br>
+               R\xE9f\xE9rence du Dossier : 71326<br>
+       </i> 
+       <br>
+       <br>
+       Madame, Monsieur, Cher Client,<br>
+       <br>
+       <br>
+       Nous souhaitons vous informer que le dossier <b>71326</b> concernant un 
&laquo; Bon de Retour &raquo; pour les articles suivants a \xE9t\xE9 
accept\xE9.<br>
+       <br>
+       <table cellspacing="0" style="width: 100%; border: solid 1px black; 
background: #E7E7E7; text-align: center; font-size: 10pt;">
+               <tr>
+                       <th style="width: 12%">Produit</th>
+                       <th style="width: 52%">D\xE9signation</th>
+                       <th style="width: 13%">Prix Unitaire</th>
+                       <th style="width: 10%">Quantit\xE9</th>
+                       <th style="width: 13%">Prix Net</th>
+               </tr>
+       </table>
+<?php
+       $nb = rand(5, 11);
+       $produits = array();
+       $total = 0;
+       for($k=0; $k<$nb; $k++)
+       {
+               $num = rand(100000, 999999);
+               $nom = "le produit n\xB0".rand(1, 100);
+               $qua = rand(1, 20);
+               $prix = rand(100, 9999)/100.;
+               $total+= $prix*$qua;
+               $produits[] = array($num, $nom, $qua, $prix, rand(0, $qua));
+?>
+       <table cellspacing="0" style="width: 100%; border: solid 1px black; 
background: #F7F7F7; text-align: center; font-size: 10pt;">
+               <tr>
+                       <td style="width: 12%; text-align: left"><?php echo 
$num; ?></td>
+                       <td style="width: 52%; text-align: left"><?php echo 
$nom; ?></td>
+                       <td style="width: 13%; text-align: right"><?php echo 
number_format($prix, 2, ',', ' '); ?> &euro;</td>
+                       <td style="width: 10%"><?php echo $qua; ?></td>
+                       <td style="width: 13%; text-align: right;"><?php echo 
number_format($prix*$qua, 2, ',', ' '); ?> &euro;</td>
+               </tr>
+       </table>
+<?php
+       }
+?>
+       <table cellspacing="0" style="width: 100%; border: solid 1px black; 
background: #E7E7E7; text-align: center; font-size: 10pt;">
+               <tr>
+                       <th style="width: 87%; text-align: right;">Total : </th>
+                       <th style="width: 13%; text-align: right;"><?php echo 
number_format($total, 2, ',', ' '); ?> &euro;</th>
+               </tr>
+       </table>
+       <br>
+       Cette reprise concerne la quantit\xE9 et les mat\xE9riels dont la 
r\xE9f\xE9rence figure sur le <a href="#document_reprise">document de reprise 
joint</a>.<br>
+       Nous vous demandons de nous retourner ces produits en parfait \xE9tat 
et dans leur emballage d'origine.<br>
+       <br>
+       Nous vous demandons \xE9galement de coller imp\xE9rativement 
l'autorisation de reprise jointe, sur le colis \xE0 reprendre afin de faciliter 
le traitement \xE0 l'entrep\xF4t.<br>
+       <br>
+       Notre Service Clients ne manquera pas de revenir vers vous d\xE8s que 
l'avoir de ces mat\xE9riels sera \xE9tabli.<br>
+       <nobreak>
+               <br>
+               Dans cette attente, nous vous prions de recevoir, Madame, 
Monsieur, Cher Client, nos meilleures salutations.<br>
+               <br>
+               <table cellspacing="0" style="width: 100%; text-align: left;">
+                       <tr>
+                               <td style="width:50%;"></td>
+                               <td style="width:50%; ">
+                                       Mle Jesuis CELIBATAIRE<br>
+                                       Service Relation Client<br>
+                                       Tel : 33 (0) 1 00 00 00 00<br>
+                                       Email : address@hidden<br>
+                               </td>
+                       </tr>
+               </table>
+       </nobreak>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07a.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07b.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07b.php 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07b.php 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,174 @@
+<page orientation="paysage" footer="">
+       <bookmark title="Document" level="0" ></bookmark>
+       <a name="document_reprise"></a>
+       <table cellspacing="0" style="width: 100%;">
+               <tr>
+                       <td style="width: 10%;">
+                               <img style="width: 100%" 
src="./res/logoHTMLtoPDF.gif" alt="Logo fpdf" >
+                       </td>
+                       <td style="width: 80%; text-align: center; 
text-decoration: underline; font-weight: bold; font-size: 20pt;">
+                               <span style="font-size: 10pt"><br></span>
+                               ACCORD DE RETOUR
+                       </td>
+                       <td style="width: 10%;">
+                       </td>
+               </tr>
+       </table>
+       <table cellspacing="0" style="width: 100%;">
+               <tr>
+                       <td style="width: 55% ">
+                               <table cellspacing="0" style="width: 100%; 
border: solid 2px #000000; ">
+                                       <tr>
+                                               <td style="width: 100%; 
font-size: 12pt;">
+                                                       <span style="font-size: 
15pt; font-weight: bold;">ADRESSE DE RETOUR<br></span>
+                                                       <br>
+                                                       <b>Entrepot des 
Bois</b><br>
+                                                       sur une grande route<br>
+                                                       00000 - Spipu Ville<br>
+                                                       <br>
+                                                       Date : <?php echo 
date('d/m/Y'); ?><br>
+                                                       Dossier suivi par 
<b>Mle Jesuis CELIBATAIRE</b><br>
+                                                       Tel : 33 (0) 1 00 00 00 
00<br>
+                                                       Email : 
address@hidden<br>
+                                               </td>
+                                       </tr>
+                               </table>
+                               <br>&nbsp;
+                       </td>
+                       <td style="width: 4%"></td>
+                       <td style="width: 37% ">
+                               <table cellspacing="0" style="width: 100%; 
border: solid 2px #000000; font-size: 12pt;">
+                                       <tr><td style="width: 
40%;">R\xE9f\xE9rence :           </td><td style="width: 60%;">71326</td></tr>
+                                       <tr><td style="width: 40%;">Client :    
        </td><td style="width: 60%;">M. Albert Dupont</td></tr>
+                                       <tr><td style="width: 40%;">Adresse :   
        </td><td style="width: 60%;">R\xE9sidence perdue<br>1, rue sans 
nom<br>00 000 - Pas de Ville</td></tr>
+                                       <tr><td style="width: 40%;">TEL :       
                </td><td style="width: 60%;">33 (0) 1 00 00 00 00</td></tr>
+                                       <tr><td style="width: 
40px;">A</td><td>B</td></tr>
+                                       <tr><td style="width: 40%;">Code Client 
:       </td><td style="width: 60%;">00C4520100A</td></tr>
+                               </table>
+                               <table cellspacing="0" style="width: 100%; 
border: solid 2px #000000">
+                                       <tr>
+                                               <th style="width: 40%;">Motif 
de la Reprise</th>
+                                               <td style="width: 60%;">Produit 
non Conforme</td>
+                                       </tr>
+                               </table>
+                               <br>
+                       </td>
+                       <td style="width: 4%"></td>
+               </tr>
+               <tr>
+                       <td style="width:55%;">
+                               <table cellspacing="0" style="padding: 1px; 
width: 100%; border: solid 2px #000000; font-size: 11pt; ">
+                                       <tr>
+                                               <th style="width: 100%; 
text-align: center; border: solid 1px #000000;" colspan="4">
+                                                       Partie r\xE9serv\xE9e 
\xE0 Spipu Corp
+                                               </th>
+                                       </tr>
+                                       <tr>
+                                               <th style="width: 100%; 
text-align: center; border: solid 1px #000000;" colspan="4">
+                                                       QUANTITE PREVUE AU 
CHARGEMENT
+                                               </th>
+                                       </tr>
+                                       <tr>
+                                               <th style="width: 15%; border: 
solid 1px #000000;">Produit</th>
+                                               <th style="width: 55%; border: 
solid 1px #000000;">Designation</th>
+                                               <th style="width: 15%; border: 
solid 1px #000000;">Neuf</th>
+                                               <th style="width: 15%; border: 
solid 1px #000000;">Ab\xEEm\xE9</th>
+                                       </tr>
+<?php
+$i=0;
+       foreach($produits as $produit)
+       {
+               $i++;
+?>
+                                       <tr>
+                                               <td style="width: 15%; border: 
solid 1px #000000;"><?php echo $produit[0];              ?></td>
+                                               <td style="width: 55%; border: 
solid 1px #000000;text-align: left;"><?php echo $produit[1];             ?></td>
+                                               <td style="width: 15%; border: 
solid 1px #000000;"><?php echo $produit[4];              ?></td>
+                                               <td style="width: 15%; border: 
solid 1px #000000;"><?php echo $produit[2]-$produit[4];          ?></td>
+                                       </tr>
+
+<?php
+       }
+       for($i; $i<12; $i++)
+       {
+?>
+                                       <tr>
+                                               <td style="width: 15%; border: 
solid 1px #000000;">&nbsp;</td>
+                                               <td style="width: 55%; border: 
solid 1px #000000;">&nbsp;</td>
+                                               <td style="width: 15%; border: 
solid 1px #000000;">&nbsp;</td>
+                                               <td style="width: 15%; border: 
solid 1px #000000;">&nbsp;</td>
+                                       </tr>
+<?php
+       }
+?>
+                               </table>
+                               <br>
+                               <table cellspacing="0" style="width: 100%; 
text-align: left; font-size: 8pt">
+                                       <tr>
+                                               <td style="width: 100%">
+                                                       <b><u>Conditions des 
Retours</u></b><br>
+                                                       1 - il faut des 
conditions<br>
+                                                       2 - encore des 
conditions<br>
+                                                       3 - toujours des 
conditions<br>
+                                               </td>
+                                       </tr>
+                               </table>
+                               <br>
+                               <table cellspacing="0" style="width: 100%; 
border: solid 2px #000000; text-align: center; font-size: 10pt">
+                                       <tr>
+                                               <td style="width: 30%"></td>
+                                               <td style="width: 40%">ACCORD 
SOCIETE</td>
+                                               <td style="width: 30%"></td>
+                                       </tr>
+                                       <tr>
+                                               <td style="width: 
30%"><br><br>M. XX</td>
+                                               <td style="width: 40%"></td>
+                                               <td style="width: 
30%"><br><br>Mme XY</td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td style="width: 4%"></td>
+                       <td style="width: 37%;">
+                               <table cellspacing="0" style="padding: 1px; 
width: 100%; border: solid 2px #000000; font-size: 11pt; ">
+                                       <tr>
+                                               <th style="width: 100%; 
text-align: center; border: solid 1px #000000;" colspan="2">
+                                                       Partie r\xE9serv\xE9e 
\xE0 l'entrep\xF4t
+                                               </th>
+                                       </tr>
+                                       <tr>
+                                               <th style="width: 100%; 
text-align: center; border: solid 1px #000000;" colspan="2">
+                                                       QUANTITE PREVUE AU 
CHARGEMENT
+                                               </th>
+                                       </tr>
+                                       <tr>
+                                               <th style="width: 50%; border: 
solid 1px #000000;">Produit neuf                         </th>
+                                               <th style="width: 50%; border: 
solid 1px #000000;">Produit \xE0 reconditionner  </th>
+                                       </tr>
+<?php for($i=0; $i<12; $i++) { ?>
+                                       <tr>
+                                               <td style="width: 50%; border: 
solid 1px #000000;">&nbsp;</td>
+                                               <td style="width: 50%; border: 
solid 1px #000000;">&nbsp;</td>
+                                       </tr>
+<?php } ?>
+                               </table>
+                               <br>
+                               <table cellspacing="0" style="width: 100%; 
border: solid 2px #000000; text-align: left; font-size: 10pt">
+                                       <tr>
+                                               <th style="width: 30%;">
+                                                       Commentaire<br>
+                                                       Retour :<br>
+                                                       &nbsp;<br>
+                                                       &nbsp;<br>
+                                               </th>
+                                               <td style="width: 70%;">
+                                               </td>
+                                       </tr>
+                               </table>
+                               <br>
+                               <br>
+                               <span style="font-size: 13pt"><b><u>A COLLER 
IMPERATIVEMENT SUR LES COLIS</u></b></span>
+                       </td>
+                       <td style="width: 4%"></td>
+               </tr>
+       </table>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple07b.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple08.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple08.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple08.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,114 @@
+<style type="text/css">
+<!--
+table
+{
+       padding: 0;
+       border: solid 1mm LawnGreen;
+       font-size:      12pt;
+       background: #FFFFFF;
+       text-align:     center;
+       vertical-align: middle;
+}
+
+td
+{
+       padding:        1mm;
+       border: solid 1mm black;
+}
+
+td.div
+{
+       width: 110px;
+       height: 110px;
+       text-align:     left;
+       padding:        0
+}
+
+td.div div
+{
+       margin: auto;
+       background: yellow;
+       border: solid 2px blue;
+       color: red;
+       width: 100px;
+       height: 65px;
+       text-align: center; 
+}
+
+-->
+</style>
+<page backcolor="#AACCFF" backleft="5mm" backright="5mm" backtop="10mm" 
backbottom="10mm" >
+       <table>
+               <tr>
+                       <td class="div"><div style="rotate:   0;">Hello ! ceci 
<b>est</b> un test !<br><img src="./res/logoHTMLtoPDF.gif" style="width: 80px;" 
alt="logo"></div></td>
+                       <td class="div"><div style="rotate: 270;">Hello ! ceci 
<b>est</b> un test !<br><img src="./res/logoHTMLtoPDF.gif" style="width: 80px;" 
alt="logo"></div></td>
+               </tr>
+               <tr>
+                       <td class="div"><div style="rotate:  90;">Hello ! ceci 
<b>est</b> un test !<br><img src="./res/logoHTMLtoPDF.gif" style="width: 80px;" 
alt="logo"></div></td>
+                       <td class="div"><div style="rotate: 180;">Hello ! ceci 
<b>est</b> un test !<br><img src="./res/logoHTMLtoPDF.gif" style="width: 80px;" 
alt="logo"></div></td>
+               </tr>
+       </table>
+       <br>
+       <table cellspacing="4">
+               <tr>
+                       <td>a A1</td>
+                       <td>aa A2</td>
+                       <td>aaa A3</td>
+                       <td>aaaa A4</td>
+               </tr>
+               <tr>
+                       <td rowspan="2">B1</td>
+                       <td style="font-size: 16pt">B2</td>
+                       <td colspan="2">B3</td>
+               </tr>
+               <tr>
+                       <td>C1</td>
+                       <td>C2</td>
+                       <td>C3</td>
+               </tr>
+               <tr>
+                       <td colspan="2">D1</td>
+                       <td colspan="2">D2</td>
+               </tr>
+       </table>
+       <hr>
+       <table>
+               <tr>
+                       <td colspan="2">CoucouCoucou !</td>
+                       <td>B</td>
+                       <td>CC</td>
+               </tr>
+               <tr>
+                       <td>AA</td>
+                       <td colspan="2">CoucouCoucou !</td>
+                       <td>CC</td>
+               </tr>
+               <tr>
+                       <td>AA</td>
+                       <td>B</td>
+                       <td colspan="2">CoucouCoucou !</td>
+               </tr>
+       </table>
+       <hr>
+       <table style="background: #FFFFFF">
+               <tr>
+                       <td>AA</td>
+                       <td>AA</td>
+                       <td>AA</td>
+                       <td rowspan="2">AA</td>
+               </tr>
+               <tr>
+                       <td>AA</td>
+                       <td rowspan="2" colspan="2" >CoucouCoucou !</td>
+               </tr>
+               <tr>
+                       <td>AA</td>
+                       <td>CC</td>
+               </tr>
+               <tr>
+                       <td colspan="2">D1</td>
+                       <td colspan="2">D2</td>
+               </tr>
+       </table>
+       <hr>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple08.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple09.png.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple09.png.php
                          (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple09.png.php
  2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,27 @@
+<?php
+       $px = isset($_GET['px']) ? $_GET['px'] : 0; $px = 
preg_replace('/[^0-9]/isU', '', $px);
+       $py = isset($_GET['py']) ? $_GET['py'] : 0; $py = 
preg_replace('/[^0-9]/isU', '', $py);
+       
+       if ($px<1) $px = 5;
+       if ($py<1) $py = 5;
+       
+       if ($px>20) $px = 20;
+       if ($py>20) $py = 20;
+       
+       $width  = 100;
+       $height = 100;
+       $im = imagecreatetruecolor($width, $height);
+       
+       for($y=0; $y<$height; $y+= $py)
+       {
+               for($x=0; $x<$width; $x+= $px)
+               {
+                       $c = imagecolorallocate($im, 200-$x, 100+$y, 100+$x-$y);
+                       imagefilledrectangle($im, $x, $y, $x+$px, $y+$py, $c);
+               }
+       }
+       
+       header("Content-type: image/png");
+       imagepng($im);
+       imagedestroy($im);
+?>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple09.png.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,122 @@
+<style type="text/css">
+<!--
+div.minifiche
+{
+       position:               relative;
+       overflow:               hidden;
+       width:                  454px;
+       height:                 138px;
+       padding:                0;
+       font-size:              11px;
+       text-align:             left;
+       font-weight:            normal;
+       background-image:       url(./res/exemple10a.gif);
+}
+div.minifiche img.icone                { position: absolute; border: none; 
left: 5px;          top: 5px; width: 240px;         height: 128px;  overflow: 
hidden; }
+div.minifiche div.zone1                { position: absolute; border: none; 
left: 257px;        top: 8px; width: 188px;         height: 14px;   
padding-top: 1px; overflow: hidden; text-align: center; font-weight: bold; }
+div.minifiche div.zone2                { position: absolute; border: none; 
left: 315px;        top: 28px; width: 131px;        height: 14px;   
padding-top: 1px; overflow: hidden; text-align: left;   font-weight: normal; }
+div.minifiche div.zone3                { position: absolute; border: none; 
left: 315px;        top: 48px; width: 131px;        height: 14px;   
padding-top: 1px; overflow: hidden; text-align: left;   font-weight: normal;}
+div.minifiche div.zone4                { position: absolute; border: none; 
left: 315px;        top: 68px; width: 131px;        height: 14px;   
padding-top: 1px; overflow: hidden; text-align: left;   font-weight: normal; }
+div.minifiche div.zone5                { position: absolute; border: none; 
left: 315px;        top: 88px; width: 131px;        height: 14px;   
padding-top: 1px; overflow: hidden; text-align: left;   font-weight: normal; }
+div.minifiche div.download     { position: absolute; border: none; left: 
257px;        top: 108px; width: 188px;       height: 22px;   overflow: hidden; 
text-align: center;   font-weight: normal; }
+
+-->
+</style>
+<page>
+       <div style="position: absolute; width: 10mm; height: 10mm; left:        
0; top:         0; border: solid 2px #0000EE; background: #AAAAEE"></div>
+       <div style="position: absolute; width: 10mm; height: 10mm; right:       
0; top:         0; border: solid 2px #00EE00; background: #AAEEAA"></div>
+       <div style="position: absolute; width: 10mm; height: 10mm; left:        
0; bottom:      0; border: solid 2px #EE0000; background: #EEAAAA"></div>
+       <div style="position: absolute; width: 10mm; height: 10mm; right:       
0; bottom:      0; border: solid 2px #EEEE00; background: #EEEEAA"></div>
+       <table style="width: 100%">
+               <tr>
+                       <td style="text-indent: 10mm; border: solid 1px 
#007700; width: 80%">
+                               <p>
+                                       Ligne dans un paragraphe,
+                                       test de texte assez long pour engendrer 
des retours \xE0 la ligne automatique... a b c d e f g h i j k l m n o p q r s 
t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z
+                                       test de texte assez long pour engendrer 
des retours \xE0 la ligne automatique... a b c d e f g h i j k l m n o p q r s 
t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z
+                               </p>
+                               <p>
+                                       Ligne dans un paragraphe,
+                                       test de texte assez long pour engendrer 
des retours \xE0 la ligne automatique... a b c d e f g h i j k l m n o p q r s 
t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z
+                                       test de texte assez long pour engendrer 
des retours \xE0 la ligne automatique... a b c d e f g h i j k l m n o p q r s 
t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z
+                               </p>
+                       </td>
+                       <td style="border: solid 1px #000077; width: 20%">
+                               Test de paragraphe :)
+                       </td>
+               </tr>
+       </table>
+       <hr>
+       <div class="minifiche" >
+               <img class="icone"      src="./res/exemple10b.jpg" 
alt="HTML2PDF" >
+               <div class="zone1">HTML2PDF</div>
+               <div class="zone2">PHP</div>
+               <div class="zone3">Utilitaire</div>
+               <div class="zone4">1.00</div>
+               <div class="zone5">01/01/1901</div>
+               <div class="download"><img src="./res/exemple10c.gif" alt="" 
style="border: none;"></div>
+       </div>
+       <hr>
+       <div style="border: solid 1px #000000; margin: 0; padding: 0; 
background: rgb(255, 255, 255); width: 400px; height: 300px; position: 
relative;">
+               <div style="border-style: solid; border-color: transparent 
rgb(170, 34, 34) rgb(170, 34, 34) transparent; border-width: 39.5px 59px;    
position: absolute; left: 101px; top: 52px; height: 0pt; width: 0pt;"></div>
+               <div style="border-style: solid; border-color: rgb(34, 170, 34) 
rgb(34, 170, 34) transparent transparent; border-width: 59px 39.5px;    
position: absolute; left: 101px; top: 131px; height: 0pt; width: 0pt;"></div>
+               <div style="border-style: solid; border-color: rgb(34, 34, 170) 
transparent transparent rgb(34, 34, 170); border-width: 39.5px 59px;    
position: absolute; left: 180px; top: 170px; height: 0pt; width: 0pt;"></div>
+               <div style="border-style: solid; border-color: transparent 
transparent rgb(170, 170, 34) rgb(170, 170, 34); border-width: 59px 39.5px;  
position: absolute; left: 219px; top: 52px; height: 0pt; width: 0pt;"></div>
+               <div style="position: absolute; left: 10px; top: 10px; 
font-size: 20px; font-family: Arial;">Exemple</div>
+       </div>
+       <hr>
+       <pre><?php
+       ob_start();
+       readfile(dirname(__FILE__).'/../exemple10.php');
+       echo htmlentities(ob_get_clean());
+       ?></pre>
+</page>
+<page orientation="paysage" >
+<style type="text/css">
+<!--
+
+div.main
+{
+       padding:        0;
+       margin:         0;
+       position:               relative;
+       left:                   50%;
+       margin-left:    -80mm;
+       width:                  160mm;
+       height:                 100mm;
+       text-align:             center;
+       border:                 solid 10px #111111;
+       background:             #222222;
+       color:                  #FFFFFF;
+       font-size:              10pt;
+       font-weight:    bold;
+       text-align:             center;
+}
+
+div.main a
+{
+       text-decoration:        none;
+       color:                  #EEEEEE;
+}
+
+div.main a:hover
+{
+       text-decoration:        underline;
+       color:                  #FFFFFF;
+}
+-->
+</style>
+       <div class="main">
+               <div style="position: absolute; top: 5mm; left: 5mm; 
font-size:12pt;text-align: left;">Spipu.net</div><br>
+               <div style="position: absolute; bottom: 5mm; right: 5mm; 
font-size:12pt;  text-align: right; ">(c)2009 Spipu</div>
+               <br><br><br>
+               <a href="http://cineblog.spipu.net/";    >Cineblog by Spipu      
                        </a><br><br>
+               <a href="http://html2pdf.fr/";                   >HTML2PDF       
                                        </a><br><br>
+               <a href="http://lambda.spipu.net/";              >Lambda Finder  
                                </a><br><br>
+               <a href="http://open.spipu.net/";                >Gestion des 
Opens - Yaronet    </a><br><br>
+               <a href="http://perso.spipu.net/";               >A propos de 
moi                                </a><br><br>
+               <a href="http://prgm.spipu.net/";                >Programmes by 
Spipu                    </a><br><br>
+               <a href="http://velib.spipu.net/";               >Mobile Velib 
Search                    </a><br>
+               <br><br><br>
+       </div>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10a.gif
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10a.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10b.jpg
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10b.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10c.gif
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple10c.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple11.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple11.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple11.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,23 @@
+<div style="border: 1px solid rgb(0, 0, 0); margin: 0; padding: 0; background: 
rgb(255, 255, 255); width: 400px; height: 300px;">
+       <div style="border-style: solid; border-color: transparent rgb(170, 34, 
170) rgb(170, 34, 170) transparent; border-width: 18px 56px; position: 
absolute; left: 111px; top: 69px; height: 0pt; width: 0pt;"></div><div 
style="border-style: solid; border-color: rgb(170, 34, 170) transparent 
transparent rgb(170, 34, 170); border-width: 18px 9px; position: absolute; 
left: 223px; top: 69px; height: 0pt; width: 0pt;"></div><div 
style="border-style: solid; border-color: transparent rgb(170, 34, 170) 
rgb(170, 34, 170) transparent; border-width: 3px 9px; position: absolute; left: 
223px; top: 63px; height: 0pt; width: 0pt;"></div><div style="border-style: 
solid; border-color: rgb(170, 34, 170) transparent transparent rgb(170, 34, 
170); border-width: 3px 1.5px; position: absolute; left: 241px; top: 63px; 
height: 0pt; width: 0pt;"></div><div style="border-style: solid; border-color: 
transparent rgb(170, 34, 170) rgb(170, 34, 170) transparent; border-width: 
0.5px 1.5px; position: absolute; left: 241px; top: 62px; height: 0pt; width: 
0pt;"></div><div style="border-style: solid; border-color: rgb(170, 34, 170) 
rgb(170, 34, 170) transparent transparent; border-width: 67px 22px; position: 
absolute; left: 111px; top: 105px; height: 0pt; width: 0pt;"></div><div 
style="border-style: solid; border-color: rgb(170, 34, 170) transparent 
transparent rgb(170, 34, 170); border-width: 67px 34px; position: absolute; 
left: 155px; top: 105px; height: 0pt; width: 0pt;"></div><div 
style="border-style: solid; border-color: transparent rgb(34, 170, 170) rgb(34, 
170, 170) transparent; border-width: 67px 33.5px; position: absolute; left: 
178px; top: 61px; height: 0pt; width: 0pt;"></div><div style="border-style: 
solid; border-color: transparent transparent rgb(34, 170, 170) rgb(34, 170, 
170); border-width: 67px 22px; position: absolute; left: 245px; top: 61px; 
height: 0pt; width: 0pt;"></div><div style="border-style: solid; border-color: 
rgb(34, 170, 170) transparent transparent rgb(34, 170, 170); border-width: 18px 
55.5px; position: absolute; left: 178px; top: 195px; height: 0pt; width: 
0pt;"></div><div style="border-style: solid; border-color: transparent rgb(34, 
170, 170) rgb(34, 170, 170) transparent; border-width: 18px 9px; position: 
absolute; left: 160px; top: 195px; height: 0pt; width: 0pt;"></div><div 
style="border-style: solid; border-color: rgb(34, 170, 170) transparent 
transparent rgb(34, 170, 170); border-width: 3px 9px; position: absolute; left: 
160px; top: 231px; height: 0pt; width: 0pt;"></div><div style="border-style: 
solid; border-color: transparent rgb(34, 170, 170) rgb(34, 170, 170) 
transparent; border-width: 3px 1.5px; position: absolute; left: 157px; top: 
231px; height: 0pt; width: 0pt;"></div><div style="border-style: solid; 
border-color: rgb(34, 170, 170) transparent transparent rgb(34, 170, 170); 
border-width: 0.5px 1.5px; position: absolute; left: 157px; top: 237px; height: 
0pt; width: 0pt;"></div>
+</div>
+<hr>
+<table style="width:100%;"> 
+       <tr> 
+               <td id="mon_td_trop_grand" style="width:100%;">
+                       Test de TD tr\xE8s grand, en d\xE9sactivant le test de 
TD ne devant pas depasser une page<br>
+                       via la m\xE9thode <b>setTestTdInOnePage</b>.<br>
+                       <table style="width:100%;"> 
+<?php for ($i=0;$i<=40;$i++){ ?> 
+                               <tr> 
+                                       <td style="border:1px solid 
red;width:100%;"> 
+                                               test de texte assez long pour 
engendrer des retours \xE0 la ligne automatique... 
+                                               a b c d e f g h i j k l m n o p 
q r s t u v w x y z 
+                                               a b c d e f g h i j k l m n o p 
q r s t u v w x y z 
+                                       </td> 
+                               </tr> 
+<?php } ?> 
+                       </table> 
+               </td> 
+       </tr> 
+</table>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple11.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple12.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple12.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple12.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,114 @@
+<?php
+       $chaine = 'test de texte assez long pour engendrer des retours \xE0 la 
ligne automatique...';
+       $chaine.= ', r\xE9p\xE9titif car besoin d\'un retour \xE0 la ligne'; 
+       $chaine.= ', r\xE9p\xE9titif car besoin d\'un retour \xE0 la ligne'; 
+       $chaine.= ', r\xE9p\xE9titif car besoin d\'un retour \xE0 la ligne'; 
+       $chaine.= ', r\xE9p\xE9titif car besoin d\'un retour \xE0 la ligne'; 
+?>
+<style type="text/css">
+<!--
+ul
+{
+       background:     #FFDDDD;
+       border:         solid 1px #FF0000;
+}
+
+ol
+{
+       background:     #DDFFDD;
+       border:         solid 1px #00FF00;
+}
+
+ul li
+{
+       background:     #DDFFAA;
+       border:         solid 1px #AAFF00;
+}
+
+ol li
+{
+       background:     #AADDFF;
+       border:         solid 1px #00AAFF;
+}
+-->
+</style>
+<page style="font-size: 11px">
+       <ul style="list-style-type: disc; width: 80%">
+               <li>
+                       Point 1 :<br><?php echo $chaine; ?> 
+               </li>
+               <li>
+                       Point 2 :<br><?php echo $chaine; ?> 
+                       <ul style="list-style-type: circle">
+                               <li>
+                                       Point 1 :<br><?php echo $chaine; ?> 
+                               </li>
+                               <li>
+                                       Point 2 :<br><?php echo $chaine; ?> 
+                                       <ul style="list-style-type: square">
+                                               <li>
+                                                       Point 1 :<br><?php echo 
$chaine; ?> 
+                                               </li>
+                                               <li>
+                                                       Point 2 :<br><?php echo 
$chaine; ?> 
+                                               </li>
+                                               <li>
+                                                       Point 3 :<br><?php echo 
$chaine; ?> 
+                                                       <ul 
style="list-style-image: url(./res/puce.gif)">
+                                                               <li>
+                                                                       Puce en 
image 1 :<br><?php echo $chaine; ?> 
+                                                               </li>
+                                                               <li>
+                                                                       Puce en 
image 2 :<br><?php echo $chaine; ?> 
+                                                               </li>
+                                                               <li>
+                                                                       Puce en 
image 3 :<br><?php echo $chaine; ?> 
+                                                               </li>
+                                                       </ul>
+                                               </li>
+                                       </ul>
+                               </li>
+                               <li>
+                                       Point 3 :<br><?php echo $chaine; ?> 
+                               </li>
+                       </ul>
+               </li>
+               <li>
+                       Point 3 :<br><?php echo $chaine; ?> 
+               </li>
+       </ul>
+       <hr><hr>
+       <ol style="list-style-type: upper-roman">
+               <li>
+                       Point 1 :<br><?php echo $chaine; ?> 
+               </li>
+               <li>
+                       Point 2 :<br><?php echo $chaine; ?> 
+                       <ol style="list-style-type: lower-alpha">
+                               <li>
+                                       Point 1 :<br><?php echo $chaine; ?> 
+                               </li>
+                               <li>
+                                       Point 2 :<br><?php echo $chaine; ?> 
+                                       <ol style="list-style-type: decimal">
+                                               <li>
+                                                       Point 1 :<br><?php echo 
$chaine; ?> 
+                                               </li>
+                                               <li>
+                                                       Point 2 :<br><?php echo 
$chaine; ?> 
+                                               </li>
+                                               <li>
+                                                       Point 3 :<br><?php echo 
$chaine; ?> 
+                                               </li>
+                                       </ol>
+                               </li>
+                               <li>
+                                       Point 3 :<br><?php echo $chaine; ?> 
+                               </li>
+                       </ol>
+               </li>
+               <li>
+                       Point 3 :<br><?php echo $chaine; ?> 
+               </li>
+       </ol>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple12.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple13.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple13.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple13.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,88 @@
+<style type="text/css">
+<!--
+table.tableau { text-align: left; }
+table.tableau td { width: 15mm; font-family: courier; }
+table.tableau th { width: 15mm; font-family: courier; }
+
+.ul1
+{
+       list-style-image: url(./res/puce2.gif);
+}
+.ul1 li
+{
+       color:#F19031;
+}
+.ul2
+{
+       list-style: square;
+}
+.ul2 li
+{
+       color:#31F190;
+}
+.ul3
+{
+       list-style: none;
+}
+.ul3 li
+{
+       color:#9031F1;
+}
+-->
+</style>
+Exemple de liste avec puce personnalis\xE9e :<br>
+<table style="width: 100%;" >
+       <tr>
+               <td style="width: 33%;">
+                       <ul class="ul1">
+                               <li>Votre ligne 1</li>
+                               <li>Votre ligne 2</li>
+                               <li>Votre ligne 3</li>
+                       </ul>
+               </td>
+               <td style="width: 34%;">
+                       <ul class="ul2">
+                               <li>Votre ligne 1</li>
+                               <li>Votre ligne 2</li>
+                               <li>Votre ligne 3</li>
+                       </ul>
+               </td>
+               <td style="width: 33%;">
+                       <ul class="ul3">
+                               <li>Votre ligne 1</li>
+                               <li>Votre ligne 2</li>
+                               <li>Votre ligne 3</li>
+                       </ul>
+               </td>
+       </tr>
+</table>
+Exemple de caracteres :<br>
+<table class="tableau" >
+       <tr><th>0</th><th>a</th><th>e</th><th>i</th><th>o</th><th>u</th></tr>
+       
<tr><th>1</th><td>&agrave;</td><td>&egrave;</td><td>&igrave;</td><td>&ograve;</td><td>&ugrave;</td></tr>
+       
<tr><th>2</th><td>&aacute;</td><td>&eacute;</td><td>&iacute;</td><td>&oacute;</td><td>&uacute;</td></tr>
+       
<tr><th>3</th><td>&acirc;</td><td>&ecirc;</td><td>&icirc;</td><td>&ocirc;</td><td>&ucirc;</td></tr>
+       
<tr><th>4</th><td>&auml;</td><td>&euml;</td><td>&iuml;</td><td>&ouml;</td><td>&uuml;</td></tr>
+       <tr><th>5</th><td>&atilde;</td><td> </td><td> 
</td><td>&otilde;</td><td> </td></tr>
+       <tr><th>6</th><td>&aring;</td><td> </td><td> </td><td> </td><td> 
</td></tr>
+       <tr><th>7</th><td>&euro;</td><td>&laquo;</td><td> 
</td><td>&oslash;</td><td> </td></tr>
+</table>
+<br>
+<?php
+       $phrase = "ceci est un exemple avec <b>du gras</b>,";
+       $phrase.= "<i>de l'italique</i>,";
+       $phrase.= "<u>du soulign\xE9</u>,";
+       $phrase.= "<u><i><b>et une image</b></i></u> : ";
+       $phrase.= "<img src='./res/logoHTMLtoPDF.gif' alt='logo' style='width: 
15mm'>";
+?>
+Table :<br>
+<table style="border: solid 1px red; width: 100mm"> 
+       <tr><td style="width: 100%; border: solid 1px green; text-align: left;  
"><?php echo $phrase; ?></td></tr> 
+       <tr><td style="width: 100%; border: solid 1px green; text-align: 
center;"><?php echo $phrase; ?></td></tr> 
+       <tr><td style="width: 100%; border: solid 1px green; text-align: right; 
"><?php echo $phrase; ?></td></tr> 
+</table>
+<br>
+Div :<br>
+<div style="width: 100mm; border: solid 1px green; text-align: left;  margin: 
1mm;padding: 1mm;"><?php echo $phrase; ?></div> 
+<div style="width: 100mm; border: solid 1px green; text-align: center;margin: 
1mm;padding: 1mm;"><?php echo $phrase; ?></div>
+<div style="width: 100mm; border: solid 1px green; text-align: right; margin: 
1mm;padding: 1mm;"><?php echo $phrase; ?></div>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple13.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple14.php
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple14.php  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple14.php  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,41 @@
+<page footer="form">
+       <h1>Test de formulaire</h1><br>
+       <br>
+       <form>
+               <input type="hidden" name="test" >
+               Vous utilisez cette librairie dans le cadre :
+               <ul style="list-style: none">
+                       <li><input type="checkbox" name="cadre1" 
checked="checked" > du boulot</li>
+                       <li><input type="checkbox" name="cadre2" > perso</li>
+               </ul>
+               Vous \xEAtes :
+               <ul style="list-style: none">
+                       <li><input type="radio" name="sexe" > un homme</li>
+                       <li><input type="radio" name="sexe" > une femme</li>
+               </ul>
+               Vous avez : 
+               <select name="age" >
+                       <option value="15">moins de 15 ans</option>
+                       <option value="20">entre 15 et 20 ans</option>
+                       <option value="25">entre 20 et 25 ans</option>
+                       <option value="30">entre 25 et 30 ans</option>
+                       <option value="40">plus de 30 ans</option>
+               </select><br>
+               <br>
+               Vous aimez : 
+               <select name="aime" size="5" multiple="multiple">
+                       <option value="ch1">l'informatique</option>
+                       <option value="ch2">le cin\xE9ma</option>
+                       <option value="ch3">le sport</option>
+                       <option value="ch4">la litt\xE9rature</option>
+                       <option value="ch5">autre</option>
+               </select><br>
+               <br>
+               Votre phrase f\xE9tiche : <input type="text" name="phrase" 
value="cette lib est  g\xE9niale !!!" style="width: 100mm"><br>
+               <br>
+               Un commentaire ?<br>
+               <textarea name="comment" rows="3" cols="30">rien de 
particulier</textarea><br>
+               <br>
+               <input type="button" value="Imprimer" onclick="print(true);">
+       </form>
+</page>
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/exemple14.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/logoHTMLtoPDF.gif
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/logoHTMLtoPDF.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/off.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/off.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/puce.gif
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/puce.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/puce2.gif
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/puce2.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/regle.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/exemples/res/regle.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/html2pdf.class.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/html2pdf.class.php      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/html2pdf.class.php      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,4804 @@
+<?php
+/**
+ * Logiciel : HTML2PDF
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * @version            3.25 - 07/10/2009
+ */
+
+date_default_timezone_set('Europe/Oslo');
+if (!defined('__CLASS_HTML2PDF__'))
+{
+       define('__CLASS_HTML2PDF__', '3.25');
+
+       require_once(dirname(__FILE__).'/_mypdf/mypdf.class.php');      // 
classe mypdf d\xE9riv\xE9 de fpdf de Olivier PLATHEY 
+       require_once(dirname(__FILE__).'/parsingHTML.class.php');       // 
classe de parsing HTML
+       require_once(dirname(__FILE__).'/styleHTML.class.php');         // 
classe de gestion des styles
+
+       global $HTML2PDF_TABLEAU;       $HTML2PDF_TABLEAU = array();    // 
tableau global necessaire \xE0 la gestion des tables imbriqu\xE9es 
+
+       class HTML2PDF
+       {
+               var $langue                     = 'fr';         // langue des 
messages
+               var $sens                       = 'P';          // sens 
d'affichage Portrait ou Landscape
+               var $format                     = 'A4';         // format de la 
page : A4, A3, ...
+               var $background         = array();      // informations sur le 
background
+               var $testTDin1page      = true;         // activer le test de 
TD ne devant pas depasser une page
+               var $testIsImage        = true;         // test si les images 
existes ou non
+               
+               var $style                      = null;         // objet de 
style
+               var $parsing            = null;         // objet de parsing
+               var $parse_pos          = 0;            // position du parsing
+               var $temp_pos           = 0;            // position temporaire 
pour multi tableau
+               var $page                       = 0;            // numero de la 
page courante
+               
+               var $sub_html           = null;         // sous html
+               var $sub_part           = false;        // indicateur de sous 
html
+               var $isSubPart          = false;        // indique que le 
convertisseur courant est un sous html
+               
+               var $pdf                        = null;         // objet PDF
+               var $maxX                       = 0;            // zone maxi X
+               var $maxY                       = 0;            // zone maxi Y
+
+               var $FirstPage          = true;         // premier page
+               
+               var $defaultLeft        = 0;            // marges par default 
de la page
+               var $defaultTop         = 0;
+               var $defaultRight       = 0;
+               var $defaultBottom      = 0;
+               
+               var $margeLeft          = 0;            //marges r\xE9elles de 
la page
+               var $margeTop           = 0;
+               var $margeRight         = 0;
+               var $margeBottom        = 0;
+               var $marges                     = array();
+               var $Maxs                       = array();
+               
+               var $maxH                       = 0;            // plus grande 
hauteur dans la ligne, pour saut de ligne \xE0 corriger
+               var $inLink                     = '';           // indique si 
on est \xE0 l'interieur d'un lien
+               var $lstAncre           = array();      // liste des ancres 
d\xE9tect\xE9es ou cr\xE9\xE9es
+               var $subHEADER          = array();      // tableau des sous 
commandes pour faire l'HEADER
+               var $subFOOTER          = array();      // tableau des sous 
commandes pour faire le FOOTER
+               var $subSTATES          = array();      // tableau de 
sauvegarde de certains param\xE8tres
+               var $defLIST            = array();      // tableau de 
sauvegarde de l'etat des UL et OL
+               
+               var $lstChamps          = array();      // liste des champs
+               var $lstSelect          = array();      // options du select en 
cours
+               var $previousCall       = null;         // dernier appel
+               var $isInTfoot          = false;        // indique si on est 
dans un tfoot
+               var $pageMarges         = array();      // marges 
sp\xE9cifiques dues aux floats
+               var $isAfterFloat       = false;        // indique si on est 
apres un float
+               var $forOneLine         = false;        // indique si on est 
dans un sous HTML ne servant qu'a calculer la taille de la prochaine ligne
+               var $encoding           = 'ISO-8859-15';                // 
encodage utilis\xE9 pour les entites html
+               
+               var $DEBUG_actif                = false;        // indique si 
on est en mode debug
+               var $DEBUG_ok_usage             = false;        // indique 
l'existance de la fonction memory_get_usage
+               var $DEBUG_ok_peak              = false;        // indique 
l'existance de la fonction memory_get_peak_usage
+               var $DEBUG_level                = 0;            // niveau du 
debug
+               var $DEBUG_start_time   = 0;            // 
+               var $DEBUG_last_time    = 0;            // 
+               
+               /**
+                * Constructeur
+                *
+                * @param       string          sens portrait ou landscape
+                * @param       string          format A4, A5, ...
+                * @param       string          langue : fr, en, it...
+                * @param       array           marges par defaut, dans l'ordre 
(left, top, right, bottom)
+                * @param       boolean         forcer la cr\xE9ation de la 
premiere page, ne pas utiliser, c'est utilis\xE9 en interne pour la gestion des 
tableaux
+                * @return      null
+                */
+               function HTML2PDF($sens = 'P', $format = 'A4', $langue='fr', 
$marges = array(5, 5, 5, 8), $force_page = false)
+               {
+                       // sauvegarde des param\xE8tres
+                       $this->page             = 0;
+                       $this->sens                     = $sens;
+                       $this->format           = $format;
+                       $this->FirstPage        = true;
+                       $this->langue           = strtolower($langue);
+                       $this->setTestTdInOnePage(true);
+                       $this->setTestIsImage(true);
+                       
+                       // chargement du fichier de langue
+                       $this->textLOAD($this->langue);
+                       
+                       // cr\xE9ation de l' objet PDF
+                       $this->pdf = new MyPDF($sens, 'mm', $format);
+
+                       // initialisation des styles
+                       $this->style = new styleHTML($this->pdf);
+                       $this->style->FontSet();
+                       $this->defLIST = array();
+                       
+                       // initialisation du parsing
+                       $this->parsing = new parsingHTML();
+                       $this->sub_html = null; 
+                       $this->sub_part = false;
+                       
+                       // initialisation des marges
+                       $this->setDefaultMargins($marges[0], $marges[1], 
$marges[2], $marges[3]);
+                       $this->setMargins();
+                       $this->marges = array();
+
+                       // initialisation des champs de formulaire
+                       $this->lstChamps = array();
+
+                       // premier page forc\xE9e
+                       if ($force_page) $this->setNewPage($this->sens);
+               }
+               
+               /**
+               * activer le debug mode
+               *
+               * @return       null
+               */
+               function setModeDebug()
+               {
+                       list($usec, $sec) = explode(' ', microtime());
+                       
+                       $this->DEBUG_actif = true;
+                       $this->DEBUG_ok_usage = 
function_exists('memory_get_usage');
+                       $this->DEBUG_ok_peak = 
function_exists('memory_get_peak_usage');
+                       $this->DEBUG_start_time         = (float)$sec + 
(float)$usec;
+                       $this->DEBUG_last_time          = (float)$sec + 
(float)$usec;
+                       
+                       $this->DEBUG_stepline('step', 'time', 'delta', 
'memory', 'peak');
+                       $this->DEBUG_add('Init debug');
+               }
+               
+               /**
+               * rajouter une ligne de debug
+               *
+               * @param        string  nom de l'etape
+               * @param        boolean true=monter d'un niveau, 
false=descendre d'un niveau, null : ne rien faire
+               * @return       null
+               */
+               function DEBUG_add($nom, $level=null)
+               {
+                       list($usec, $sec) = explode(' ', microtime());
+                       if ($level===true) $this->DEBUG_level++;
+
+                       $nom    = str_repeat('  ',$this->DEBUG_level). 
$nom.($level===true ? ' Begin' : ($level===false ? ' End' : ''));
+                       $time   = (float)$sec + (float)$usec;
+                       $usage  = ($this->DEBUG_ok_usage ? memory_get_usage() : 
0);
+                       $peak   = ($this->DEBUG_ok_peak ? 
memory_get_peak_usage() : 0);
+
+                       $this->DEBUG_stepline(
+                                               $nom,
+                                               number_format(($time - 
$this->DEBUG_start_time)*1000, 1, '.', ' ').' ms',
+                                               number_format(($time - 
$this->DEBUG_last_time)*1000, 1, '.', ' ').' ms',
+                                               number_format($usage/1024, 1, 
'.', ' ').' Ko',
+                                               number_format($peak/1024, 1, 
'.', ' ').' Ko');
+                                               
+                       $this->DEBUG_last_time = $time;
+                       if ($level===false) $this->DEBUG_level--;
+                       return true;
+               }
+               
+               /**
+               * affiche une ligne de debug
+               *
+               * @param        string  nom de l'etape
+               * @param        string  valeur 1
+               * @param        string  valeur 2
+               * @param        string  valeur 3
+               * @param        string  valeur 4
+               * @return       null
+               */
+               function DEBUG_stepline($nom, $val1, $val2, $val3, $val4)
+               {
+                       $txt = str_pad($nom, 30, ' ', STR_PAD_RIGHT).
+                                       str_pad($val1, 12, ' ', STR_PAD_LEFT).
+                                       str_pad($val2, 12, ' ', STR_PAD_LEFT).
+                                       str_pad($val3, 15, ' ', STR_PAD_LEFT).
+                                       str_pad($val4, 15, ' ', STR_PAD_LEFT);
+                                       
+                       echo '<pre style="padding:0; margin:0">'.$txt.'</pre>';
+               }
+               
+               /**
+               * activer ou desactiver le test de TD ne devant pas depasser 
une page
+               *
+               * @param        boolean nouvel etat
+               * @return       boolean ancien etat
+               */
+               function setTestTdInOnePage($mode = true)
+               {
+                       $old = $this->testTDin1page;
+                       
+                       $this->testTDin1page = $mode ? true : false;
+                       
+                       return $old;
+               }
+               
+               function setEncoding($encoding)
+               {
+                       $this->encoding = $encoding;
+               }
+               
+               /**
+               * activer ou desactiver le test sur la pr\xE9sence des images
+               *
+               * @param        boolean nouvel etat
+               * @return       boolean ancien etat
+               */
+               function setTestIsImage($mode = true)
+               {
+                       $old = $this->testIsImage;
+                       
+                       $this->testIsImage = $mode ? true : false;
+                       
+                       return $old;
+               }
+               
+               /**
+               * d\xE9finir les marges par d\xE9fault
+               *
+               * @param        int             en mm, marge left
+               * @param        int             en mm, marge top
+               * @param        int             en mm, marge right. si null, 
left=right
+               * @param        int             en mm, marge bottom. si null, 
bottom=8
+               * @return       null
+               */
+               function setDefaultMargins($left, $top, $right = null, $bottom 
= null)
+               {
+                       if ($right===null)      $right = $left;
+                       if ($bottom===null)     $bottom = 8;
+                       
+                       $this->defaultLeft              = 
$this->style->ConvertToMM($left.'mm');
+                       $this->defaultTop               = 
$this->style->ConvertToMM($top.'mm');
+                       $this->defaultRight             = 
$this->style->ConvertToMM($right.'mm');
+                       $this->defaultBottom    = 
$this->style->ConvertToMM($bottom.'mm');
+               }
+
+               /**
+               * d\xE9finir les marges r\xE9elles, fonctions de la balise page
+               *
+               * @return       null
+               */
+               function setMargins()
+               {
+                       $this->margeLeft        = $this->defaultLeft    + 
(isset($this->background['left'])             ? $this->background['left']       
      : 0);
+                       $this->margeRight       = $this->defaultRight   + 
(isset($this->background['right'])    ? $this->background['right']    : 0);
+                       $this->margeTop         = $this->defaultTop     + 
(isset($this->background['top'])              ? $this->background['top']        
      : 0);
+                       $this->margeBottom      = $this->defaultBottom  + 
(isset($this->background['bottom'])   ? $this->background['bottom']   : 0);
+                       
+                       $this->pdf->SetMargins($this->margeLeft, 
$this->margeTop, $this->margeRight);                   
+                       $this->pdf->cMargin = 0;
+                       $this->pdf->SetAutoPageBreak(false, $this->margeBottom);
+               }
+               
+               /**
+               * recuperer les positions x minimales et maximales en fonction 
d'une hauteur
+               *
+               * @param        float   y
+               * @return       array(float, float)
+               */
+               function getMargins($y)
+               {
+                       $y = floor($y*100);
+                       $x = array($this->pdf->lMargin, 
$this->pdf->w-$this->pdf->rMargin);
+                       
+                       foreach($this->pageMarges as $m_y => $m_x)
+                               if ($m_y<=$y) $x = $m_x;
+                       
+                       return $x;
+               }
+               
+               /**
+               * ajouter une marge suite a un float
+               *
+               * @param        string  left ou right
+               * @param        float   x1
+               * @param        float   y1
+               * @param        float   x2
+               * @param        float   y2
+               * @return       null
+               */
+               function addMargins($float, $x1, $y1, $x2, $y2)
+               {
+                       $old1 = $this->getMargins($y1);
+                       $old2 = $this->getMargins($y2);
+                       if ($float=='left')  $old1[0] = $x2;
+                       if ($float=='right') $old1[1] = $x1;
+                       
+                       $y1 = floor($y1*100);
+                       $y2 = floor($y2*100);
+
+                       foreach($this->pageMarges as $m_y => $m_x)
+                       {
+                               if ($m_y<$y1) continue;                         
+                               if ($m_y>$y2) break;    
+                               if ($float=='left'  && 
$this->pageMarges[$m_y][0]<$x2) unset($this->pageMarges[$m_y]);
+                               if ($float=='right' && 
$this->pageMarges[$m_y][1]>$x1) unset($this->pageMarges[$m_y]);
+                       }
+
+                       $this->pageMarges[$y1] = $old1;
+                       $this->pageMarges[$y2] = $old2;
+                       
+                       ksort($this->pageMarges);
+                       
+                       $this->isAfterFloat = true;
+               }
+       
+               /**
+               * d\xE9finir des nouvelles marges et sauvegarder les anciennes
+               *
+               * @param        float   marge left
+               * @param        float   marge top
+               * @param        float   marge right
+               * @return       null
+               */
+               function saveMargin($ml, $mt, $mr)
+               {
+                       $this->marges[] = array('l' => $this->pdf->lMargin, 't' 
=> $this->pdf->tMargin, 'r' => $this->pdf->rMargin, 'page' => 
$this->pageMarges);
+                       $this->pdf->SetMargins($ml, $mt, $mr);
+
+                       $this->pageMarges = array();
+                       $this->pageMarges[floor($mt*100)] = array($ml, 
$this->pdf->w-$mr);
+               }
+                                               
+               /**
+               * r\xE9cuperer les derni\xE8res marches sauv\xE9es
+               *
+               * @return       null
+               */
+               function loadMargin()
+               {
+                       $old = array_pop($this->marges);
+                       if ($old)
+                       {
+                               $ml = $old['l'];
+                               $mt = $old['t'];
+                               $mr = $old['r'];
+                               $mP = $old['page'];
+                       }
+                       else
+                       {
+                               $ml = $this->margeLeft;
+                               $mt = 0;
+                               $mr = $this->margeRight;
+                               $mP = array($mt => array($ml, 
$this->pdf->w-$mr));
+                       }
+                       
+                       $this->pdf->SetMargins($ml, $mt, $mr);
+                       $this->pageMarges = $mP;
+               }
+               
+               /**
+               * permet d'ajouter une fonte.
+               *
+               * @param        string nom de la fonte
+               * @param        string style de la fonte
+               * @param        string fichier de la fonte
+               * @return       null
+               */
+               function AddFont($family, $style='', $file='')
+               {
+                       $this->pdf->AddFont($family, $style, $file);
+               }
+               
+               /**
+               * sauvegarder l'\xE9tat actuelle des maximums
+               *
+               * @return       null
+               */
+               function saveMax()
+               {
+                       $this->Maxs[] = array($this->maxX, $this->maxY, 
$this->maxH);
+               }
+                               
+               /**
+               * charger le dernier \xE9tat sauv\xE9 des maximums
+               *
+               * @return       null
+               */
+               function loadMax()
+               {
+                       $old = array_pop($this->Maxs);
+
+                       if ($old)
+                       {
+                               $this->maxX = $old[0];
+                               $this->maxY = $old[1];
+                               $this->maxH = $old[2];
+                       }
+                       else
+                       {
+                               $this->maxX = 0;
+                               $this->maxY = 0;
+                               $this->maxH = 0;
+                       }
+               }
+               
+               /**
+               * afficher l'header contenu dans page_header
+               *
+               * @return       null
+               */
+               function SetPageHeader()
+               {
+                       if (!count($this->subHEADER)) return false;
+
+                       $OLD_parse_pos = $this->parse_pos;
+                       $OLD_parse_code = $this->parsing->code;
+                       
+                       $this->parse_pos = 0;
+                       $this->parsing->code = $this->subHEADER;
+                       $this->MakeHTMLcode();
+                       
+                       $this->parse_pos =      $OLD_parse_pos;
+                       $this->parsing->code = $OLD_parse_code;
+               }
+
+               /**
+               * afficher le footer contenu dans page_footer
+               *
+               * @return       null
+               */
+               function SetPageFooter()
+               {
+                       if (!count($this->subFOOTER)) return false;
+
+                       $OLD_parse_pos = $this->parse_pos;
+                       $OLD_parse_code = $this->parsing->code;
+                       
+                       $this->parse_pos = 0;
+                       $this->parsing->code = $this->subFOOTER;
+                       $this->MakeHTMLcode();
+                       
+                       $this->parse_pos =      $OLD_parse_pos;
+                       $this->parsing->code = $OLD_parse_code;
+               }
+               
+               /**
+               * saut de ligne avec une hauteur sp\xE9cifique
+               *
+               * @param        float   hauteur de la ligne
+               * @param        integer position reelle courante si saut de 
ligne pendant l'ecriture d'un texte 
+               * @return       null
+               */
+               function setNewLine($h, $curr = null)
+               {
+                       $this->pdf->Ln($h);
+                       
+                       $this->setNewPositionForNewLine($curr);
+               }
+                       
+               /**
+               * cr\xE9ation d'une nouvelle page avec une orientation 
particuliere
+               *
+               * @param        string  sens P=portrait ou L=landscape
+               * @param        array   tableau des propri\xE9t\xE9s du fond de 
la page
+               * @param        integer position reelle courante si saut de 
ligne pendant l'ecriture d'un texte 
+               * @return       null
+               */
+               function setNewPage($orientation = '', $background = null, 
$curr = null)
+               {
+                       $this->FirstPage = false;
+
+                       $this->sens = $orientation ? $orientation : $this->sens;
+                       $this->background = $background!==null ? $background : 
$this->background;
+                       $this->maxY = 0;        
+                       $this->maxX = 0;
+                       $this->maxH = 0;
+                       
+                       $this->pdf->lMargin = $this->defaultLeft;
+                       $this->pdf->rMargin = $this->defaultRight;
+                       $this->pdf->tMargin = $this->defaultTop;
+                       $this->pdf->AddPage($this->sens);
+                       $this->page++;
+                       
+                       if (!$this->sub_part && !$this->isSubPart)
+                       {
+                               if (is_array($this->background))
+                               {
+                                       if (isset($this->background['color']) 
&& $this->background['color'])
+                                       {
+                                               
$this->pdf->SetFillColor($this->background['color'][0], 
$this->background['color'][1], $this->background['color'][2]);
+                                               $this->pdf->Rect(0, 0, 
$this->pdf->w, $this->pdf->h, 'F');
+                                       }
+
+                                       if (isset($this->background['img']) && 
$this->background['img'])
+                                               
$this->pdf->Image($this->background['img'], $this->background['posX'], 
$this->background['posY'], $this->background['width']);
+                               }       
+                               
+                               $this->SetPageHeader();
+                               $this->SetPageFooter();
+                       }
+                       
+                       $this->SetMargins();
+                       $this->pdf->y = $this->margeTop;
+                       
+                       $this->setNewPositionForNewLine($curr);
+                       $this->maxH = 0;
+               }
+               
+               /**
+               * calcul de la position de debut de la prochaine ligne en 
fonction de l'alignement voulu
+               *
+               * @param        integer position reelle courante si saut de 
ligne pendant l'ecriture d'un texte 
+               * @return       null
+               */
+               function setNewPositionForNewLine($curr = null)
+               {
+                       list($lx, $rx) = $this->getMargins($this->pdf->y);
+                       $this->pdf->x=$lx;
+                       
+                       if (
+                               $this->style->value['text-align']!='right' && 
+                               $this->style->value['text-align']!='center' && 
+                               $this->style->value['text-align']!='justify'
+                               )
+                               return null;
+
+                       $sub = null;
+                       $this->CreateSubHTML($sub);
+                       $sub->saveMargin(0, 0,  $sub->pdf->w-$rx+$lx);
+                       $sub->forOneLine = true;
+                       $sub->parse_pos = $this->parse_pos;
+                       $sub->parsing->code = $this->parsing->code;
+                       
+                       if ($curr!==null && 
$sub->parsing->code[$this->parse_pos]['name']=='write')
+                               
$sub->parsing->code[$this->parse_pos]['param']['txt'] = 
substr($sub->parsing->code[$this->parse_pos]['param']['txt'], $curr);
+                       else
+                               $sub->parse_pos++;
+                               
+                       // pour chaque element identifi\xE9 par le parsing
+                       for($sub->parse_pos; 
$sub->parse_pos<count($sub->parsing->code); $sub->parse_pos++)
+                       {
+                               $todo = $sub->parsing->code[$sub->parse_pos];
+                               if (!$sub->loadAction($todo)) break;
+                       }
+
+                       $w = $sub->maxX;
+
+                       unset($sub);
+                       if ($this->style->value['text-align']=='center')
+                               $this->pdf->x+= ($rx-$this->pdf->x-$w)*0.5-0.01;
+                       elseif ($this->style->value['text-align']=='right')
+                               $this->pdf->x = $rx-$w-0.01;
+                       else
+                               $this->pdf->x = $lx;
+               }
+               
+               /** 
+               * r\xE9cup\xE9ration du PDF 
+               * 
+               * @param        string  nom du fichier PDF 
+               * @param        boolean destination 
+               * @return       string  contenu \xE9ventuel du pdf
+               * 
+               *
+               * Destination o\xF9 envoyer le document. Le param\xE8tre peut 
prendre les valeurs suivantes :
+               * true  : equivalent \xE0 I
+               * false : equivalent \xE0 S  
+               * I : envoyer en inline au navigateur. Le plug-in est 
utilis\xE9 s'il est install\xE9. Le nom indiqu\xE9 dans name est utilis\xE9 
lorsque l'on s\xE9lectionne "Enregistrer sous" sur le lien g\xE9n\xE9rant le 
PDF.
+               * D : envoyer au navigateur en for\xE7ant le 
t\xE9l\xE9chargement, avec le nom indiqu\xE9 dans name.
+               * F : sauver dans un fichier local, avec le nom indiqu\xE9 dans 
name (peut inclure un r\xE9pertoire).
+               * S : renvoyer le document sous forme de cha\xEEne. name est 
ignor\xE9.
+               */
+               function Output($name = '', $dest = false)
+               {
+                       if ($this->DEBUG_actif)
+                       {
+                               $this->DEBUG_add('Before output');
+                               exit;
+                       }
+                       
+                       // nettoyage
+                       global $HTML2PDF_TABLEAU; $HTML2PDF_TABLEAU = array();
+
+                       // interpretation des param\xE8tres
+                       if ($dest===false)      $dest = 'I';
+                       if ($dest===true)       $dest = 'S';
+                       if ($dest==='')         $dest = 'I';
+                       if ($name=='')          $name='document.pdf';
+                       
+                       // verification de la destination
+                       $dest = strtoupper($dest);
+                       if (!in_array($dest, array('I', 'D', 'F', 'S'))) $dest 
= 'I';
+       
+                       // verification du nom
+                       if (strtolower(substr($name, -4))!='.pdf')
+                       {
+                               echo 'ERROR : The output document name 
"'.$name.'" is not a PDF name';
+                               exit;
+                       }
+                       
+
+                       return $this->pdf->Output($name, $dest);
+               }
+               
+               /**
+               * cr\xE9ation d'un sous HTML2PDF pour la gestion des tableaux 
imbriqu\xE9s
+               *
+               * @param        HTML2PDF        futur sous HTML2PDF pass\xE9 en 
r\xE9f\xE9rence pour cr\xE9ation
+               * @param        integer         marge eventuelle de l'objet si 
simulation d'un TD
+               * @return       null
+               */              
+               function CreateSubHTML(&$sub_html, $cellmargin=0)
+               {
+                       // initialisation du sous objet
+                       $sub_html = new HTML2PDF(
+                                                                               
$this->sens,
+                                                                               
$this->format,
+                                                                               
$this->langue,
+                                                                               
array($this->defaultLeft,$this->defaultTop,$this->defaultRight,$this->defaultBottom),
+                                                                               
true
+                                                                       );
+                       $sub_html->isSubPart = true;
+                       $sub_html->setEncoding($this->encoding);
+                       $sub_html->setTestTdInOnePage($this->testTDin1page);
+                       
+                       $sub_html->style->css                   = 
$this->style->css;
+                       $sub_html->style->css_keys              = 
$this->style->css_keys;
+                       $sub_html->style->table                 = 
$this->style->table;
+                       $sub_html->style->value                 = 
$this->style->value;
+                       $sub_html->style->value['text-align'] = 'left';
+                       $sub_html->defLIST                              = 
$this->defLIST;
+                       $sub_html->style->onlyLeft = true;
+                       
+                       // initialisation de la largeur
+                       if ($this->style->value['width'])
+                       {
+                               $marge = $cellmargin*2;
+                               $marge+= $this->style->value['padding']['l'] + 
$this->style->value['padding']['r'];
+                               $marge+= 
$this->style->value['border']['l']['width'] + 
$this->style->value['border']['r']['width'];
+                               $marge = $sub_html->pdf->w - 
$this->style->value['width'] + $marge;
+                       }
+                       else
+                               $marge = $this->margeLeft+$this->margeRight;
+                       
+                       $sub_html->saveMargin(0, 0, $marge);
+
+                       // initialisation des fontes
+                       $sub_html->pdf->fonts           = &$this->pdf->fonts;
+                       $sub_html->pdf->FontFiles       = 
&$this->pdf->FontFiles;
+                       $sub_html->pdf->diffs           = &$this->pdf->diffs;
+
+                       // initialisation des positions et autre
+                       $sub_html->page = $this->page;
+                       $sub_html->maxX = 0;
+                       $sub_html->maxY = 0;
+                       $sub_html->maxH = 0;
+                       $sub_html->pdf->setX(0);
+                       $sub_html->pdf->setY(0);
+                       $sub_html->style->FontSet();
+               }
+               
+               /**
+               * destruction d'un sous HTML2PDF pour la gestion des tableaux 
imbriqu\xE9s
+               *
+               * @return       null
+               */      
+               function DestroySubHTML()
+               {
+                       
+                       unset($this->sub_html);
+                       $this->sub_html = null; 
+               }
+               
+               /**
+               * Convertir un nombre arabe en nombre romain
+               *
+               * @param        integer nombre \xE0 convertir
+               * @return       string  nombre converti
+               */
+               function listeArab2Rom($nb_ar)
+               {
+                       $nb_b10 = array('I','X','C','M');
+                       $nb_b5  = array('V','L','D');
+                       $nb_ro  = '';
+
+                       if ($nb_ar<1)           return $nb_ar;
+                       if ($nb_ar>3999)        return $nb_ar;
+
+                       for($i=3; $i>=0 ; $i--)
+                       {
+                               $chiffre=floor($nb_ar/pow(10,$i));
+                               if($chiffre>=1)
+                               {
+                                       $nb_ar=$nb_ar-$chiffre*pow(10,$i);
+                                       if($chiffre<=3)
+                                       {
+                                               for($j=$chiffre; $j>=1; $j--)
+                                               {
+                                                       
$nb_ro=$nb_ro.$nb_b10[$i];
+                                               }
+                                       }
+                                       else if($chiffre==9)
+                                       {
+                                               
$nb_ro=$nb_ro.$nb_b10[$i].$nb_b10[$i+1];
+                                       }
+                                       elseif($chiffre==4)
+                                       {
+                                       $nb_ro=$nb_ro.$nb_b10[$i].$nb_b5[$i];
+                                       }
+                                       else
+                                       {
+                                               $nb_ro=$nb_ro.$nb_b5[$i];
+                                               for($j=$chiffre-5; $j>=1; $j--)
+                                               {
+                                                       
$nb_ro=$nb_ro.$nb_b10[$i];
+                                               }
+                                       }
+                               }
+                       }
+                       return $nb_ro;
+               }
+               
+               /**
+               * Ajouter un LI au niveau actuel
+               *
+               * @return       null
+               */
+               function listeAddLi()
+               {
+                       $this->defLIST[count($this->defLIST)-1]['nb']++;
+               }
+
+               function listeGetWidth()        { return '7mm'; }
+               function listeGetPadding()      { return '1mm'; }
+
+               /**
+               * Recuperer le LI du niveau actuel
+               *
+               * @return       string  chaine \xE0 afficher
+               */
+               function listeGetLi()
+               {
+                       $im = $this->defLIST[count($this->defLIST)-1]['img'];
+                       $st = $this->defLIST[count($this->defLIST)-1]['style'];
+                       $nb = $this->defLIST[count($this->defLIST)-1]['nb'];
+                       $up = (substr($st, 0, 6)=='upper-');
+                       
+                       if ($im) return array(false, false, $im);
+                       
+                       switch($st)
+                       {
+                               case 'none':
+                                       return array('arial', true, ' ');
+                                       
+                               case 'upper-alpha':
+                               case 'lower-alpha':
+                                       $str = '';
+                                       while($nb>26)
+                                       {
+                                               $str = chr(96+$nb%26).$str; 
+                                               $nb = floor($nb/26);    
+                                       }
+                                       $str = chr(96+$nb).$str; 
+                                       
+                                       return array('arial', false, ($up ? 
strtoupper($str) : $str).'.');
+
+                               case 'upper-roman':
+                               case 'lower-roman':
+                                       $str = $this->listeArab2Rom($nb);
+                                       
+                                       return array('arial', false, ($up ? 
strtoupper($str) : $str).'.');
+                                       
+                               case 'decimal':
+                                       return array('arial', false, $nb.'.');
+
+                               case 'square':
+                                       return array('zapfdingbats', true, 
chr(110));
+
+                               case 'circle':
+                                       return array('zapfdingbats', true, 
chr(109));
+
+                               case 'disc':
+                               default:
+                                       return array('zapfdingbats', true, 
chr(108));
+                       }
+               }
+                               
+               /**
+               * Ajouter un niveau de liste
+               *
+               * @param        string  type de liste : ul, ol
+               * @param        string  style de la liste
+               * @return       null
+               */
+               function listeAddLevel($type = 'ul', $style = '', $img = null)
+               {
+                       if ($img)
+                       {
+                               if (preg_match('/^url\(([^)]+)\)$/isU', 
trim($img), $match))
+                                       $img = $match[1];
+                               else
+                                       $img = null;
+                       }
+                       else
+                               $img = null;
+                       
+                       if (!in_array($type, array('ul', 'ol'))) $type = 'ul';
+                       if (!in_array($style, array('lower-alpha', 
'upper-alpha', 'upper-roman', 'lower-roman', 'decimal', 'square', 'circle', 
'disc', 'none'))) $style = '';
+                       
+                       if (!$style)
+                       {
+                               if ($type=='ul')        $style = 'disc';
+                               else                            $style = 
'decimal';
+                       }
+                       $this->defLIST[count($this->defLIST)] = array('style' 
=> $style, 'nb' => 0, 'img' => $img);
+               }
+               
+               /**
+               * Supprimer un niveau de liste
+               *
+               * @return       null
+               */
+               function listeDelLevel()
+               {
+                       if (count($this->defLIST))
+                       {
+                               unset($this->defLIST[count($this->defLIST)-1]);
+                               $this->defLIST = array_values($this->defLIST);
+                       }
+               }
+               
+               /**
+               * traitement d'un code HTML
+               *
+               * @param        string  code HTML \xE0 convertir
+               * @param        boolean afficher en pdf (false) ou en html 
(true)
+               * @return       null
+               */      
+               function WriteHTML($html, $vue = false)
+               {
+                       $html = str_replace('[[page_nb]]',      '{nb}',  $html);
+                       
+                       $html = str_replace('[[date_y]]',       date('Y'),      
 $html);
+                       $html = str_replace('[[date_m]]',       date('m'),      
 $html);
+                       $html = str_replace('[[date_d]]',       date('d'),      
 $html);
+
+                       $html = str_replace('[[date_h]]',       date('H'),      
 $html);
+                       $html = str_replace('[[date_i]]',       date('i'),      
 $html);
+                       $html = str_replace('[[date_s]]',       date('s'),      
 $html);
+
+                       // si on veut voir le r\xE9sultat en HTML => on appelle 
la fonction
+                       if ($vue)       $this->vueHTML($html);  
+
+                       // sinon, traitement pour conversion en PDF :
+                       // parsing
+                       $this->sub_pdf = false;
+                       $this->style->readStyle($html);
+                       $this->parsing->setHTML($html);
+                       $this->parsing->parse();
+                       $this->MakeHTMLcode();
+               }
+
+               function MakeHTMLcode()
+               {
+                       // pour chaque element identifi\xE9 par le parsing
+                       for($this->parse_pos=0; 
$this->parse_pos<count($this->parsing->code); $this->parse_pos++)
+                       {
+                               // r\xE9cup\xE9ration de l'\xE9l\xE9ment
+                               $todo = $this->parsing->code[$this->parse_pos];
+                               
+                               // si c'est une ouverture de tableau
+                               if (in_array($todo['name'], array('table', 
'ul', 'ol')) && !$todo['close'])
+                               {
+                                       // on va cr\xE9er un sous HTML, et on 
va travailler sur une position temporaire
+                                       $tag_open = $todo['name'];
+
+                                       $this->sub_part = true;
+                                       $this->temp_pos = $this->parse_pos;
+                                       
+                                       // pour tous les \xE9l\xE9ments 
jusqu'\xE0 la fermeture de la table afin de pr\xE9parer les dimensions
+                                       
while(isset($this->parsing->code[$this->temp_pos]) && 
!($this->parsing->code[$this->temp_pos]['name']==$tag_open && 
$this->parsing->code[$this->temp_pos]['close']))
+                                       {
+                                               
$this->loadAction($this->parsing->code[$this->temp_pos]);
+                                               $this->temp_pos++;
+                                       }
+                                       if 
(isset($this->parsing->code[$this->temp_pos]))       
$this->loadAction($this->parsing->code[$this->temp_pos]);
+                                       $this->sub_part = false;
+                               }
+                               
+                               // chargement de l'action correspondant \xE0 
l'\xE9l\xE9ment
+                               $this->loadAction($todo);
+                       }                       
+               } 
+
+
+       
+               /**
+               * affichage en mode HTML du contenu
+               *
+               * @param        string  contenu
+               * @return       null
+               */      
+               function vueHTML($content)
+               {
+                       $content = preg_replace('/<page_header([^>]*)>/isU',    
'<hr>'address@hidden::textGET('vue01').' : $1<hr><div$1>', $content);
+                       $content = preg_replace('/<page_footer([^>]*)>/isU',    
'<hr>'address@hidden::textGET('vue02').' : $1<hr><div$1>', $content);
+                       $content = preg_replace('/<page([^>]*)>/isU',           
        '<hr>'address@hidden::textGET('vue03').' : $1<hr><div$1>', $content);
+                       $content = preg_replace('/<\/page([^>]*)>/isU',         
        '</div><hr>', $content);
+                       $content = preg_replace('/<bookmark([^>]*)>/isU',       
        '<hr>bookmark : $1<hr>', $content);
+                       $content = preg_replace('/<\/bookmark([^>]*)>/isU',     
        '', $content);
+                       $content = preg_replace('/<barcode([^>]*)>/isU',        
        '<hr>barcode : $1<hr>', $content);
+                       $content = preg_replace('/<\/barcode([^>]*)>/isU',      
        '', $content);
+                       $content = preg_replace('/<qrcode([^>]*)>/isU',         
'<hr>qrcode : $1<hr>', $content);
+                       $content = preg_replace('/<\/qrcode([^>]*)>/isU',       
        '', $content);
+                       
+                       echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+       <head>
+               <title>'address@hidden::textGET('vue04').' HTML</title>
+               <meta http-equiv="Content-Type" content="text/html; 
charset=iso-8859-1" >
+       </head>
+       <body style="padding: 10px; font-size: 10pt;font-family:        Arial;">
+'.$content.'
+       </body>
+</html>';
+                       exit;   
+               }
+
+               /**
+               * chargement de l'action correspondante \xE0 un element de 
parsing
+               *
+               * @param        array   \xE9l\xE9ment de parsing
+               * @return       null
+               */              
+               function loadAction($row)
+               {
+                       // nom de l'action
+                       $fnc    = ($row['close'] ? 'c_' : 
'o_').strtoupper($row['name']);
+                       
+                       // parametres de l'action
+                       $param  = $row['param'];
+                       
+                       // si aucune page n'est cr\xE9\xE9, on la cr\xE9\xE9
+                       if ($fnc!='o_PAGE' && $this->FirstPage)
+                       {
+                               $this->setNewPage();
+                       }
+                       
+                       // lancement de l'action
+                       if (is_callable(array(&$this, $fnc)))
+                       {
+                               $res = $this->{$fnc}($param);
+                               $this->previousCall = $fnc;
+                               return $res;
+                       }
+                       else
+                       {
+                               @HTML2PDF::makeError(1, __FILE__, __LINE__, 
strtoupper($row['name']), $this->parsing->getHtmlErrorCode($row['html_pos']));
+                               return false;
+                       }
+               }
+               
+               /**
+               * balise        : PAGE
+               * mode          : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_PAGE($param)
+               {
+                       if ($this->forOneLine) return false;
+                       if ($this->DEBUG_actif) $this->DEBUG_add('PAGE 
n\xB0'.($this->page+1), true);
+
+                       $newPageSet= (!isset($param['pageset']) || 
$param['pageset']!='old');
+                       
+                       $this->maxH = 0;
+                       if ($newPageSet)
+                       {
+                               $this->subHEADER = array();
+                               $this->subFOOTER = array();
+                                               
+                               // identification de l'orientation demand\xE9e
+                               $orientation = '';
+                               if (isset($param['orientation']))
+                               {
+                                       $param['orientation'] = 
strtolower($param['orientation']);
+                                       if ($param['orientation']=='p')         
        $orientation = 'P';
+                                       if ($param['orientation']=='portrait')  
$orientation = 'P';
+       
+                                       if ($param['orientation']=='l')         
        $orientation = 'L';
+                                       if ($param['orientation']=='paysage')   
$orientation = 'L';
+                                       if ($param['orientation']=='landscape') 
$orientation = 'L';
+                               }
+       
+                               // identification des propri\xE9t\xE9s du 
background
+                               $background = array();
+                               if (isset($param['backimg']))
+                               {
+                                       $background['img']              = 
isset($param['backimg'])      ? $param['backimg']             : '';           
// nom de l'image
+                                       $background['posX']             = 
isset($param['backimgx'])     ? $param['backimgx']    : 'center'; // position 
horizontale de l'image
+                                       $background['posY']             = 
isset($param['backimgy'])     ? $param['backimgy']    : 'middle'; // position 
verticale de l'image
+                                       $background['width']    = 
isset($param['backimgw'])     ? $param['backimgw']    : '100%';       // taille 
de l'image (100% = largueur de la feuille)
+                                       
+                                       // conversion du nom de l'image, en cas 
de param\xE8tres en _GET
+                                       $background['img'] = 
str_replace('&amp;', '&', $background['img']);
+                                       // conversion des positions
+                                       if ($background['posX']=='left')        
$background['posX'] = '0%';
+                                       if ($background['posX']=='center')      
$background['posX'] = '50%';
+                                       if ($background['posX']=='right')       
$background['posX'] = '100%';
+                                       if ($background['posY']=='top')         
$background['posY'] = '0%';
+                                       if ($background['posY']=='middle')      
$background['posY'] = '50%';
+                                       if ($background['posY']=='bottom')      
$background['posY'] = '100%';
+       
+       
+                                       // si il y a une image de pr\xE9cis\xE9
+                                       if ($background['img']) 
+                                       {
+                                               // est-ce que c'est une image ?
+                                               
address@hidden($background['img']);
+                                               if (count($infos)>1)
+                                               {
+                                                       // taille de l'image, 
en fonction de la taille sp\xE9cifi\xE9e. 
+                                                       $Wi = 
$this->style->ConvertToMM($background['width'], $this->pdf->w);
+                                                       $Hi = 
$Wi*$infos[1]/$infos[0];
+                                                       
+                                                       // r\xE9cup\xE9ration 
des dimensions et positions de l'image
+                                                       $background['width']    
= $Wi;  
+                                                       $background['posX']     
        = $this->style->ConvertToMM($background['posX'], $this->pdf->w - $Wi);
+                                                       $background['posY']     
        = $this->style->ConvertToMM($background['posY'], $this->pdf->h - $Hi);
+                                               }
+                                               else
+                                                       $background = array();  
+                                       }
+                                       else
+                                               $background = array();
+                               }
+                               
+                               // marges TOP et BOTTOM pour le texte.
+                               $background['top']              = 
isset($param['backtop'])                      ? $param['backtop']             : 
'0';
+                               $background['bottom']   = 
isset($param['backbottom'])           ? $param['backbottom']          : '0';
+                               $background['left']             = 
isset($param['backleft'])                     ? $param['backleft']            : 
'0';
+                               $background['right']    = 
isset($param['backright'])            ? $param['backright']           : '0';
+
+                               if (preg_match('/^([0-9]*)$/isU', 
$background['top']))          $background['top']              .= 'mm';
+                               if (preg_match('/^([0-9]*)$/isU', 
$background['bottom']))       $background['bottom']   .= 'mm';
+                               if (preg_match('/^([0-9]*)$/isU', 
$background['left']))         $background['left']             .= 'mm';
+                               if (preg_match('/^([0-9]*)$/isU', 
$background['right']))        $background['right']    .= 'mm';
+
+                               $background['top']              = 
$this->style->ConvertToMM($background['top'],         $this->pdf->h);
+                               $background['bottom']   = 
$this->style->ConvertToMM($background['bottom'],      $this->pdf->h);
+                               $background['left']             = 
$this->style->ConvertToMM($background['left'],        $this->pdf->w);
+                               $background['right']    = 
$this->style->ConvertToMM($background['right'],       $this->pdf->w);
+
+                               $res = false;
+                               $background['color']    = 
isset($param['backcolor'])    ? $this->style->ConvertToRVB($param['backcolor'], 
$res) : null;
+                               if (!$res) $background['color'] = null;
+
+                               $this->style->save();
+                               $this->style->analyse('PAGE', $param);
+                               $this->style->setPosition($this->pdf->x, 
$this->pdf->y);
+                               $this->style->FontSet();
+                               
+                               // nouvelle page
+                               $this->setNewPage($orientation, $background);
+       
+                               // footer automatique
+                               if (isset($param['footer']))
+                               {
+                                       $lst = explode(';', $param['footer']);
+                                       foreach($lst as $key => $val) 
$lst[$key] = trim(strtolower($val));
+                                       $page   = in_array('page', $lst);
+                                       $date   = in_array('date', $lst);
+                                       $heure  = in_array('heure', $lst);
+                                       $form   = in_array('form', $lst);
+                               }
+                               else
+                               {
+                                       $page   = null;
+                                       $date   = null;
+                                       $heure  = null;
+                                       $form   = null;
+                               }
+                               $this->pdf->SetMyFooter($page, $date, $heure, 
$form);
+                       }
+                       else
+                       {
+                               $this->style->save();
+                               $this->style->analyse('PAGE', $param);
+                               $this->style->setPosition($this->pdf->x, 
$this->pdf->y);
+                               $this->style->FontSet();
+                               
+                               $this->setNewPage();
+                       }                       
+                       
+                       return true;
+               }
+
+               /**
+               * balise : PAGE
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_PAGE($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       if ($this->DEBUG_actif) $this->DEBUG_add('PAGE 
n\xB0'.$this->page, false);
+                       
+                       return true;
+               }
+               
+               
+               function o_PAGE_HEADER($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->subHEADER = array();
+                       for($this->parse_pos; 
$this->parse_pos<count($this->parsing->code); $this->parse_pos++)
+                       {
+                               $todo = $this->parsing->code[$this->parse_pos];
+                               if ($todo['name']=='page_header') 
$todo['name']='page_header_sub';
+                               $this->subHEADER[] = $todo;
+                               if 
(strtolower($todo['name'])=='page_header_sub' && $todo['close']) break;
+                       }
+
+                       $this->SetPageHeader();
+                       
+                       return true;
+               }
+               
+               function o_PAGE_FOOTER($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->subFOOTER = array();
+                       for($this->parse_pos; 
$this->parse_pos<count($this->parsing->code); $this->parse_pos++)
+                       {
+                               $todo = $this->parsing->code[$this->parse_pos];
+                               if ($todo['name']=='page_footer') 
$todo['name']='page_footer_sub';
+                               $this->subFOOTER[] = $todo;
+                               if 
(strtolower($todo['name'])=='page_footer_sub' && $todo['close']) break;
+                       }
+                       
+                       $this->SetPageFooter();
+                       
+                       return true;
+               }
+
+               function o_PAGE_HEADER_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->subSTATES = array();
+                       $this->subSTATES['x']   = $this->pdf->x;
+                       $this->subSTATES['y']   = $this->pdf->y;
+                       $this->subSTATES['s']   = $this->style->value;
+                       $this->subSTATES['t']   = $this->style->table;
+                       $this->subSTATES['ml']  = $this->pdf->lMargin;
+                       $this->subSTATES['mr']  = $this->pdf->rMargin;
+                       $this->subSTATES['mt']  = $this->pdf->tMargin;
+                       $this->subSTATES['mb']  = $this->pdf->bMargin;
+       
+                       $this->pdf->x                                           
= $this->defaultLeft;
+                       $this->pdf->y                                           
= $this->defaultTop;
+                       $this->style->initStyle();
+                       $this->style->resetStyle();
+                       $this->style->value['width']            = $this->pdf->w 
- $this->defaultLeft - $this->defaultRight;
+                       $this->style->table                                     
= array();
+                       $this->pdf->lMargin                                     
= $this->defaultLeft;
+                       $this->pdf->rMargin                                     
= $this->defaultRight;
+                       $this->pdf->tMargin                                     
= $this->defaultTop;
+                       $this->pdf->bMargin                                     
= $this->defaultBottom;
+                       $this->pdf->PageBreakTrigger            = $this->pdf->h 
- $this->pdf->bMargin;
+
+                       $this->style->save();
+                       $this->style->analyse('page_header_sub', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       $this->setNewPositionForNewLine();                      
        
+                       return true;
+               }
+
+               function c_PAGE_HEADER_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->load();
+
+                       $this->pdf->x                                           
= $this->subSTATES['x'];
+                       $this->pdf->y                                           
= $this->subSTATES['y'];
+                       $this->style->value                                     
= $this->subSTATES['s'];
+                       $this->style->table                                     
= $this->subSTATES['t'];
+                       $this->pdf->lMargin                                     
= $this->subSTATES['ml'];
+                       $this->pdf->rMargin                                     
= $this->subSTATES['mr'];
+                       $this->pdf->tMargin                                     
= $this->subSTATES['mt'];
+                       $this->pdf->bMargin                                     
= $this->subSTATES['mb'];
+                       $this->pdf->PageBreakTrigger            = $this->pdf->h 
- $this->pdf->bMargin;
+
+                       $this->style->FontSet();                        
+                       $this->maxH = 0;                
+                       
+                       return true;
+               }
+                               
+               function o_PAGE_FOOTER_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->subSTATES = array();
+                       $this->subSTATES['x']   = $this->pdf->x;
+                       $this->subSTATES['y']   = $this->pdf->y;
+                       $this->subSTATES['s']   = $this->style->value;
+                       $this->subSTATES['t']   = $this->style->table;
+                       $this->subSTATES['ml']  = $this->pdf->lMargin;
+                       $this->subSTATES['mr']  = $this->pdf->rMargin;
+                       $this->subSTATES['mt']  = $this->pdf->tMargin;
+                       $this->subSTATES['mb']  = $this->pdf->bMargin;
+       
+                       $this->pdf->x                                           
= $this->defaultLeft;
+                       $this->pdf->y                                           
= $this->defaultTop;
+                       $this->style->initStyle();
+                       $this->style->resetStyle();
+                       $this->style->value['width']            = $this->pdf->w 
- $this->defaultLeft - $this->defaultRight;
+                       $this->style->table                                     
= array();                      
+                       $this->pdf->lMargin                                     
= $this->defaultLeft;
+                       $this->pdf->rMargin                                     
= $this->defaultRight;
+                       $this->pdf->tMargin                                     
= $this->defaultTop;
+                       $this->pdf->bMargin                                     
= $this->defaultBottom;
+                       $this->pdf->PageBreakTrigger            = $this->pdf->h 
- $this->pdf->bMargin;
+
+                       // on en cr\xE9\xE9 un sous HTML que l'on transforme en 
PDF
+                       // pour r\xE9cup\xE9rer la hauteur
+                       // on extrait tout ce qui est contenu dans le FOOTER
+                       $sub = null;
+                       $res = $this->parsing->getLevel($this->parse_pos);
+                       $this->CreateSubHTML($sub);
+                       $sub->writeHTML($res[1]);
+                       $this->pdf->y = $this->pdf->h - $sub->maxY - 
$this->defaultBottom - 0.01;
+                       unset($sub);
+                       
+                       $this->style->save();                   
+                       $this->style->analyse('page_footer_sub', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       $this->setNewPositionForNewLine();              
+                       
+                       return true;
+               }
+
+               function c_PAGE_FOOTER_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->load();
+
+                       $this->pdf->x                                           
= $this->subSTATES['x'];
+                       $this->pdf->y                                           
= $this->subSTATES['y'];
+                       $this->style->value                                     
= $this->subSTATES['s'];
+                       $this->style->table                                     
= $this->subSTATES['t'];
+                       $this->pdf->lMargin                                     
= $this->subSTATES['ml'];
+                       $this->pdf->rMargin                                     
= $this->subSTATES['mr'];
+                       $this->pdf->tMargin                                     
= $this->subSTATES['mt'];
+                       $this->pdf->bMargin                                     
= $this->subSTATES['mb'];
+                       $this->pdf->PageBreakTrigger            = $this->pdf->h 
- $this->pdf->bMargin;
+
+                       $this->style->FontSet();        
+                       $this->maxH = 0;                
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : NOBREAK
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */
+               function o_NOBREAK($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       // on extrait tout ce qui est contenu dans le NOBREAK
+                       $res = $this->parsing->getLevel($this->parse_pos);
+
+                       // on en cr\xE9\xE9 un sous HTML que l'on transforme en 
PDF
+                       // pour analyse les dimensions
+                       // et voir si ca rentre
+                       $sub = null;
+                       $this->CreateSubHTML($sub);
+                       $sub->writeHTML($res[1]);
+                       
+                       $y = $this->pdf->getY();
+                       if (
+                                       $sub->maxY < ($this->pdf->h - 
$this->pdf->tMargin-$this->pdf->bMargin) &&
+                                       $y + $sub->maxY>=($this->pdf->h - 
$this->pdf->bMargin)
+                               )
+                               $this->setNewPage();
+                       unset($sub);
+                       
+                       return true;
+               }
+               
+
+               /**
+               * balise : NOBREAK
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_NOBREAK($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                                       
+                       return true;
+               }
+               
+               /**
+               * balise : DIV
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_DIV($param, $other = 'div')
+               {
+                       if ($this->forOneLine) return false;
+                       if ($this->DEBUG_actif) $this->DEBUG_add('DIV', true);
+                       
+                       $this->style->save();
+                       $this->style->analyse($other, $param);
+                       $this->style->FontSet();
+                       
+                       $align_object = null;
+                       if ($this->style->value['margin-auto']) $align_object = 
'center';
+
+                       $marge = array();
+                       $marge['l'] = 
$this->style->value['border']['l']['width'] + 
$this->style->value['padding']['l']+0.03;
+                       $marge['r'] = 
$this->style->value['border']['r']['width'] + 
$this->style->value['padding']['r']+0.03;
+                       $marge['t'] = 
$this->style->value['border']['t']['width'] + 
$this->style->value['padding']['t']+0.03;
+                       $marge['b'] = 
$this->style->value['border']['b']['width'] + 
$this->style->value['padding']['b']+0.03;
+                       
+                       // on extrait tout ce qui est contenu dans la DIV
+                       $res = $this->parsing->getLevel($this->parse_pos);
+
+                       // on en cr\xE9\xE9 un sous HTML que l'on transforme en 
PDF
+                       // pour analyse les dimensions
+                       $w = 0; $h = 0;
+                       if (trim($res[1]))
+                       {
+                               $sub = null;
+                               $this->CreateSubHTML($sub);
+                               $sub->writeHTML($res[1]);                       
        
+                               $w = $sub->maxX;
+                               $h = $sub->maxY;
+                               unset($sub);
+                       }
+                       if (($w==0 && $this->style->value['width']==0) || 
$this->style->value['position']=='absolute')
+                       {
+                               $w+= $marge['l']+$marge['r']+0.001;             
        
+                       }
+                       $h+= $marge['t']+$marge['b']+0.001;
+                       
+               
+                       $this->style->value['width']    = max($w, 
$this->style->value['width']);
+                       $this->style->value['height']   = max($h, 
$this->style->value['height']);
+                       
+                       switch($this->style->value['rotate'])
+                       {
+                               case 90:
+                                       $w = $this->style->value['height'];
+                                       $h = $this->style->value['width'];
+                                       $t_x =-$h;
+                                       $t_y = 0;
+                                       break;
+                                       
+                               case 180:
+                                       $w = $this->style->value['width'];
+                                       $h = $this->style->value['height'];
+                                       $t_x = -$w;
+                                       $t_y = -$h;
+                                       break;
+                                       
+                               case 270:
+                                       $w = $this->style->value['height'];
+                                       $h = $this->style->value['width'];
+                                       $t_x = 0;
+                                       $t_y =-$w;
+                                       break;
+                                       
+                               default:
+                                       $w = $this->style->value['width'];
+                                       $h = $this->style->value['height'];
+                                       $t_x = 0;
+                                       $t_y = 0;
+                                       break;
+                       }
+
+                       
+                       if (!$this->style->value['position'])
+                       {
+                               if (
+                                       $w < ($this->pdf->w - 
$this->pdf->lMargin-$this->pdf->rMargin) &&
+                                       $this->pdf->x + $w>=($this->pdf->w - 
$this->pdf->rMargin)
+                                       )
+                                       $this->o_BR(array());
+       
+                               if (
+                                               $h < ($this->pdf->h - 
$this->pdf->tMargin-$this->pdf->bMargin) &&
+                                               $this->pdf->y + 
$h>=($this->pdf->h - $this->pdf->bMargin)
+                                       )
+                                       $this->setNewPage();
+                               
+                               // en cas d'alignement => correction
+                               $old = 
isset($this->style->table[count($this->style->table)-1]) ? 
$this->style->table[count($this->style->table)-1] : $this->style->value;
+                               $parent_w = $old['width'] ? $old['width'] : 
$this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin;
+                               
+                               if ($parent_w>$w)
+                               {                               
+                                       if ($align_object=='center')            
$this->pdf->x = $this->pdf->x + ($parent_w-$w)*0.5;
+                                       else if ($align_object=='right')        
$this->pdf->x = $this->pdf->x + $parent_w-$w;
+                               }
+                               
+                               $this->style->setPosition($this->pdf->x, 
$this->pdf->y);
+                       }
+                       else
+                       {
+                               $this->style->setPosition($this->pdf->x, 
$this->pdf->y);
+                               $this->saveMax();
+                               $this->saveX = 0;
+                               $this->saveY = 0;
+                               $this->saveH = 0;
+                       }               
+                       
+                       if ($this->style->value['rotate'])
+                       {
+                               $this->pdf->startTransform();
+                               
$this->pdf->setRotation($this->style->value['rotate']);
+                               $this->pdf->setTranslate($t_x, $t_y);
+                       }
+                       
+                       // initialisation du style des bordures de la div
+                       $this->Rectangle(
+                                       $this->style->value['x'],
+                                       $this->style->value['y'],
+                                       $this->style->value['width'],
+                                       $this->style->value['height'],
+                                       $this->style->value['border'],
+                                       $this->style->value['padding'],
+                                       0,
+                                       $this->style->value['background']
+                               );
+
+                       
+                       $marge = array();
+                       $marge['l'] = 
$this->style->value['border']['l']['width'] + 
$this->style->value['padding']['l']+0.03;
+                       $marge['r'] = 
$this->style->value['border']['r']['width'] + 
$this->style->value['padding']['r']+0.03;
+                       $marge['t'] = 
$this->style->value['border']['t']['width'] + 
$this->style->value['padding']['t']+0.03;
+                       $marge['b'] = 
$this->style->value['border']['b']['width'] + 
$this->style->value['padding']['b']+0.03;
+
+                       $this->style->value['width']    = 
$this->style->value['width']-$marge['l']-$marge['r'];
+                       $this->style->value['height']   = 
$this->style->value['height']-$marge['r']-$marge['b'];
+
+                       // limitation des marges aux dimensions de la div
+                       $mL = $this->style->value['x']+$marge['l'];
+                       $mR = $this->pdf->w - $mL - 
$this->style->value['width'];
+                       $this->saveMargin($mL, 0, $mR);
+                       
+                       // positionnement en fonction
+                       $h_corr = $this->style->value['height'];
+                       $h_reel = $h-$marge['b']-$marge['t'];
+                       switch($this->style->value['vertical-align'])
+                       {
+                               case 'bottom':
+                                       $y_corr = $h_corr-$h_reel;
+                                       break;
+                                       
+                               case 'middle':
+                                       $y_corr = ($h_corr-$h_reel)*0.5;
+                                       break;
+                                       
+                               case 'top':
+                               default:
+                                       $y_corr = 0;
+                                       break;  
+                       }
+                       
+                       $this->pdf->setX($this->style->value['x']+$marge['l']);
+                       
$this->pdf->setY($this->style->value['y']+$marge['t']+$y_corr);
+                       
+                       $this->setNewPositionForNewLine();
+                       
+                       return true;
+               }
+               function o_BLOCKQUOTE($param) { return $this->o_DIV($param, 
'blockquote'); }
+               
+               /**
+               * balise : DIV
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_DIV($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       if ($this->style->value['rotate']) 
$this->pdf->stopTransform();
+                       $marge = array();
+                       $marge['l'] = 
$this->style->value['border']['l']['width'] + 
$this->style->value['padding']['l']+0.03;
+                       $marge['r'] = 
$this->style->value['border']['r']['width'] + 
$this->style->value['padding']['r']+0.03;
+                       $marge['t'] = 
$this->style->value['border']['t']['width'] + 
$this->style->value['padding']['t']+0.03;
+                       $marge['b'] = 
$this->style->value['border']['b']['width'] + 
$this->style->value['padding']['b']+0.03;
+                       
+                       $x = $this->style->value['x'];
+                       $y = $this->style->value['y'];
+                       $w = 
$this->style->value['width']+$marge['l']+$marge['r']+$this->style->value['margin']['r'];
+                       $h = 
$this->style->value['height']+$marge['t']+$marge['b']+$this->style->value['margin']['b'];
+                       switch($this->style->value['rotate'])
+                       {
+                               case 90:
+                                       $t = $w; $w = $h; $h = $t;
+                                       break;
+                                       
+                               case 270:
+                                       $t = $w; $w = $h; $h = $t;
+                                       break;
+                                       
+                               default:
+                                       break;
+                       }
+
+
+                       if ($this->style->value['position']!='absolute')
+                       {
+                               // position
+                               $this->pdf->x = $x+$w;  
+                               $this->pdf->y = $y;
+                                       
+                               // position MAX
+                               $this->maxX = max($this->maxX, $x+$w);
+                               $this->maxY = max($this->maxY, $y+$h);
+                               $this->maxH = max($this->maxH, $h);
+                       }
+                       else
+                       {
+                               // position
+                               $this->pdf->x = $this->style->value['xc'];      
+                               $this->pdf->y = $this->style->value['yc'];
+                                       
+                               $this->loadMax();
+                       }
+               
+                       $block = ($this->style->value['display']!='inline' && 
$this->style->value['position']!='absolute');
+                       
+                       $this->style->load();
+                       $this->style->FontSet();
+                       $this->loadMargin();
+                       
+                       if ($block) $this->o_BR(array());
+                       if ($this->DEBUG_actif) $this->DEBUG_add('DIV', false);
+                       
+                       return true;
+               }
+               function c_BLOCKQUOTE($param) { return $this->c_DIV($param); }
+               
+               /**
+               * balise : BARCODE
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_BARCODE($param)
+               {
+                       
+                       $lst_barcode = array(
+                                                               'EAN13'         
=> '0.35mm',
+                                                               'UPC_A'         
=> '0.35mm',
+                                                               'CODE39'        
=> '1.00mm',
+                                                       );
+                       if (isset($param['type'])) $param['type'] = 
strtoupper($param['type']);
+                       
+                       if (!isset($param['type']) || 
!isset($lst_barcode[$param['type']])) $param['type']=='CODE39';
+                       if (!isset($param['value']))    $param['value'] = 0;
+                       if (!isset($param['bar_w']))    $param['bar_w'] = 
$lst_barcode[$param['type']];
+                       if (!isset($param['bar_h']))    $param['bar_h'] = 
'10mm';
+                       
+                       if (!isset($param['style']['color'])) 
$param['style']['color'] = '#000000';
+                       $param['style']['background-color'] = 
$param['style']['color'];
+                       
+                       $this->style->save();
+                       $this->style->analyse('barcode', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       
+                       $x = $this->pdf->getX();
+                       $y = $this->pdf->getY();
+                       $w = $this->style->ConvertToMM($param['bar_w']);
+                       $h = $this->style->ConvertToMM($param['bar_h']);
+
+                       $infos = $this->pdf->{'BARCODE_'.$param['type']}($x, 
$y, $param['value'], $h, $w);
+
+                       // position maximale globale
+                       $this->maxX = max($this->maxX, $x+$infos[0]);
+                       $this->maxY = max($this->maxY, $y+$infos[1]);
+                       $this->maxH = max($this->maxH, $infos[1]);
+                       
+                       $this->pdf->setX($x+$infos[0]);
+                       
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : BARCODE
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_BARCODE($param)
+               {
+                       // completement inutile
+                       
+                       return true;
+               }
+               
+                       
+               /**
+               * balise : QRCODE
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_QRCODE($param)
+               {
+                       if ($this->DEBUG_actif) $this->DEBUG_add('QRCODE', 
true);
+                       if (!isset($param['value']))                            
                $param['value'] = '';
+                       if (!isset($param['ec']))                               
                        $param['ec']    = 'H';
+                       if (!isset($param['size']))                             
                        $param['size']  = '0.6mm';
+                       if (!isset($param['style']['color']))                   
        $param['style']['color'] = '#000000';
+                       if (!isset($param['style']['background-color']))        
$param['style']['background-color'] = '#FFFFFF';
+                       
+                       if ($param['value']==='') return true;
+                       
+                       $this->style->save();
+                       $this->style->analyse('qrcode', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       $x = $this->pdf->getX();
+                       $y = $this->pdf->getY();
+                       $s = $this->style->ConvertToMM($param['size']);
+                       $ec = $param['ec']; if (!in_array($ec, array('L', 'M', 
'Q', 'H'))) $ec = 'H';
+                       $color = $this->style->value['color'];
+                       $background = 
$this->style->value['background']['color'];
+                       
+                       
require_once(dirname(__FILE__).'/qrcode/qrcode.class.php');
+                       $qrcode = new QRcode($param['value'], $ec);
+                       $size = $s*$qrcode->getQrSize();
+                       if (!$this->sub_part && !$this->isSubPart)
+                               $qrcode->displayFPDF($this->pdf, $x, $y, $s, 
$background, $color);
+                       unset($qrcode);
+                       
+                       // position maximale globale
+                       $this->maxX = max($this->maxX, $x+$size);
+                       $this->maxY = max($this->maxY, $y+$size);
+                       $this->maxH = max($this->maxH, $size);
+                       
+                       $this->pdf->setX($x+$size);
+                       
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }               
+               /**
+               * balise : QRCODE
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_QRCODE($param)
+               {
+                       if ($this->DEBUG_actif) $this->DEBUG_add('QRCODE', 
false);
+                       // completement inutile
+                       return true;
+               }
+                               
+               /**
+               * balise : BOOKMARK
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_BOOKMARK($param)
+               {
+                       $titre = isset($param['title']) ? trim($param['title']) 
: '';
+                       $level = isset($param['level']) ? 
floor($param['level']) : 0;
+                       
+                       if ($level<0) $level = 0;
+                       if ($titre) $this->pdf->Bookmark($titre, $level, -1);
+                       
+                       return true;
+               }
+                       
+               /**
+               * balise : BOOKMARK
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_BOOKMARK($param)
+               {
+                       // completement inutile
+                       
+                       return true;
+               }
+                                       
+               /**
+               * balise : WRITE
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_WRITE($param)
+               {
+                       $fill = 
($this->style->value['background']['color']!==null && 
$this->style->value['background']['image']===null);
+                       if (in_array($this->style->getParentBalise(), 
array('div', 'table', 'tr', 'td'))) $fill = false;
+                       
+                       // r\xE9cup\xE9ration du texte \xE0 \xE9crire, et 
conversion
+                       $txt = $param['txt'];
+                       $txt = str_replace('&euro;', '\x80', $txt);
+
+                       if ($this->isAfterFloat)
+                       {
+                               $txt = preg_replace('/^([\s]*)([^\s])/isU', 
'$2', $txt);
+                               $this->isAfterFloat = false;
+                       }
+
+                       $txt = html_entity_decode($txt, ENT_QUOTES, 
$this->encoding);
+
+                       $txt = str_replace('[[page_cu]]',       $this->page,    
$txt);
+                       
+                       if ($this->style->value['text-transform']!='none')
+                       {
+                               if 
($this->style->value['text-transform']=='capitalize')
+                                       $txt = ucwords($txt);
+                               else if 
($this->style->value['text-transform']=='uppercase')
+                                       $txt = strtoupper($txt);
+                               else if 
($this->style->value['text-transform']=='lowercase')
+                                       $txt = strtolower($txt);
+                       }
+                       
+                       // tailles du texte
+                       $h      = 1.08*$this->style->value['font-size'];
+                       $dh     = $h*$this->style->value['mini-decal'];
+                               
+                       $w = $this->pdf->GetStringWidth($txt);
+                       // identification de l'alignement
+                       $align = 'L';           
+
+                       if ($this->style->value['text-align']=='li_right')
+                       {
+                               $w = $this->style->value['width'];              
                        
+                               $align = 'R';
+                       }
+
+                       $curr_max = strlen($txt);                               
                // taille maxi du texte
+                       $maxX = 0;                                              
                                // plus grande largeur du texte apres retour 
\xE0 la ligne
+                       $x = $this->pdf->getX();                                
                // position du texte
+                       $y = $this->pdf->getY();
+                       $w = $this->pdf->GetStringWidth($txt);                  
// largeur du texte
+                       list($left, $right) = $this->getMargins($y);    // 
marges autorisees
+                       $nb = 0;                                                
                                // nbr de lignes d\xE9coup\xE9es
+       
+                       // tant que ca ne rentre pas sur la ligne et qu'on a du 
texte => on d\xE9coupe
+                       while($x+$w>$right && $x<$right && strlen($txt))
+                       {
+                               // liste des mots
+                               $lst = explode(' ', $txt);
+                               
+                               // trouver une phrase qui rentre dans la 
largeur, en ajoutant les mots 1 \xE0 1
+                               $i=0;
+                               $old = '';
+                               $str = $lst[0];
+                               
while(($x+$this->pdf->GetStringWidth($str))<$right)
+                               {
+                                       unset($lst[$i]);
+                                       $old = $str;
+
+                                       $i++;
+                                       $str.= ' '.$lst[$i];
+                               }
+                               $str = $old;
+                               
+                               // si rien de rentre, et que le premier mot ne 
rentre de toute facon pas dans une ligne, on le force...
+                               if ($i==0 && 
(($left+$this->pdf->GetStringWidth($lst[0]))>=$right))
+                               {
+                                       $str = $lst[0];
+                                       unset($lst[0]);
+                               }
+                               
+                               // r\xE9cup\xE9ration des mots restant, et 
calcul de la largeur
+                               $txt = implode(' ', $lst);
+                               $w = $this->pdf->GetStringWidth($str);
+
+                               // ecriture du bout de phrase extrait et qui 
rentre
+                               $wc = ($align=='L' ? $w : 
$this->style->value['width']);
+                               if ($right - $left<$wc) $wc = $right - $left;
+                               if (strlen($str)) $this->pdf->Cell($wc, $h+$dh, 
$str, 0, 0, $align, $fill, $this->inLink);
+                               $this->maxH = max($this->maxH, 
$this->style->getLineHeight());
+                               
+                               // d\xE9termination de la largeur max
+                               $maxX = max($maxX, $this->pdf->getX());
+
+                               // nouvelle position et nouvelle largeur pour 
la boucle
+                               $w = $this->pdf->GetStringWidth($txt);
+                               $y = $this->pdf->getY();
+                               $x = $this->pdf->getX();
+
+                               // si il reste du text \xE0 afficher
+                               if (strlen($txt))
+                               {
+                                       if ($this->forOneLine)
+                                       {
+                                               $this->maxX = max($this->maxX, 
$maxX);
+                                               return false;
+                                       }
+                                       
+                                       // retour \xE0 la ligne
+                                       $this->o_BR(array('style' => ''), 
$curr_max - strlen($txt));
+
+                                       $y = $this->pdf->getY();
+                                       $x = $this->pdf->getX();
+                                       
+                                       // si la prochaine ligne ne rentre pas 
dans la page => nouvelle page 
+                                       if ($y + $h>$this->pdf->h - 
$this->pdf->bMargin) $this->setNewPage('', null, $curr_max - strlen($txt));
+                               
+                                       // ligne supl\xE9mentaire. au bout de 
1000 : trop long => erreur
+                                       $nb++;
+                                       if ($nb>1000) @HTML2PDF::makeError(2, 
__FILE__, __LINE__, array($txt, $right-$left, 
$this->pdf->GetStringWidth($txt))); 
+
+                                       list($left, $right) = 
$this->getMargins($y);    // marges autorisees
+                               }
+                       }
+
+                       // si il reste du text apres d\xE9coupe, c'est qu'il 
rentre direct => on l'affiche
+                       if (strlen($txt))
+                       {
+                               $this->pdf->Cell(($align=='L' ? $w : 
$this->style->value['width']), $h+$dh, $txt, 0, 0, $align, $fill, 
$this->inLink);
+                               $this->maxH = max($this->maxH, 
$this->style->getLineHeight());
+                       }
+                       
+                       // d\xE9termination des positions MAX
+                       $maxX = max($maxX, $this->pdf->getX());
+                       $maxY = $this->pdf->getY()+$h;
+
+                       // position maximale globale
+                       $this->maxX = max($this->maxX, $maxX);
+                       $this->maxY = max($this->maxY, $maxY);
+                       
+                       return true;
+               }
+
+               /**
+               * tracer une image
+               * 
+               * @param        string  nom du fichier source
+               * @return       null
+               */      
+               function Image($src, $sub_li=false)
+               {
+                       // est-ce que c'est une image ?
+                       address@hidden($src);
+
+                       if (count($infos)<2)
+                       {
+                               if ($this->testIsImage)
+                               {
+                                       @HTML2PDF::makeError(6, __FILE__, 
__LINE__, $src);
+                                       return false;
+                               }
+                               $src = null;
+                               $infos = array(16, 16);
+                       }
+                       
+                       // r\xE9cup\xE9ration des dimensions dans l'unit\xE9 du 
PDF
+                       $wi = $infos[0]/$this->pdf->k;
+                       $hi = $infos[1]/$this->pdf->k;
+                       
+                       // d\xE9termination des dimensions d'affichage en 
fonction du style
+                       if ($this->style->value['width'] && 
$this->style->value['height'])
+                       {
+                               $w = $this->style->value['width'];
+                               $h = $this->style->value['height'];
+                       }
+                       else if ($this->style->value['width'])
+                       {
+                               $w = $this->style->value['width'];
+                               $h = $hi*$w/$wi;
+                               
+                       }
+                       else if ($this->style->value['height'])
+                       {
+                               $h = $this->style->value['height'];
+                               $w = $wi*$h/$hi;
+                       }
+                       else
+                       {
+                               $w = 72./96.*$wi;
+                               $h = 72./96.*$hi;                               
        
+                       }
+                       
+                       // detection du float
+                       $float = $this->style->getFloat();
+                       if ($float && $this->maxH) $this->o_BR(array());
+
+                       // position d'affichage
+                       $x = $this->pdf->getX();
+                       $y = $this->pdf->getY();
+                       
+                       // si l'image ne rentre pas dans la ligne => nouvelle 
ligne 
+                       if (!$float && ($x + $w>$this->pdf->w - 
$this->pdf->rMargin))
+                       {
+                               $hnl = $this->style->getLineHeight();
+                               $hnl = max($this->maxH, $hnl);
+                               $this->setNewLine($hnl);
+                               $x = $this->pdf->getX();
+                               $y = $this->pdf->getY();
+                       }
+                                               
+                       // si l'image ne rentre pas dans la page => nouvelle 
page 
+                       if ($y + $h>$this->pdf->h - $this->pdf->bMargin)
+                       {
+                               $this->setNewPage();
+                               $x = $this->pdf->getX();
+                               $y = $this->pdf->getY();
+                       }
+
+                       // correction pour l'affichage d'une puce image
+                       $hT = 0.80*$this->style->value['font-size'];
+                       if ($sub_li && $h<$hT)
+                       {
+                               $y+=($hT-$h);
+                       }
+
+                       $yc = $y-$this->style->value['margin']['t'];
+
+                       // d\xE9termination de la position r\xE9elle 
d'affichage en fonction du text-align du parent
+                       $old = 
isset($this->style->table[count($this->style->table)-1]) ? 
$this->style->table[count($this->style->table)-1] : $this->style->value;
+
+                       if ( $old['width'])
+                       {
+                               $parent_w = $old['width'];
+                               $parent_x = $x;
+                       }
+                       else
+                       {
+                               $parent_w = $this->pdf->w - $this->pdf->lMargin 
- $this->pdf->rMargin;
+                               $parent_x = $this->pdf->lMargin;
+                       }
+                       
+                       if ($float)
+                       {
+                               list($lx, $rx) = $this->getMargins($yc);
+                               $parent_x = $lx;
+                               $parent_w = $rx-$lx;
+                       }
+
+                       if ($parent_w>$w && $float!='left')
+                       {
+                               if ($float=='right' || 
$this->style->value['text-align']=='li_right')   $x = $parent_x + $parent_w - 
$w-$this->style->value['margin']['r']-$this->style->value['margin']['l'];
+                       }
+                       
+                       // affichage de l'image, et positionnement \xE0 la suite
+                       if (!$this->sub_part && !$this->isSubPart)
+                       {
+                               if ($src) $this->pdf->Image($src, $x, $y, $w, 
$h, '', $this->inLink);
+                               else
+                               {
+                                       $this->pdf->SetFillColor(240, 220, 220);
+                                       $this->pdf->Rect($x, $y, $w, $h, 'F');
+                               }
+                       }
+
+                       $x-= $this->style->value['margin']['l'];
+                       $y-= $this->style->value['margin']['t'];
+                       $w+= $this->style->value['margin']['l'] + 
$this->style->value['margin']['r'];
+                       $h+= $this->style->value['margin']['t'] + 
$this->style->value['margin']['b'];
+
+                       if ($float=='left')
+                       {
+                               $this->maxX = max($this->maxX, $x+$w);
+                               $this->maxY = max($this->maxY, $y+$h);
+
+                               $this->addMargins($float, $x, $y, $x+$w, $y+$h);
+
+                               list($lx, $rx) = $this->getMargins($yc);
+                               $this->pdf->x = $lx;
+                               $this->pdf->y = $yc;                            
+                       }
+                       else if ($float=='right')
+                       {
+//                             $this->maxX = max($this->maxX, $x+$w);
+                               $this->maxY = max($this->maxY, $y+$h);
+
+                               $this->addMargins($float, $x, $y, $x+$w, $y+$h);
+
+                               list($lx, $rx) = $this->getMargins($yc);
+                               $this->pdf->x = $lx;
+                               $this->pdf->y = $yc;
+                       }
+                       else
+                       {
+                               $this->pdf->SetX($x+$w);
+                               $this->maxX = max($this->maxX, $x+$w);
+                               $this->maxY = max($this->maxY, $y+$h);
+                               $this->maxH = max($this->maxH, $h);
+                       }
+               }
+               
+               /**
+               * Tracer un rectanble
+               * 
+               * @param        float   position X
+               * @param        float   position Y
+               * @param        float   Largeur
+               * @param        float   Hauteur
+               * @param        array   Tableau de style de d\xE9finition des 
borders
+               * @param        float   padding - marge int\xE9rieur au 
rectangle => non utile mais on le passe en param\xE8tre
+               * @param        float   margin - marge exterieur au rectangle
+               * @param        array   Tableau de style de d\xE9finition du 
background
+               * @return       null
+               */      
+               function Rectangle($x, $y, $w, $h, $border, $padding, $margin, 
$background)
+               {
+                       if ($this->sub_part || $this->isSubPart) return false;
+                       if ($h===null) return false;
+                       
+                       $x+= $margin;
+                       $y+= $margin;
+                       $w-= $margin*2;
+                       $h-= $margin*2;
+                       
+                       // r\xE9cup\xE9ration des radius
+                       $radius_h = $border['radius'][0];
+                       $radius_v = $border['radius'][1];
+                       
+                       // verification des coins en radius
+                       $coin_TL = ($radius_h && $radius_v && 
$radius_v>$border['t']['width'] && $radius_h>$border['l']['width']) ? 
array($radius_h, $radius_v) : null;
+                       $coin_TR = ($radius_h && $radius_v && 
$radius_v>$border['t']['width'] && $radius_h>$border['r']['width']) ? 
array($radius_h, $radius_v) : null;
+                       $coin_BL = ($radius_h && $radius_v && 
$radius_v>$border['b']['width'] && $radius_h>$border['l']['width']) ? 
array($radius_h, $radius_v) : null;
+                       $coin_BR = ($radius_h && $radius_v && 
$radius_v>$border['b']['width'] && $radius_h>$border['r']['width']) ? 
array($radius_h, $radius_v) : null;
+                       
+
+
+                       // traitement de la couleur de fond
+                       $STYLE = '';
+                       if ($background['color'])
+                       {
+                               
$this->pdf->SetFillColor($background['color'][0], $background['color'][1], 
$background['color'][2]);
+                               $STYLE.= 'F';           
+                       }
+                       
+                       if ($STYLE)
+                       {
+                               $this->pdf->clippingPathOpen($x, $y, $w, $h, 
$coin_TL,$coin_TR, $coin_BL, $coin_BR);            
+                               $this->pdf->Rect($x, $y, $w, $h, $STYLE);
+                               $this->pdf->clippingPathClose();                
+                       }
+                       
+                       // traitement de l'image de fond
+                       if ($background['image'])
+                       {
+                               $i_name         = $background['image'];
+                               $i_position     = 
$background['position']!==null        ? $background['position']       : 
array(0, 0);
+                               $i_repeat       = $background['repeat']!==null  
        ? $background['repeat']         : array(true, true);
+                               
+                               // taile du fond (il faut retirer les borders
+                               $b_x = $x;
+                               $b_y = $y;
+                               $b_w = $w;
+                               $b_h = $h;
+                               
+                               if ($border['b']['width']) { $b_h-= 
$border['b']['width']; }
+                               if ($border['l']['width']) { $b_w-= 
$border['l']['width']; $b_x+= $border['l']['width']; }
+                               if ($border['t']['width']) { $b_h-= 
$border['t']['width']; $b_y+= $border['t']['width']; }
+                               if ($border['r']['width']) { $b_w-= 
$border['r']['width']; }
+
+                               // est-ce que c'est une image ?
+                               address@hidden($i_name);
+       
+                               if (count($i_infos)<2)
+                               {
+                                       if ($this->testIsImage)
+                                       {
+                                               @HTML2PDF::makeError(6, 
__FILE__, __LINE__, $i_name);
+                                               return false;
+                                       }
+                               }
+                               else
+                               {
+                                       // r\xE9cup\xE9ration des dimensions 
dans l'unit\xE9 du PDF
+                                       $i_width        = 
72./96.*$i_infos[0]/$this->pdf->k;
+                                       $i_height       = 
72./96.*$i_infos[1]/$this->pdf->k;
+                                       
+                                       if ($i_repeat[0]) $i_position[0] = $b_x;
+                                       else 
if(preg_match('/^([-]?[0-9\.]+)%/isU', $i_position[0], $match)) $i_position[0] 
= $b_x + $match[1]*($b_w-$i_width)/100;
+                                       else $i_position[0] = 
$b_x+$i_position[0];
+                               
+                                       if ($i_repeat[1]) $i_position[1] = $b_y;
+                                       else 
if(preg_match('/^([-]?[0-9\.]+)%/isU', $i_position[1], $match)) $i_position[1] 
= $b_y + $match[1]*($b_h-$i_height)/100;
+                                       else $i_position[1] = 
$b_y+$i_position[1];
+                                       
+                                       $i_x_min = $b_x;
+                                       $i_x_max = $b_x+$b_w;
+                                       $i_y_min = $b_y;
+                                       $i_y_max = $b_y+$b_h;
+                                       
+                                       if (!$i_repeat[0] && !$i_repeat[1])
+                                       {
+                                               $i_x_min =      $i_position[0]; 
$i_x_max =      $i_position[0]+$i_width;
+                                               $i_y_min =      $i_position[1]; 
$i_y_max =      $i_position[1]+$i_height;                                       
+                                       }
+                                       else if ($i_repeat[0] && !$i_repeat[1])
+                                       {
+                                               $i_y_min =      $i_position[1]; 
$i_y_max =      $i_position[1]+$i_height;                                       
+                                       }
+                                       elseif (!$i_repeat[0] && $i_repeat[1])
+                                       {
+                                               $i_x_min =      $i_position[0]; 
$i_x_max =      $i_position[0]+$i_width;
+                                       }
+                                       
+                                       if (is_array($coin_TL)) { $coin_TL[0]-= 
$border['l']['width']; $coin_TL[1]-= $border['t']['width']; }
+                                       if (is_array($coin_TR)) { $coin_TR[0]-= 
$border['r']['width']; $coin_TR[1]-= $border['t']['width']; }
+                                       if (is_array($coin_BL)) { $coin_BL[0]-= 
$border['l']['width']; $coin_BL[1]-= $border['b']['width']; }
+                                       if (is_array($coin_BR)) { $coin_BR[0]-= 
$border['r']['width']; $coin_BR[1]-= $border['b']['width']; }
+                                       
+                                       $this->pdf->clippingPathOpen($b_x, 
$b_y, $b_w, $b_h, $coin_TL, $coin_TR, $coin_BL, $coin_BR);           
+                                       for ($i_y=$i_y_min; $i_y<$i_y_max; 
$i_y+=$i_height)
+                                       {
+                                               for ($i_x=$i_x_min; 
$i_x<$i_x_max; $i_x+=$i_width)
+                                               {
+                                                       $c_x = null;
+                                                       $c_y = null;
+                                                       $c_w = $i_width;
+                                                       $c_h = $i_height;
+                                                       if 
($i_y_max-$i_y<$i_height)
+                                                       {
+                                                               $c_x = $i_x;
+                                                               $c_y = $i_y;
+                                                               $c_h = 
$i_y_max-$i_y;
+                                                       }
+                                                       if 
($i_x_max-$i_x<$i_width)
+                                                       {
+                                                               $c_x = $i_x;
+                                                               $c_y = $i_y;
+                                                               $c_w = 
$i_x_max-$i_x;
+                                                       }
+       
+                                                       
$this->pdf->Image($i_name, $i_x, $i_y, $i_width, $i_height, '', '');            
                                
+                                               }
+                                       }
+                                       $this->pdf->clippingPathClose();
+                               }
+                       }
+                                               
+                       $x-= 0.01;
+                       $y-= 0.01;
+                       $w+= 0.02;
+                       $h+= 0.02;
+                       if ($border['b']['width']) $border['b']['width']+= 0.02;
+                       if ($border['l']['width']) $border['l']['width']+= 0.02;
+                       if ($border['t']['width']) $border['t']['width']+= 0.02;
+                       if ($border['r']['width']) $border['r']['width']+= 0.02;
+                       
+                       if ($border['b']['width'] && 
$border['b']['color'][0]!==null)
+                       {
+                               $pt = array();
+                               $pt[] = $x+$w;                                  
                $pt[] = $y+$h;
+                               $pt[] = $x+$w-$border['r']['width'];    $pt[] = 
$y+$h;
+                               $pt[] = $x+$border['l']['width'];               
$pt[] = $y+$h;
+                               $pt[] = $x;                                     
                        $pt[] = $y+$h;
+                               $pt[] = $x+$border['l']['width'];               
$pt[] = $y+$h-$border['b']['width'];
+                               $pt[] = $x+$w-$border['r']['width'];    $pt[] = 
$y+$h-$border['b']['width'];
+                               
+                               $bord = 3;                      
+                               if (is_array($coin_BL))
+                               {
+                                       $bord-=2;
+                                       $pt[4] += 
$radius_h-$border['l']['width'];
+                                       $pt[8] += 
$radius_h-$border['l']['width'];
+                                       unset($pt[6]);unset($pt[7]);
+                               }
+                               if (is_array($coin_BR))
+                               {
+                                       $courbe = array();
+                                       $courbe[] = $x+$w;                      
                                $courbe[] = $y+$h-$radius_v;
+                                       $courbe[] = $x+$w-$radius_h;            
                $courbe[] = $y+$h;
+                                       $courbe[] = 
$x+$w-$border['r']['width'];        $courbe[] = $y+$h-$radius_v;
+                                       $courbe[] = $x+$w-$radius_h;            
                $courbe[] = $y+$h-$border['b']['width'];
+                                       $courbe[] = $x+$w-$radius_h;            
                $courbe[] = $y+$h-$radius_v;
+                                       $this->Courbe($courbe, 
$border['b']['color']);
+
+                                       $bord-=1;
+                                       $pt[2] -= 
$radius_h-$border['r']['width'];
+                                       $pt[10]-= 
$radius_h-$border['r']['width'];
+                                       unset($pt[0]);unset($pt[1]);
+                                       
+                               }
+
+                               $pt = array_values($pt);
+                               $this->Line($pt, $border['b']['color'], 
$border['b']['type'], $border['b']['width'], $bord);
+                       }
+
+                       if ($border['l']['width'] && 
$border['l']['color'][0]!==null)
+                       {
+                               $pt = array();
+                               $pt[] = $x;                                     
                        $pt[] = $y+$h;
+                               $pt[] = $x;                                     
                        $pt[] = $y+$h-$border['b']['width'];
+                               $pt[] = $x;                                     
                        $pt[] = $y+$border['t']['width'];
+                               $pt[] = $x;                                     
                        $pt[] = $y;
+                               $pt[] = $x+$border['l']['width'];               
$pt[] = $y+$border['t']['width'];
+                               $pt[] = $x+$border['l']['width'];               
$pt[] = $y+$h-$border['b']['width'];
+
+                               $bord = 3;                      
+                               if (is_array($coin_BL))
+                               {
+                                       $courbe = array();
+                                       $courbe[] = $x+$radius_h;               
                $courbe[] = $y+$h;
+                                       $courbe[] = $x;                         
                        $courbe[] = $y+$h-$radius_v;
+                                       $courbe[] = $x+$radius_h;               
                $courbe[] = $y+$h-$border['b']['width'];
+                                       $courbe[] = $x+$border['l']['width'];   
$courbe[] = $y+$h-$radius_v;
+                                       $courbe[] = $x+$radius_h;               
                $courbe[] = $y+$h-$radius_v;
+                                       $this->Courbe($courbe, 
$border['l']['color']);
+                                       
+                                       $bord-=1;
+                                       $pt[3] -= 
$radius_v-$border['b']['width'];
+                                       $pt[11]-= 
$radius_v-$border['b']['width'];      
+                                       unset($pt[0]);unset($pt[1]);
+                               }
+                               if (is_array($coin_TL))
+                               {
+                                       $bord-=2;
+                                       $pt[5] += 
$radius_v-$border['t']['width'];
+                                       $pt[9] += 
$radius_v-$border['t']['width'];
+                                       unset($pt[6]);unset($pt[7]);
+                               }
+                               
+                               $pt = array_values($pt);
+                               $this->Line($pt, $border['l']['color'], 
$border['l']['type'], $border['l']['width'], $bord);
+                       }
+                       
+                       if ($border['t']['width'] && 
$border['t']['color'][0]!==null)
+                       {
+                               $pt = array();
+                               $pt[] = $x;                                     
                        $pt[] = $y;
+                               $pt[] = $x+$border['l']['width'];               
$pt[] = $y;
+                               $pt[] = $x+$w-$border['r']['width'];    $pt[] = 
$y;
+                               $pt[] = $x+$w;                                  
                $pt[] = $y;
+                               $pt[] = $x+$w-$border['r']['width'];    $pt[] = 
$y+$border['t']['width'];
+                               $pt[] = $x+$border['l']['width'];               
$pt[] = $y+$border['t']['width'];
+
+                               $bord = 3;                      
+                               if (is_array($coin_TL))
+                               {
+                                       $courbe = array();
+                                       $courbe[] = $x;                         
                        $courbe[] = $y+$radius_v;
+                                       $courbe[] = $x+$radius_h;               
                $courbe[] = $y;
+                                       $courbe[] = $x+$border['l']['width'];   
$courbe[] = $y+$radius_v;
+                                       $courbe[] = $x+$radius_h;               
                $courbe[] = $y+$border['t']['width'];
+                                       $courbe[] = $x+$radius_h;               
                $courbe[] = $y+$radius_v;
+                                       $this->Courbe($courbe, 
$border['t']['color']);
+
+                                       $bord-=1;
+                                       $pt[2] += 
$radius_h-$border['l']['width'];
+                                       $pt[10]+= 
$radius_h-$border['l']['width'];
+                                       unset($pt[0]);unset($pt[1]);
+                               }
+                               if (is_array($coin_TR))
+                               {
+                                       $bord-=2;
+                                       $pt[4] -= 
$radius_h-$border['r']['width'];
+                                       $pt[8] -= 
$radius_h-$border['r']['width'];
+                                       unset($pt[6]);unset($pt[7]);
+                               }
+                               
+                               $pt = array_values($pt);
+                               $this->Line($pt, $border['t']['color'], 
$border['t']['type'], $border['t']['width'], $bord);
+                       }
+
+                       if ($border['r']['width'] && 
$border['r']['color'][0]!==null)
+                       {
+                               $pt = array();
+                               $pt[] = $x+$w;                                  
                        $pt[] = $y;
+                               $pt[] = $x+$w;                                  
                        $pt[] = $y+$border['t']['width'];
+                               $pt[] = $x+$w;                                  
                        $pt[] = $y+$h-$border['b']['width'];
+                               $pt[] = $x+$w;                                  
                        $pt[] = $y+$h;
+                               $pt[] = $x+$w-$border['r']['width'];            
$pt[] = $y+$h-$border['b']['width'];
+                               $pt[] = $x+$w-$border['r']['width'];            
$pt[] = $y+$border['t']['width'];
+                               
+                               $bord = 3;                      
+                               if (is_array($coin_TR))
+                               {
+                                       $courbe = array();
+                                       $courbe[] = $x+$w-$radius_h;            
                $courbe[] = $y;
+                                       $courbe[] = $x+$w;                      
                                $courbe[] = $y+$radius_v;
+                                       $courbe[] = $x+$w-$radius_h;            
                $courbe[] = $y+$border['t']['width'];
+                                       $courbe[] = 
$x+$w-$border['r']['width'];        $courbe[] = $y+$radius_v;
+                                       $courbe[] = $x+$w-$radius_h;            
                $courbe[] = $y+$radius_v;
+                                       $this->Courbe($courbe, 
$border['r']['color']);
+
+                                       $bord-=1;
+                                       $pt[3] += 
$radius_v-$border['t']['width'];
+                                       $pt[11]+= 
$radius_v-$border['t']['width'];
+                                       unset($pt[0]);unset($pt[1]);
+                               }
+                               if (is_array($coin_BR))
+                               {
+                                       $bord-=2;
+                                       $pt[5] -= 
$radius_v-$border['b']['width'];
+                                       $pt[9] -= 
$radius_v-$border['b']['width'];
+                                       unset($pt[6]);unset($pt[7]);
+                               }
+                               
+                               $pt = array_values($pt);
+                               $this->Line($pt, $border['r']['color'], 
$border['r']['type'], $border['r']['width'], $bord);
+                       }
+
+                       if ($background) 
$this->pdf->SetFillColor($background['color'][0], $background['color'][1], 
$background['color'][2]);
+               }
+               
+               function Courbe($pt, $color)
+               {
+                       $this->pdf->SetFillColor($color[0], $color[1], 
$color[2]);
+                       
+                       $this->pdf->drawCourbe($pt[0], $pt[1], $pt[2], $pt[3], 
$pt[4], $pt[5], $pt[6], $pt[7], $pt[8], $pt[9]);
+               }
+               
+               /**
+               * Tracer une ligne epaisse d\xE9fini par ses points avec des 
extreminites en biseau
+               * 
+               * @param        array   liste des points definissant le tour de 
la ligne
+               * @param        float   couleur RVB
+               * @param        string  type de ligne
+               * @param        float   largeur de la ligne
+               * @return       null
+               */      
+               function Line($pt, $color, $type, $width, $bord=3)
+               {
+                       $this->pdf->SetFillColor($color[0], $color[1], 
$color[2]);
+                       if ($type=='dashed' || $type=='dotted')
+                       {
+                               if ($bord==1)
+                               {
+                                       $tmp = array(); $tmp[]=$pt[0]; 
$tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[8]; $tmp[]=$pt[9];
+                                       $this->pdf->Polygon($tmp, 'F');
+                                       
+                                       $tmp = array(); $tmp[]=$pt[2]; 
$tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; 
$tmp[]=$pt[8]; $tmp[]=$pt[9];
+                                       $pt = $tmp;
+                               }
+                               else if ($bord==2)
+                               {
+                                       $tmp = array(); $tmp[]=$pt[2]; 
$tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7];
+                                       $this->pdf->Polygon($tmp, 'F');
+                                       
+                                       $tmp = array(); $tmp[]=$pt[0]; 
$tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; 
$tmp[]=$pt[8]; $tmp[]=$pt[9];
+                                       $pt = $tmp;                             
        
+                               }
+                               else if ($bord==3)
+                               {
+                                       $tmp = array(); $tmp[]=$pt[0]; 
$tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[10]; $tmp[]=$pt[11];
+                                       $this->pdf->Polygon($tmp, 'F');
+       
+                                       $tmp = array(); $tmp[]=$pt[4]; 
$tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $tmp[]=$pt[8]; $tmp[]=$pt[9];
+                                       $this->pdf->Polygon($tmp, 'F');
+                                       
+                                       $tmp = array(); $tmp[]=$pt[2]; 
$tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[8]; $tmp[]=$pt[9]; 
$tmp[]=$pt[10]; $tmp[]=$pt[11];
+                                       $pt = $tmp;
+                               }
+                               
+                               if ($pt[2]==$pt[0])
+                               {
+                                       $l = abs(($pt[3]-$pt[1])*0.5);
+                                       $px = 0;
+                                       $py = $width;
+                                       $x1 = $pt[0]; $y1 = ($pt[3]+$pt[1])*0.5;
+                                       $x2 = $pt[6]; $y2 = ($pt[7]+$pt[5])*0.5;
+                               }
+                               else
+                               {
+                                       $l = abs(($pt[2]-$pt[0])*0.5);
+                                       $px = $width;
+                                       $py = 0;                                
        
+                                       $x1 = ($pt[2]+$pt[0])*0.5; $y1 = $pt[1];
+                                       $x2 = ($pt[6]+$pt[4])*0.5; $y2 = $pt[7];
+                               }
+                               if ($type=='dashed')
+                               {
+                                       $px = $px*3.;
+                                       $py = $py*3.;
+                               }
+                               $mode = ($l/($px+$py)<.5);
+                               
+                               for($i=0; $l-($px+$py)*($i-0.5)>0; $i++)
+                               {
+                                       if (($i%2)==$mode)
+                                       {
+                                               $j = $i-0.5;
+                                               $lx1 = $px*($j);        if 
($lx1<-$l)   $lx1 =-$l;
+                                               $ly1 = $py*($j);        if 
($ly1<-$l)   $ly1 =-$l;
+                                               $lx2 = $px*($j+1);      if 
($lx2>$l)    $lx2 = $l;
+                                               $ly2 = $py*($j+1);      if 
($ly2>$l)    $ly2 = $l;
+                                               
+                                               $tmp = array();
+                                               $tmp[] = $x1+$lx1;      $tmp[] 
= $y1+$ly1;      
+                                               $tmp[] = $x1+$lx2;      $tmp[] 
= $y1+$ly2;      
+                                               $tmp[] = $x2+$lx2;      $tmp[] 
= $y2+$ly2;      
+                                               $tmp[] = $x2+$lx1;      $tmp[] 
= $y2+$ly1;
+                                               $this->pdf->Polygon($tmp, 'F'); 
+
+                                               if ($j>0)
+                                               {
+                                                       $tmp = array();
+                                                       $tmp[] = $x1-$lx1;      
$tmp[] = $y1-$ly1;      
+                                                       $tmp[] = $x1-$lx2;      
$tmp[] = $y1-$ly2;      
+                                                       $tmp[] = $x2-$lx2;      
$tmp[] = $y2-$ly2;      
+                                                       $tmp[] = $x2-$lx1;      
$tmp[] = $y2-$ly1;
+                                                       
$this->pdf->Polygon($tmp, 'F'); 
+                                               }
+                                       }
+                               }               
+                       }
+                       else if ($type=='solid')
+                       {
+                               $this->pdf->Polygon($pt, 'F');
+                       }
+               }
+       
+               /**
+               * balise : BR
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @param        integer position reelle courante si saut de 
ligne pendant l'ecriture d'un texte 
+               * @return       null
+               */      
+               function o_BR($param, $curr = null)
+               {
+                       if ($this->forOneLine) return false;
+                       
+                       $h = $this->style->getLineHeight();
+                       $h = max($this->maxH, $h);
+                       $y = $this->pdf->getY();
+
+                       // si la ligne est vide, la position maximale n'a pas 
\xE9t\xE9 mise \xE0 jour => on la met \xE0 jour
+                       if ($this->maxH==0) $this->maxY = max($this->maxY, 
$y+$h);
+                       
+                       // si le saut de ligne rentre => on le prend en compte, 
sinon nouvelle page
+                       if ($y+$h<$this->pdf->h - $this->pdf->bMargin) 
$this->setNewLine($h, $curr);
+                       else $this->setNewPage('', null, $curr);
+                       
+                       $this->maxH = 0;
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : HR
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_HR($param)
+               {
+                       if ($this->forOneLine) return false;
+                       $old_align = $this->style->value['text-align'];
+                       $this->style->value['text-align'] = 'left';
+
+                       if ($this->maxH) $this->o_BR($param);
+                       
+                       $f_size = $this->style->value['font-size'];
+                       $this->style->value['font-size']=$f_size*0.5; 
$this->o_BR($param);
+                       $this->style->value['font-size']=0;
+                       
+                       $param['style']['width'] = '100%';
+                       
+                       $this->style->save();
+                       
$this->style->value['height']=$this->style->ConvertToMM('1mm');
+
+                       $this->style->analyse('hr', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       $h = $this->style->value['height'];
+                       if ($h)         $h-= 
$this->style->value['border']['t']['width']+$this->style->value['border']['b']['width'];
+                       if ($h<=0)      $h = 
$this->style->value['border']['t']['width']+$this->style->value['border']['b']['width'];
+
+                       $this->Rectangle($this->pdf->x, $this->pdf->y, 
$this->style->value['width'], $h, $this->style->value['border'], 0, 0, 
$this->style->value['background']);
+                       $this->maxH = $h;
+
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       $this->o_BR($param);
+
+                       $this->style->value['font-size']=$f_size*0.5; 
$this->o_BR($param);
+                       $this->style->value['font-size']=$f_size;
+
+                       $this->style->value['text-align'] = $old_align;
+                       $this->setNewPositionForNewLine();
+                                               
+                       return true;
+               }
+
+               /**
+               * balise : B
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_B($param, $other = 'b')
+               {
+                       $this->style->save();
+                       $this->style->value['font-bold'] = true;
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               function o_STRONG($param) { return $this->o_B($param, 
'strong'); }
+                               
+               /**
+               * balise : B
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_B($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               function c_STRONG($param) { return $this->c_B($param); }
+               
+               /**
+               * balise : I
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_I($param, $other = 'i')
+               {
+                       $this->style->save();
+                       $this->style->value['font-italic'] = true;
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }       
+               function o_ADDRESS($param)      { return $this->o_I($param, 
'address'); }
+               function o_CITE($param)         { return $this->o_I($param, 
'cite');            }
+               function o_EM($param)           { return $this->o_I($param, 
'em');                      }
+               function o_SAMP($param)         { return $this->o_I($param, 
'samp');            }
+
+               /**
+               * balise : I
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_I($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }       
+               function c_ADDRESS($param)      { return $this->c_I($param); }
+               function c_CITE($param)         { return $this->c_I($param); }
+               function c_EM($param)           { return $this->c_I($param); }
+               function c_SAMP($param)         { return $this->c_I($param); }
+
+               /**
+               * balise : S
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_S($param, $other = 's')
+               {
+                       $this->style->save();
+                       $this->style->value['font-linethrough'] = true;
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }       
+               function o_DEL($param) { return $this->o_S($param, 'del'); }
+               
+               /**
+               * balise : S
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_S($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               function c_DEL($param) { return $this->c_S($param); }
+               
+               /**
+               * balise : U
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_U($param, $other='u')
+               {
+                       $this->style->save();
+                       $this->style->value['font-underline'] = true;
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }       
+               function o_INS($param) { return $this->o_U($param, 'ins'); }
+               
+               /**
+               * balise : U
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_U($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               function c_INS($param) { return $this->c_U($param); }
+               
+               /**
+               * balise : A
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_A($param)
+               {
+                       $this->inLink = str_replace('&amp;', '&', 
isset($param['href']) ? $param['href'] : '');
+                       
+                       if (isset($param['name']))
+                       {
+                               $nom =  $param['name'];
+                               if (!isset($this->lstAncre[$nom])) 
$this->lstAncre[$nom] = array($this->pdf->AddLink(), false);
+                               
+                               if (!$this->lstAncre[$nom][1])
+                               {
+                                       $this->lstAncre[$nom][1] = true;
+                                       
$this->pdf->SetLink($this->lstAncre[$nom][0], -1, -1);
+                               }
+                       }
+                       
+                       if (preg_match('/^#([^#]+)$/isU', $this->inLink, 
$match))
+                       {
+                               $nom = $match[1];
+                               if (!isset($this->lstAncre[$nom])) 
$this->lstAncre[$nom] = array($this->pdf->AddLink(), false);
+                               
+                               $this->inLink = $this->lstAncre[$nom][0];
+                       }
+                       
+                       $this->style->save();
+                       $this->style->value['font-underline'] = true;
+                       $this->style->value['color'] = array(20, 20, 250);
+                       $this->style->analyse('a', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;            
+               }
+
+               /**
+               * balise : A
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_A($param)
+               {
+                       $this->inLink   = '';
+                       $this->style->load();
+                       $this->style->FontSet();                        
+                       
+                       return true;
+               }
+
+               /**
+               * balise : H1
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_H1($param, $other = 'h1')
+               {
+                       if ($this->forOneLine) return false;
+                       
+                       if ($this->maxH) $this->o_BR(array());
+                       $this->style->save();
+                       $this->style->value['font-bold'] = true;
+                       
+                       $size = array('h1' => '28px', 'h2' => '24px', 'h3' => 
'20px', 'h4' => '16px', 'h5' => '12px', 'h6' => '9px');
+                       $this->style->value['margin']['l'] = 0;
+                       $this->style->value['margin']['r'] = 0;
+                       $this->style->value['margin']['t'] = 
$this->style->ConvertToMM('16px');
+                       $this->style->value['margin']['b'] = 
$this->style->ConvertToMM('16px');
+                       $this->style->value['font-size'] = 
$this->style->ConvertToMM($size[$other]);
+
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       $this->setNewPositionForNewLine();
+                       
+                       return true;
+               }
+               function o_H2($param)   { return $this->o_H1($param, 'h2'); }
+               function o_H3($param)   { return $this->o_H1($param, 'h3'); }
+               function o_H4($param)   { return $this->o_H1($param, 'h4'); }
+               function o_H5($param)   { return $this->o_H1($param, 'h5'); }
+               function o_H6($param)   { return $this->o_H1($param, 'h6'); }
+               
+               
+               /**
+               * balise : H1
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_H1($param)
+               {
+                       if ($this->forOneLine) return false;
+                       $this->maxH+= $this->style->value['margin']['b'];
+                       $this->o_BR(array());
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               function c_H2($param)   { return $this->c_H1($param); }
+               function c_H3($param)   { return $this->c_H1($param); }
+               function c_H4($param)   { return $this->c_H1($param); }
+               function c_H5($param)   { return $this->c_H1($param); }
+               function c_H6($param)   { return $this->c_H1($param); }
+               
+               /**
+               * balise : SPAN
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_SPAN($param, $other = 'span')
+               {
+                       $this->style->save();
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();                
+                       
+                       return true;
+               }       
+               function o_FONT($param)         { return $this->o_SPAN($param, 
'font'); }
+
+               /**
+               * balise : SPAN
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_SPAN($param)
+               {
+                       $this->style->restorePosition($this->pdf->x, 
$this->pdf->y);
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               function c_FONT($param)         { return $this->c_SPAN($param); 
}
+
+
+               /**
+               * balise : P
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_P($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       if (!in_array($this->previousCall, array('c_P', 
'c_UL')))
+                       {
+                               if ($this->maxH) $this->o_BR(array());
+                               $this->o_BR(array());
+                       }
+                       
+                       $this->style->save();
+                       $this->style->analyse('p', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       if ($this->style->value['text-indent']>0) 
$this->pdf->x+= $this->style->value['text-indent'];
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : P
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_P($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       if ($this->maxH) $this->o_BR(array());
+                       $this->o_BR(array());
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : PRE
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_PRE($param, $other = 'pre')
+               {
+                       if ($other=='pre' && $this->maxH) $this->o_BR(array());
+                       
+                       $this->style->save();
+                       $this->style->value['font-family']      = 'courier';
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+
+                       if ($other=='pre') return $this->o_DIV($param, $other);
+                       
+                       return true;
+               }
+               function o_CODE($param) { return $this->o_PRE($param, 'code'); }
+               
+               /**
+               * balise : PRE
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_PRE($param, $other = 'pre')
+               {
+                       if ($other=='pre')
+                       {
+                               if ($this->forOneLine) return false;
+
+                               $this->c_DIV($param);
+                               $this->o_BR(array());
+                       }
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               function c_CODE($param) { return $this->c_PRE($param, 'code'); }
+                               
+               /**
+               * balise : BIG
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_BIG($param)
+               {
+                       $this->style->save();
+                       $this->style->value['mini-decal']-= 
$this->style->value['mini-size']*0.2;
+                       $this->style->value['mini-size'] *= 1.2;
+                       $this->style->analyse('big', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : BIG
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_BIG($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : SMALL
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_SMALL($param)
+               {
+                       $this->style->save();
+                       $this->style->value['mini-decal']+= 
$this->style->value['mini-size']*0.18;
+                       $this->style->value['mini-size'] *= 0.82;
+                       $this->style->analyse('small', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+                
+               /**
+               * balise : SMALL
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_SMALL($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+
+               /**
+               * balise : SUP
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_SUP($param)
+               {
+                       $this->style->save();
+                       $this->style->value['mini-decal']-= 
$this->style->value['mini-size']*0.25;
+                       $this->style->value['mini-size'] *= 0.75;
+                       $this->style->analyse('sup', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+                
+               /**
+               * balise : SUP
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_SUP($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : SUB
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_SUB($param)
+               {
+                       $this->style->save();
+                       $this->style->value['mini-decal']+= 
$this->style->value['mini-size']*0.25;
+                       $this->style->value['mini-size'] *= 0.75;
+                       $this->style->analyse('sub', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       $this->inSub = 1;
+                       
+                       return true;
+               }
+                
+               /**
+               * balise : SUB
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_SUB($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : UL
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_UL($param, $other = 'ul')
+               {
+                       if ($this->forOneLine) return false;
+
+                       if (!in_array($this->previousCall, array('c_P', 
'c_UL')))
+                       {
+                               if ($this->maxH) $this->o_BR(array());
+                               if (!count($this->defLIST)) 
$this->o_BR(array());
+                       }
+                       
+                       if (!isset($param['style']['width'])) 
$param['allwidth'] = true;
+                       $param['cellspacing'] = 0;
+
+                       // une liste est trait\xE9e comme un tableau
+                       $this->o_TABLE($param, $other);
+
+                       // ajouter un niveau de liste
+                       $this->listeAddLevel($other, 
$this->style->value['list-style-type'], 
$this->style->value['list-style-image']);
+                       
+                       return true;
+               }
+               function o_OL($param) { return $this->o_UL($param, 'ol'); }     
+               
+               /**
+               * balise : UL
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */
+               function c_UL($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       // fin du tableau
+                       $this->c_TABLE($param);
+                       
+                       // enlever un niveau de liste
+                       $this->listeDelLevel();
+
+                       if (!$this->sub_part)
+                       {
+                               if (!count($this->defLIST)) 
$this->o_BR(array());
+                       }
+                       
+                       return true;
+               }
+               function c_OL($param) { return $this->c_UL($param); }
+
+               /**
+               * balise : LI
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */
+               function o_LI($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       // ajouter une puce au niveau actuel
+                       $this->listeAddLi();
+
+                       if (!isset($param['style']['width'])) 
$param['style']['width'] = '100%';
+
+                       // preparation du style de la puce
+                       $paramPUCE = $param;
+                       
+                       $inf = $this->listeGetLi();
+                       if ($inf[0])
+                       {
+                               $paramPUCE['style']['font-family']              
= $inf[0];
+                               $paramPUCE['style']['text-align']               
= 'li_right';
+                               $paramPUCE['style']['vertical-align']   = 'top';
+                               $paramPUCE['style']['width']                    
= $this->listeGetWidth();
+                               $paramPUCE['style']['padding-right']    = 
$this->listeGetPadding();
+                               $paramPUCE['txt'] = $inf[2];
+                       }
+                       else
+                       {
+                               $paramPUCE['style']['text-align']               
= 'li_right';
+                               $paramPUCE['style']['vertical-align']   = 'top';
+                               $paramPUCE['style']['width']                    
= $this->listeGetWidth();
+                               $paramPUCE['style']['padding-right']    = 
$this->listeGetPadding();
+                               $paramPUCE['src'] = $inf[2];
+                               $paramPUCE['sub_li'] = true;
+                       }
+                       
+                       // nouvelle ligne
+                       $this->o_TR($param, 'li');
+
+                       $this->style->save();
+                       
+                       if ($inf[1])
+                       {
+                               $this->style->value['mini-decal']+= 
$this->style->value['mini-size']*0.25;
+                               $this->style->value['mini-size'] *= 0.75;
+                       }
+                       
+                       // si on est dans un sub_html => preparation, sinon 
affichage classique
+                       if ($this->sub_part)
+                       {
+                               // TD pour la puce
+                               $tmp_pos = $this->temp_pos;
+                               $tmp_lst1 = $this->parsing->code[$tmp_pos+1];
+                               $tmp_lst2 = $this->parsing->code[$tmp_pos+2];
+                               $this->parsing->code[$tmp_pos+1] = array();
+                               $this->parsing->code[$tmp_pos+1]['name']        
= (isset($paramPUCE['src'])) ? 'img' : 'write';
+                               $this->parsing->code[$tmp_pos+1]['param']       
= $paramPUCE; 
unset($this->parsing->code[$tmp_pos+1]['param']['style']['width']);
+                               $this->parsing->code[$tmp_pos+1]['close']       
= 0;
+                               $this->parsing->code[$tmp_pos+2] = array();
+                               $this->parsing->code[$tmp_pos+2]['name']        
= 'li';
+                               $this->parsing->code[$tmp_pos+2]['param']       
= $paramPUCE;
+                               $this->parsing->code[$tmp_pos+2]['close']       
= 1;
+                               $this->o_TD($paramPUCE, 'li_sub');
+                               $this->c_TD($param);
+                               $this->temp_pos = $tmp_pos;
+                               $this->parsing->code[$tmp_pos+1] = $tmp_lst1;
+                               $this->parsing->code[$tmp_pos+2] = $tmp_lst2;
+                       }
+                       else
+                       {
+                               // TD pour la puce
+                               $this->o_TD($paramPUCE, 'li_sub');
+                               unset($paramPUCE['style']['width']);
+                               if (isset($paramPUCE['src']))   
$this->o_IMG($paramPUCE);
+                               else                                            
        $this->o_WRITE($paramPUCE);
+                               $this->c_TD($paramPUCE);
+                       }
+                       $this->style->load();
+
+                               
+                       // td pour le contenu
+                       $this->o_TD($param, 'li');
+                       
+                       return true;
+               }
+
+               /**
+               * balise : LI
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */
+               function c_LI($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       // fin du contenu
+                       $this->c_TD($param, 'li');
+                       
+                       // fin de la ligne
+                       $this->c_TR($param, 'li');
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : TBODY
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TBODY($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->save();
+                       $this->style->analyse('tbody', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }       
+
+               /**
+               * balise : TBODY
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TBODY($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : THEAD
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_THEAD($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       global $HTML2PDF_TABLEAU;
+                       
+                       $this->style->save();
+                       $this->style->analyse('thead', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       // si on est en mode sub_html : sauvegarde du num\xE9ro 
du TR 
+                       if ($this->sub_part)
+                       {
+                               
$HTML2PDF_TABLEAU[$param['num']]['thead']['tr'][0] = 
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'];
+                               
$HTML2PDF_TABLEAU[$param['num']]['thead']['code'] = array(); 
+                               for($pos=$this->temp_pos; 
$pos<count($this->parsing->code); $pos++)
+                               {
+                                       $todo = $this->parsing->code[$pos];
+                                       if (strtolower($todo['name'])=='thead') 
$todo['name'] = 'thead_sub';
+                                       
$HTML2PDF_TABLEAU[$param['num']]['thead']['code'][] = $todo;
+                                       if 
(strtolower($todo['name'])=='thead_sub' && $todo['close']) break;
+                               }
+                       }
+                       else
+                       {
+                               $res = 
$this->parsing->getLevel($this->parse_pos);
+                               $this->parse_pos = $res[0]-1;
+                               $HTML2PDF_TABLEAU[$param['num']]['tr_curr']+= 
count($HTML2PDF_TABLEAU[$param['num']]['thead']['tr']);
+                       }
+                       
+                       return true;
+               }       
+
+               /**
+               * balise : THEAD
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_THEAD($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->load();
+                       $this->style->FontSet();
+
+                       // si on est en mode sub_html : sauvegarde du num\xE9ro 
du TR 
+                       if ($this->sub_part)
+                       {
+                               global $HTML2PDF_TABLEAU;                       
        
+                               $min = 
$HTML2PDF_TABLEAU[$param['num']]['thead']['tr'][0];
+                               $max = 
$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1;                           
+                               $HTML2PDF_TABLEAU[$param['num']]['thead']['tr'] 
= range($min, $max);
+                       }
+                       
+                       return true;
+               }
+
+               /**
+               * balise : TFOOT
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TFOOT($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       global $HTML2PDF_TABLEAU;               
+
+                       $this->style->save();
+                       $this->style->analyse('tfoot', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       // si on est en mode sub_html : sauvegarde du num\xE9ro 
du TR 
+                       if ($this->sub_part)
+                       {
+                               
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0] = 
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'];
+                               
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'] = array(); 
+                               for($pos=$this->temp_pos; 
$pos<count($this->parsing->code); $pos++)
+                               {
+                                       $todo = $this->parsing->code[$pos];
+                                       if (strtolower($todo['name'])=='tfoot') 
$todo['name'] = 'tfoot_sub';
+                                       
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'][] = $todo;
+                                       if 
(strtolower($todo['name'])=='tfoot_sub' && $todo['close']) break;
+                               }
+                       }
+                       else
+                       {
+                               $res = 
$this->parsing->getLevel($this->parse_pos+1);
+                               $this->parse_pos = $res[0];
+                               $HTML2PDF_TABLEAU[$param['num']]['tr_curr']+= 
count($HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr']);
+                       }
+                       
+                       return true;
+               }       
+
+               /**
+               * balise : TFOOT
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TFOOT($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       // si on est en mode sub_html : sauvegarde du num\xE9ro 
du TR 
+                       if ($this->sub_part)
+                       {
+                               global $HTML2PDF_TABLEAU;
+                               
+                               $min = 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0];
+                               $max = 
$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1;                           
+                               $HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'] 
= range($min, $max);
+                       }
+                       
+                       return true;
+               }
+
+               /**
+               * balise : THEAD_SUB
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_THEAD_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->save();
+                       $this->style->analyse('thead', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : THEAD_SUB
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_THEAD_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : TFOOT_SUB
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TFOOT_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->save();
+                       $this->style->analyse('tfoot', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : TFOOT_SUB
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TFOOT_SUB($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+                               
+               /**
+               * balise : FORM
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_FORM($param)
+               {
+                       $this->style->save();
+                       $this->style->analyse('form', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       return true;
+               }       
+
+               /**
+               * balise : FORM
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_FORM($param)
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : TABLE
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TABLE($param, $other = 'table')
+               {
+                       if ($this->forOneLine) return false;
+                       if ($this->maxH) $this->o_BR(array());
+                       
+                       $this->maxH = 0;
+                       // utilisation du tableau des param\xE9tres des tables
+                       global $HTML2PDF_TABLEAU; 
+
+                       $align_object = isset($param['align']) ? 
strtolower($param['align']) : 'left';
+                       if (isset($param['align'])) unset($param['align']);
+                       if (!in_array($align_object, array('left', 'center', 
'right'))) $align_object = 'left';
+                       
+                       // lecture et initialisation du style
+                       $this->style->save();
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+
+                       if ($this->style->value['margin-auto']) $align_object = 
'center';
+
+                       // est-on en collapse
+                       $collapse = false;                      
+                       if ($other=='table')
+                               $collapse = 
isset($this->style->value['border']['collapse']) ? 
$this->style->value['border']['collapse'] : false;
+
+                       // si oui il faut adapt\xE9 les borders
+                       if ($collapse)
+                       {
+                               $param['style']['border'] = 'none';
+                               $param['cellspacing'] = 0;
+                               $none = $this->style->readBorder('none');
+                               $this->style->value['border']['t'] = $none;
+                               $this->style->value['border']['r'] = $none;
+                               $this->style->value['border']['b'] = $none;
+                               $this->style->value['border']['l'] = $none;
+                       }                               
+                       
+                       // si on est en mode sub_html : initialisation des 
dimensions et autres 
+                       if ($this->sub_part)
+                       {
+                               if ($this->DEBUG_actif) $this->DEBUG_add('Table 
n\xB0'.$param['num'], true);
+                               $HTML2PDF_TABLEAU[$param['num']] = array();
+                               $HTML2PDF_TABLEAU[$param['num']]['cellpadding'] 
= $this->style->ConvertToMM(isset($param['cellpadding']) ? 
$param['cellpadding'] : '1px'); // cellpadding du tableau
+                               $HTML2PDF_TABLEAU[$param['num']]['cellspacing'] 
= $this->style->ConvertToMM(isset($param['cellspacing']) ? 
$param['cellspacing'] : '2px'); // cellspacing du tableau
+                               $HTML2PDF_TABLEAU[$param['num']]['cases']       
        = array();                              // liste des propri\xE9t\xE9s 
des cases
+                               $HTML2PDF_TABLEAU[$param['num']]['corr']        
        = array();                              // tableau de correlation pour 
les colspan et rowspan
+                               $HTML2PDF_TABLEAU[$param['num']]['corr_x']      
        = 0;                                    // position dans le tableau de 
correlation
+                               $HTML2PDF_TABLEAU[$param['num']]['corr_y']      
        = 0;                                    // position dans le tableau de 
correlation
+                               $HTML2PDF_TABLEAU[$param['num']]['td_curr']     
        = 0;                                    // colonne courante
+                               $HTML2PDF_TABLEAU[$param['num']]['tr_curr']     
        = 0;                                    // ligne courante
+                               $HTML2PDF_TABLEAU[$param['num']]['curr_x']      
        = $this->pdf->getX();   // position courante X
+                               $HTML2PDF_TABLEAU[$param['num']]['curr_y']      
        = $this->pdf->getY();   // position courante Y
+                               $HTML2PDF_TABLEAU[$param['num']]['width']       
        = 0;                                    // largeur globale
+                               $HTML2PDF_TABLEAU[$param['num']]['height']      
        = 0;                                    // hauteur globale
+                               $HTML2PDF_TABLEAU[$param['num']]['align']       
        = $align_object;
+                               $HTML2PDF_TABLEAU[$param['num']]['marge']       
        = array();
+                               $HTML2PDF_TABLEAU[$param['num']]['marge']['t']  
= 
$this->style->value['padding']['t']+$this->style->value['border']['t']['width']+$HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5;
+                               $HTML2PDF_TABLEAU[$param['num']]['marge']['r']  
= 
$this->style->value['padding']['r']+$this->style->value['border']['r']['width']+$HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5;
+                               $HTML2PDF_TABLEAU[$param['num']]['marge']['b']  
= 
$this->style->value['padding']['b']+$this->style->value['border']['b']['width']+$HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5;
+                               $HTML2PDF_TABLEAU[$param['num']]['marge']['l']  
= 
$this->style->value['padding']['l']+$this->style->value['border']['l']['width']+$HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5;
+                               $HTML2PDF_TABLEAU[$param['num']]['page']        
        = 0;                                    // nombre de pages
+                               $HTML2PDF_TABLEAU[$param['num']]['new_page']    
= true;                                 // nouvelle page pour le TR courant
+                               $HTML2PDF_TABLEAU[$param['num']]['style_value'] 
= null;                                 // style du tableau
+                               $HTML2PDF_TABLEAU[$param['num']]['thead']       
        = array();                              // infos sur le thead
+                               $HTML2PDF_TABLEAU[$param['num']]['tfoot']       
        = array();                              // infos sur le tfoot
+                               $HTML2PDF_TABLEAU[$param['num']]['thead']['tr'] 
= array();                              // tr du thead
+                               $HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'] 
= array();                              // tr du tfoot
+                               
$HTML2PDF_TABLEAU[$param['num']]['thead']['height']     = 0;                    
        // hauteur du thead
+                               
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['height']     = 0;                    
        // hauteur du tfoot
+                               
$HTML2PDF_TABLEAU[$param['num']]['thead']['code'] = array();                    
// contenu HTML du thead
+                               
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'] = array();                    
// contenu HTML du tfoot
+                               $HTML2PDF_TABLEAU[$param['num']]['cols']        
        = array();                              // definition via les balises 
col
+                               $this->saveMargin($this->pdf->lMargin, 
$this->pdf->tMargin, $this->pdf->rMargin);
+                               
+                               // adaptation de la largeur en fonction des 
marges du tableau
+                               $this->style->value['width']-= 
$HTML2PDF_TABLEAU[$param['num']]['marge']['l'] + 
$HTML2PDF_TABLEAU[$param['num']]['marge']['r'];
+                       }
+                       else
+                       {
+                               // on repart \xE0 la premiere page du tableau 
et \xE0 la premiere case
+                               $HTML2PDF_TABLEAU[$param['num']]['page'] = 0;
+                               $HTML2PDF_TABLEAU[$param['num']]['td_curr']     
= 0;
+                               $HTML2PDF_TABLEAU[$param['num']]['tr_curr']     
= 0;
+                               $HTML2PDF_TABLEAU[$param['num']]['td_x']        
        = 
$HTML2PDF_TABLEAU[$param['num']]['marge']['l']+$HTML2PDF_TABLEAU[$param['num']]['curr_x'];
+                               $HTML2PDF_TABLEAU[$param['num']]['td_y']        
        = 
$HTML2PDF_TABLEAU[$param['num']]['marge']['t']+$HTML2PDF_TABLEAU[$param['num']]['curr_y'];
                            
+
+                               // initialisation du style des bordures de la 
premiere partie de tableau
+                               $this->Rectangle(
+                                               
$HTML2PDF_TABLEAU[$param['num']]['curr_x'],
+                                               
$HTML2PDF_TABLEAU[$param['num']]['curr_y'],
+                                               
$HTML2PDF_TABLEAU[$param['num']]['width'],
+                                               
isset($HTML2PDF_TABLEAU[$param['num']]['height'][0]) ? 
$HTML2PDF_TABLEAU[$param['num']]['height'][0] : null,
+                                               $this->style->value['border'],
+                                               $this->style->value['padding'],
+                                               0,
+                                               
$this->style->value['background']
+                                       );
+
+                               $HTML2PDF_TABLEAU[$param['num']]['style_value'] 
= $this->style->value;
+                       }
+                       
+                       return true;
+               }
+
+               /**
+               * balise : TABLE
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TABLE($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       global $HTML2PDF_TABLEAU; 
+
+                       // restauration du style
+                       $this->style->load();
+                       $this->style->FontSet();
+
+                       // si on est en mode sub_html : initialisation des 
dimensions et autres 
+                       if ($this->sub_part)
+                       {
+                               // ajustement de la taille des cases
+                               
$this->calculTailleCases($HTML2PDF_TABLEAU[$param['num']]['cases'], 
$HTML2PDF_TABLEAU[$param['num']]['corr']);
+
+                               // calcul de la hauteur du THEAD et du TFOOT
+                               $lst = array('thead', 'tfoot');
+                               foreach($lst as $mode)
+                               {
+                                       
$HTML2PDF_TABLEAU[$param['num']][$mode]['height'] = 0;
+                                       
foreach($HTML2PDF_TABLEAU[$param['num']][$mode]['tr'] as $tr)
+                                       {
+                                               // hauteur de la ligne tr
+                                               $h = 0;
+                                               for($i=0; 
$i<count($HTML2PDF_TABLEAU[$param['num']]['cases'][$tr]); $i++)
+                                                       if 
($HTML2PDF_TABLEAU[$param['num']]['cases'][$tr][$i]['rowspan']==1)
+                                                               $h = max($h, 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$tr][$i]['h']);
+                                               
$HTML2PDF_TABLEAU[$param['num']][$mode]['height']+= $h; 
+                                       }
+                               }
+
+                               // calcul des dimensions du tableau - Largeur
+                               $HTML2PDF_TABLEAU[$param['num']]['width'] = 
$HTML2PDF_TABLEAU[$param['num']]['marge']['l'] + 
$HTML2PDF_TABLEAU[$param['num']]['marge']['r'];
+                               if 
(isset($HTML2PDF_TABLEAU[$param['num']]['cases'][0]))
+                                       
foreach($HTML2PDF_TABLEAU[$param['num']]['cases'][0] as $case)
+                                               
$HTML2PDF_TABLEAU[$param['num']]['width']+= $case['w'];
+
+                               // positionnement du tableau horizontalement;
+                               $old = 
isset($this->style->table[count($this->style->table)-1]) ? 
$this->style->table[count($this->style->table)-1] : $this->style->value;
+                               $parent_w = $old['width'] ? $old['width'] : 
$this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin;
+                               $x = $HTML2PDF_TABLEAU[$param['num']]['curr_x'];
+                               $w = $HTML2PDF_TABLEAU[$param['num']]['width'];
+                               if ($parent_w>$w)
+                               {
+                                       if 
($HTML2PDF_TABLEAU[$param['num']]['align']=='center')
+                                               $x = $x + ($parent_w-$w)*0.5;
+                                       else if 
($HTML2PDF_TABLEAU[$param['num']]['align']=='right')
+                                               $x = $x + $parent_w-$w;
+
+                                       
$HTML2PDF_TABLEAU[$param['num']]['curr_x'] = $x;
+                               }                                       
+
+
+                               // calcul des dimensions du tableau - hauteur 
du tableau sur chaque page
+                               $HTML2PDF_TABLEAU[$param['num']]['height'] = 
array();
+
+                               $h0 = 
$HTML2PDF_TABLEAU[$param['num']]['marge']['t'] + 
$HTML2PDF_TABLEAU[$param['num']]['marge']['b'];  // minimum de hauteur \xE0 
cause des marges
+                               $h0+= 
$HTML2PDF_TABLEAU[$param['num']]['thead']['height'] + 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['height']; // et du tfoot et thead
+                               $max = $this->pdf->h - $this->pdf->bMargin;     
                // max de hauteur par page
+                               $y = 
$HTML2PDF_TABLEAU[$param['num']]['curr_y'];        // position Y actuelle
+                               $height = $h0;
+                               
+                               // on va lire les hauteurs de chaque ligne, une 
\xE0 une, et voir si ca rentre sur la page.
+                               for($k=0; 
$k<count($HTML2PDF_TABLEAU[$param['num']]['cases']); $k++)
+                               {
+                                       // si c'est des lignes du thead ou du 
tfoot : on passe
+                                       if (in_array($k, 
$HTML2PDF_TABLEAU[$param['num']]['thead']['tr'])) continue;
+                                       if (in_array($k, 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'])) continue;
+
+                                       // hauteur de la ligne $k
+                                       $th = 0;
+                                       $h = 0;
+                                       for($i=0; 
$i<count($HTML2PDF_TABLEAU[$param['num']]['cases'][$k]); $i++)
+                                       {
+                                               $h = max($h, 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$k][$i]['h']);
+                                               
+                                               if 
($HTML2PDF_TABLEAU[$param['num']]['cases'][$k][$i]['rowspan']==1)
+                                                       $th = max($th, 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$k][$i]['h']);
+                                       }
+                       
+                                       // si la ligne ne rentre pas dans la 
page
+                                       // => la hauteur sur cette page est 
trouv\xE9e, et on passe \xE0 la page d'apres
+                                       if ($y+$h+$height>$max)
+                                       {
+                                               if ($height==$h0) $height = 
null;
+                                               
$HTML2PDF_TABLEAU[$param['num']]['height'][] = $height;
+                                               $height = $h0;                  
                        
+                                               $y = $this->margeTop;
+                                       }
+                                       $height+= $th;
+                               }
+                               // rajout du reste de tableau (si il existe) 
\xE0 la derniere page
+                               if ($height!=$h0 || $k==0) 
$HTML2PDF_TABLEAU[$param['num']]['height'][] = $height;
+                       }
+                       else
+                       {
+                               if 
(count($HTML2PDF_TABLEAU[$param['num']]['tfoot']['code']))
+                               {
+                                       $tmp_tr = 
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'];
+                                       $tmp_td = 
$HTML2PDF_TABLEAU[$param['num']]['td_curr'];
+                                       $OLD_parse_pos = $this->parse_pos;
+                                       $OLD_parse_code = $this->parsing->code;
+                                       
+                                       
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0];
+                                       
$HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0;
+                                       $this->parse_pos = 0;
+                                       $this->parsing->code = 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'];
+                                       $this->MakeHTMLcode();
+                                       
+                                       $this->parse_pos =      $OLD_parse_pos;
+                                       $this->parsing->code = $OLD_parse_code;
+                                       
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $tmp_tr;
+                                       
$HTML2PDF_TABLEAU[$param['num']]['td_curr'] = $tmp_td;
+                               }
+                                       
+                               // determination des coordonn\xE9es de sortie 
du tableau
+                               $x = $HTML2PDF_TABLEAU[$param['num']]['curr_x'] 
+ $HTML2PDF_TABLEAU[$param['num']]['width'];
+                               if 
(count($HTML2PDF_TABLEAU[$param['num']]['height'])>1)
+                                       $y = 
$this->margeTop+$HTML2PDF_TABLEAU[$param['num']]['height'][count($HTML2PDF_TABLEAU[$param['num']]['height'])-1];
+                               else if 
(count($HTML2PDF_TABLEAU[$param['num']]['height'])==1)
+                                       $y = 
$HTML2PDF_TABLEAU[$param['num']]['curr_y']+$HTML2PDF_TABLEAU[$param['num']]['height'][count($HTML2PDF_TABLEAU[$param['num']]['height'])-1];
+                               else
+                                       $y = 
$HTML2PDF_TABLEAU[$param['num']]['curr_y'];                                     
   
+
+                               // restauration des marges
+                               $this->loadMargin();
+                               
+                               // position de sortie du tableau
+                               $this->pdf->setX($x);
+                               $this->pdf->setY($y);
+                               $this->maxX = max($this->maxX, $x);
+                               $this->maxY = max($this->maxY, $y);
+                               if ($this->DEBUG_actif) $this->DEBUG_add('Table 
n\xB0'.$param['num'], false);
+                       }
+                       
+                       return true;
+               }
+
+                               
+               /**
+               * balise : COL
+               * mode : OUVERTURE (pas de fermeture)
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_COL($param)
+               {
+                       global $HTML2PDF_TABLEAU;
+                       $span = isset($param['span']) ? $param['span'] : 1;
+                       for($k=0; $k<$span; $k++)
+                               $HTML2PDF_TABLEAU[$param['num']]['cols'][] =  
$param;
+               }
+               
+               /**
+               * balise : TR
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TR($param, $other = 'tr')
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       global $HTML2PDF_TABLEAU; 
+
+                       // analyse du style
+                       $this->style->save();
+                       $this->style->analyse($other, $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       // positionnement dans le tableau
+                       $HTML2PDF_TABLEAU[$param['num']]['tr_curr']++;
+                       $HTML2PDF_TABLEAU[$param['num']]['td_curr']= 0;
+                       
+                       // si on est pas dans un sub_html
+                       if (!$this->sub_part)
+                       {
+                               // Y courant apres la ligne
+                               $ty=null;
+                               for($ii=0; 
$ii<count($HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1]);
 $ii++)
+                                       $ty = max($ty, 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$ii]['h']);
     
+                               
+                               $hfoot = 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['height'];
+                               
+                               // si la ligne ne rentre pas dans la page => 
nouvelle page
+                               if (!$this->isInTfoot && 
$HTML2PDF_TABLEAU[$param['num']]['td_y'] + 
$HTML2PDF_TABLEAU[$param['num']]['marge']['b'] + $ty +$hfoot> $this->pdf->h - 
$this->pdf->bMargin)
+                               {
+                                       if 
(count($HTML2PDF_TABLEAU[$param['num']]['tfoot']['code']))
+                                       {
+                                               $tmp_tr = 
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'];
+                                               $tmp_td = 
$HTML2PDF_TABLEAU[$param['num']]['td_curr'];
+                                               $OLD_parse_pos = 
$this->parse_pos;
+                                               $OLD_parse_code = 
$this->parsing->code;
+                                               
+                                               
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0];
+                                               
$HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0;
+                                               $this->parse_pos = 0;
+                                               $this->parsing->code = 
$HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'];
+                                               $this->isInTfoot = true;
+                                               $this->MakeHTMLcode();
+                                               $this->isInTfoot = false;
+                                               
+                                               $this->parse_pos =      
$OLD_parse_pos;
+                                               $this->parsing->code = 
$OLD_parse_code;
+                                               
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $tmp_tr;
+                                               
$HTML2PDF_TABLEAU[$param['num']]['td_curr'] = $tmp_td;
+                                       }
+                                       
+                                       
$HTML2PDF_TABLEAU[$param['num']]['new_page'] = true;
+                                       $this->setNewPage();
+
+                                       
$HTML2PDF_TABLEAU[$param['num']]['page']++;
+                                       
$HTML2PDF_TABLEAU[$param['num']]['curr_y'] = $this->pdf->getY();
+                                       
$HTML2PDF_TABLEAU[$param['num']]['td_y'] = 
$HTML2PDF_TABLEAU[$param['num']]['curr_y']+$HTML2PDF_TABLEAU[$param['num']]['marge']['t'];
+
+                                       // si la hauteur de cette partie a bien 
\xE9t\xE9 calcul\xE9e, on trace le cadre
+                                       if 
(isset($HTML2PDF_TABLEAU[$param['num']]['height'][$HTML2PDF_TABLEAU[$param['num']]['page']]))
+                                       {
+                                               $old = $this->style->value;
+                                               $this->style->value = 
$HTML2PDF_TABLEAU[$param['num']]['style_value'];
+
+                                               // initialisation du style des 
bordures de la premiere partie de tableau
+                                               $this->Rectangle(
+                                                               
$HTML2PDF_TABLEAU[$param['num']]['curr_x'],
+                                                               
$HTML2PDF_TABLEAU[$param['num']]['curr_y'],
+                                                               
$HTML2PDF_TABLEAU[$param['num']]['width'],
+                                                               
$HTML2PDF_TABLEAU[$param['num']]['height'][$HTML2PDF_TABLEAU[$param['num']]['page']],
+                                                               
$this->style->value['border'],
+                                                               
$this->style->value['padding'],
+                                                               
$HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5,
+                                                               
$this->style->value['background']
+                                                       );
+                                                                               
         
+                                               $this->style->value = $old;
+                                       }
+                               }
+                               
+                               if 
($HTML2PDF_TABLEAU[$param['num']]['new_page'] && 
count($HTML2PDF_TABLEAU[$param['num']]['thead']['code']))
+                               {
+                                       
$HTML2PDF_TABLEAU[$param['num']]['new_page'] = false;
+                                       $tmp_tr = 
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'];
+                                       $tmp_td = 
$HTML2PDF_TABLEAU[$param['num']]['td_curr'];
+                                       $OLD_parse_pos = $this->parse_pos;
+                                       $OLD_parse_code = $this->parsing->code;
+                                       
+                                       
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = 
$HTML2PDF_TABLEAU[$param['num']]['thead']['tr'][0];
+                                       
$HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0;
+                                       $this->parse_pos = 0;
+                                       $this->parsing->code = 
$HTML2PDF_TABLEAU[$param['num']]['thead']['code'];
+                                       $this->MakeHTMLcode();
+                                       
+                                       $this->parse_pos =      $OLD_parse_pos;
+                                       $this->parsing->code = $OLD_parse_code;
+                                       
$HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $tmp_tr;
+                                       
$HTML2PDF_TABLEAU[$param['num']]['td_curr'] = $tmp_td;
+                                       
$HTML2PDF_TABLEAU[$param['num']]['new_page'] = true;
+                               }
+                       }
+                       else
+                       {
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1]
 = array();
+                               if 
(!isset($HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']]))
+                                       
$HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']]
 = array();
+                                       
+                               $HTML2PDF_TABLEAU[$param['num']]['corr_x']=0;
+                               
while(isset($HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']][$HTML2PDF_TABLEAU[$param['num']]['corr_x']]))
+                                       
$HTML2PDF_TABLEAU[$param['num']]['corr_x']++;
+                       }                                                       
+                       
+                       return true;
+               }
+
+               /**
+               * balise : TR
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TR($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       global $HTML2PDF_TABLEAU; 
+
+                       // restauration du style
+                       $this->style->load();
+                       $this->style->FontSet();                        
+
+                       // si on est pas dans un sub_html
+                       if (!$this->sub_part)
+                       {
+                               // Y courant apres la ligne
+                               $ty=null;
+                               for($ii=0; 
$ii<count($HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1]);
 $ii++)
+                                       if 
($HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$ii]['rowspan']==1)
+                                               $ty = 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$ii]['h'];
       
+
+                               // mise \xE0 jour des coordonn\xE9es courantes
+                               $HTML2PDF_TABLEAU[$param['num']]['td_x'] = 
$HTML2PDF_TABLEAU[$param['num']]['curr_x']+$HTML2PDF_TABLEAU[$param['num']]['marge']['l'];
+                               $HTML2PDF_TABLEAU[$param['num']]['td_y']+= $ty;
+                               $HTML2PDF_TABLEAU[$param['num']]['new_page'] = 
false;
+                       }
+                       else
+                       {
+                               $HTML2PDF_TABLEAU[$param['num']]['corr_y']++;   
+                       }
+                       
+                       return true;
+               }
+
+               /**
+               * balise : TD
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TD($param, $other = 'td')
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       global $HTML2PDF_TABLEAU; 
+
+                       $param['cellpadding'] = 
$HTML2PDF_TABLEAU[$param['num']]['cellpadding'].'mm';
+                       $param['cellspacing'] = 
$HTML2PDF_TABLEAU[$param['num']]['cellspacing'].'mm';
+                       
+                       if ($other=='li')
+                       {
+                               $special_li = true;
+                       }
+                       else
+                       {
+                               $special_li = false;
+                               if ($other=='li_sub')
+                               {
+                                       $param['style']['border'] = 'none';
+                                       $param['style']['background-color']     
        = 'transparent';
+                                       $param['style']['background-image']     
        = 'none';
+                                       $param['style']['background-position']  
= '';
+                                       $param['style']['background-repeat']    
= '';
+                                       $other = 'li';
+                               }
+                       }
+
+                       // est-on en collapse, et egalement y-a-t'il des 
definitions de colonne
+                       $x = $HTML2PDF_TABLEAU[$param['num']]['td_curr'];
+                       $y = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1;
+                       $colspan = isset($param['colspan']) ? $param['colspan'] 
: 1;
+                       $rowspan = isset($param['rowspan']) ? $param['rowspan'] 
: 1;
+                       $collapse = false;
+                       if (in_array($other, array('td', 'th')))
+                       {
+                               $num_col = 
isset($HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Xr']) ? 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Xr'] : 
$HTML2PDF_TABLEAU[$param['num']]['corr_x'];
+                               
+                               // si une definition de colonne est presente
+                               if 
(isset($HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col]))
+                               {
+                                       // on la recupere
+                                       $col_param = 
$HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col];
+                                       
+                                       // pour les colspan, on recupere toutes 
les largeurs
+                                       $col_param['style']['width'] = array();
+                                       for($k=0; $k<$colspan; $k++)
+                                       {
+                                               if 
(isset($HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col+$k]['style']['width']))
+                                                       
$col_param['style']['width'][] = 
$HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col+$k]['style']['width'];
+                                       }
+                                       
+                                       // on les somme
+                                       $total = '';
+                                       $last = $this->style->getLastWidth();
+                                       if (count($col_param['style']['width']))
+                                       {
+                                               $total = 
$col_param['style']['width'][0]; unset($col_param['style']['width'][0]);
+                                               
foreach($col_param['style']['width'] as $width)
+                                               {
+                                                       if (substr($total, 
-1)=='%' && substr($width, -1)=='%')
+                                                               $total = 
(str_replace('%', '', $total)+str_replace('%', '', $width)).'%';
+                                                       else
+                                                               $total = 
($this->style->ConvertToMM($total, $last) + $this->style->ConvertToMM($width, 
$last)).'mm';
+                                               }
+                                       }
+                                       
+                                       // et on recupere la largeur finale
+                                       if ($total)
+                                               $col_param['style']['width'] = 
$total;
+                                       else
+                                               
unset($col_param['style']['width']);
+                                       
+                                       
+                                       // on merge les 2 styles (col + td)
+                                       $param['style'] = 
array_merge($col_param['style'], $param['style']);
+                                       
+                                       // si une classe est d\xE9finie, on la 
merge egalement
+                                       if (isset($col_param['class']))
+                                               $param['class'] = 
$col_param['class'].(isset($param['class']) ? ' '.$param['class'] : '');
+                               }
+                               
+                               $collapse = 
isset($this->style->value['border']['collapse']) ? 
$this->style->value['border']['collapse'] : false;
+                       }
+
+
+                       // analyse du style
+                       $this->style->save();
+                       $this->style->analyse($other, $param);
+
+                       if ($special_li)
+                       {
+                               $this->style->value['width']-= 
$this->style->ConvertToMM($this->listeGetWidth());
+                               $this->style->value['width']-= 
$this->style->ConvertToMM($this->listeGetPadding());
+                       }
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       // si on est en collapse : modification du style
+                       if ($collapse)
+                       {
+                               if (!$this->sub_part)
+                               {
+                                       if 
($HTML2PDF_TABLEAU[$param['num']]['tr_curr']>1 && 
!$HTML2PDF_TABLEAU[$param['num']]['new_page'])
+                                               
$this->style->value['border']['t'] = $this->style->readBorder('none');          
                
+                               }
+                       
+                               if 
($HTML2PDF_TABLEAU[$param['num']]['td_curr']>0)
+                                       $this->style->value['border']['l'] = 
$this->style->readBorder('none');  
+                       }       
+                       
+                       $marge = array();
+                       $marge['t'] = 
$this->style->value['padding']['t']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['t']['width'];
+                       $marge['r'] = 
$this->style->value['padding']['r']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['r']['width'];
+                       $marge['b'] = 
$this->style->value['padding']['b']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['b']['width'];
+                       $marge['l'] = 
$this->style->value['padding']['l']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['l']['width'];
+
+                       // si on est dans un sub_html
+                       if ($this->sub_part)
+                       {
+                               // on se positionne dans le tableau
+                               $HTML2PDF_TABLEAU[$param['num']]['td_curr']++;
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x] = array();
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['w'] = 0;
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['h'] = 0;
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['dw'] = 0;
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['colspan'] = $colspan;
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['rowspan'] = $rowspan;
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Xr'] = 
$HTML2PDF_TABLEAU[$param['num']]['corr_x'];
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Yr'] = 
$HTML2PDF_TABLEAU[$param['num']]['corr_y'];
+                               
+                               for($j=0; $j<$rowspan; $j++)
+                               {
+                                       for($i=0; $i<$colspan; $i++)
+                                       {
+                                               
$HTML2PDF_TABLEAU[$param['num']]['corr']
+                                                       
[$HTML2PDF_TABLEAU[$param['num']]['corr_y']+$j]
+                                                       
[$HTML2PDF_TABLEAU[$param['num']]['corr_x']+$i] = ($i+$j>0) ? '' : 
array($x,$y,$colspan,$rowspan);
+                                       }
+                               }
+                               $HTML2PDF_TABLEAU[$param['num']]['corr_x']+= 
$colspan;
+                               
while(isset($HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']][$HTML2PDF_TABLEAU[$param['num']]['corr_x']]))
+                                       
$HTML2PDF_TABLEAU[$param['num']]['corr_x']++;
+
+                               // on extrait tout ce qui est contenu dans le 
TD                                
+                               $res = 
$this->parsing->getLevel($this->temp_pos);
+                               
+                               // on en cr\xE9\xE9 un sous HTML que l'on 
transforme en PDF
+                               // pour analyse les dimensions
+                               // et les r\xE9cup\xE9rer dans le tableau 
global.
+                               $this->CreateSubHTML($this->sub_html);
+                               $this->sub_html->writeHTML($res[1]);
+                               $this->temp_pos = $res[0]-2;
+                       }
+                       else
+                       {
+                               // on se positionne dans le tableau
+                               $HTML2PDF_TABLEAU[$param['num']]['td_curr']++;
+                               $HTML2PDF_TABLEAU[$param['num']]['td_x']+= 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['dw'];
+                               
+                               // initialisation du style des bordures de la 
premiere partie de tableau
+                               $this->Rectangle(
+                                               
$HTML2PDF_TABLEAU[$param['num']]['td_x'],
+                                               
$HTML2PDF_TABLEAU[$param['num']]['td_y'],
+                                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['w'],
+                                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['h'],
+                                               $this->style->value['border'],
+                                               $this->style->value['padding'],
+                                               
$HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5,
+                                               
$this->style->value['background']
+                                       );
+                               
+
+                               $this->style->value['width'] = 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['w'] - $marge['l'] - 
$marge['r'];
+
+                               // limitation des marges aux dimensions de la 
case
+                               $mL = 
$HTML2PDF_TABLEAU[$param['num']]['td_x']+$marge['l'];
+                               $mR = $this->pdf->w - $mL - 
$this->style->value['width'];
+                               $this->saveMargin($mL, 0, $mR);
+                               
+                               // positionnement en fonction
+                               $h_corr = 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['h'];
+                               $h_reel = 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['real_h'];
+                               switch($this->style->value['vertical-align'])
+                               {
+                                       case 'bottom':
+                                               $y_corr = $h_corr-$h_reel;
+                                               break;
+                                               
+                                       case 'middle':
+                                               $y_corr = ($h_corr-$h_reel)*0.5;
+                                               break;
+                                               
+                                       case 'top':
+                                       default:
+                                               $y_corr = 0;
+                                               break;  
+                               }
+
+                               
$this->pdf->setX($HTML2PDF_TABLEAU[$param['num']]['td_x']+$marge['l']);
+                               
$this->pdf->setY($HTML2PDF_TABLEAU[$param['num']]['td_y']+$marge['t']+$y_corr);
+                               $this->setNewPositionForNewLine();
+                       }
+                       
+                       return true;
+               }
+
+               /**
+               * balise : TD
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TD($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       global $HTML2PDF_TABLEAU; 
+
+                       // r\xE9cup\xE9ration de la marge
+                       $marge = array();
+                       $marge['t'] = 
$this->style->value['padding']['t']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['t']['width'];
+                       $marge['r'] = 
$this->style->value['padding']['r']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['r']['width'];
+                       $marge['b'] = 
$this->style->value['padding']['b']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['b']['width'];
+                       $marge['l'] = 
$this->style->value['padding']['l']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['l']['width'];
+                       $marge['t']+= 0.01;
+                       $marge['r']+= 0.01;
+                       $marge['b']+= 0.01;
+                       $marge['l']+= 0.01;
+
+                       // si on est dans un sub_html
+                       if ($this->sub_part)
+                       {
+                               if ($this->testTDin1page && 
$this->sub_html->pdf->page>1) @HTML2PDF::makeError(7, __FILE__, __LINE__); 
+                               
+                               // dimentions de cette case
+                               $w0 = $this->sub_html->maxX + $marge['l'] + 
$marge['r'];
+                               $h0 = $this->sub_html->maxY + $marge['t'] + 
$marge['b'];
+       
+                               // dimensions impos\xE9es par le style
+                               $w2 = $this->style->value['width'] + 
$marge['l'] + $marge['r'];
+                               $h2 = $this->style->value['height'] + 
$marge['t'] + $marge['b'];
+       
+                               // dimension finale de la case = max des 2 
ci-dessus
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['w']
 = max(array($w0, $w2));
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['h']
 = max(array($h0, $h2));
+
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['real_w']
 = $w0;
+                               
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['real_h']
 = $h0;
+
+                               // suppresion du sous_html
+                               $this->DestroySubHTML();
+                       }
+                       else
+                       {
+                               $this->loadMargin();
+                               //positionnement
+                               $HTML2PDF_TABLEAU[$param['num']]['td_x']+= 
$HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['w'];
+                       }
+
+                       // restauration du style
+                       $this->style->load();
+                       $this->style->FontSet();        
+                       
+                       return true;
+               }
+               
+               function calculTailleCases(&$cases, &$corr)
+               {
+/*                     // construction d'un tableau de correlation
+                       $corr = array();
+
+                       // on fait correspondre chaque case d'un tableau 
norm\xE9 aux cases r\xE9elles, en prennant en compte les colspan et rowspan
+                       $Yr=0;
+                       for($y=0; $y<count($cases); $y++)
+                       {
+                               $Xr=0;  while(isset($corr[$Yr][$Xr])) $Xr++;
+                               
+                               for($x=0; $x<count($cases[$y]); $x++)
+                               {
+                                       for($j=0; $j<$cases[$y][$x]['rowspan']; 
$j++)
+                                       {
+                                               for($i=0; 
$i<$cases[$y][$x]['colspan']; $i++)
+                                               {
+                                                       $corr[$Yr+$j][$Xr+$i] = 
($i+$j>0) ? '' : array($x, $y, $cases[$y][$x]['colspan'], 
$cases[$y][$x]['rowspan']);
+                                               }
+                                       }
+                                       $Xr+= $cases[$y][$x]['colspan'];
+                                       while(isset($corr[$Yr][$Xr])) $Xr++;
+                               }
+                               $Yr++;
+                       }
+*/                     
+                       if (!isset($corr[0])) return true;
+                       
+                       // on d\xE9termine, pour les cases sans colspan, la 
largeur maximale de chaque colone
+                       $sw = array();
+                       for($x=0; $x<count($corr[0]); $x++)
+                       {
+                               $m=0;
+                               for($y=0; $y<count($corr); $y++)
+                                       if (isset($corr[$y][$x]) && 
is_array($corr[$y][$x]) && $corr[$y][$x][2]==1)
+                                               $m = max($m, 
$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']);                          
+                               $sw[$x] = $m;   
+                       }
+
+                       // on v\xE9rifie que cette taille est valide avec les 
colones en colspan
+                       for($x=0; $x<count($corr[0]); $x++)
+                       {
+                               for($y=0; $y<count($corr); $y++)
+                               {
+                                       if (isset($corr[$y][$x]) && 
is_array($corr[$y][$x]) && $corr[$y][$x][2]>1)
+                                       {
+                                               // somme des colonnes 
correspondant au colspan
+                                               $s = 0; for($i=0; 
$i<$corr[$y][$x][2]; $i++) $s+= $sw[$x+$i];
+                                               
+                                               // si la somme est 
inf\xE9rieure \xE0 la taille necessaire => r\xE8gle de 3 pour adapter
+                                               if ($s>0 && 
$s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'])
+                                                       for($i=0; 
$i<$corr[$y][$x][2]; $i++)
+                                                               $sw[$x+$i] = 
$sw[$x+$i]/$s*$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'];
+                                       }
+                               }
+                       }
+
+                       // on applique les nouvelles largeurs
+                       for($x=0; $x<count($corr[0]); $x++)
+                       {
+                               for($y=0; $y<count($corr); $y++)
+                               {
+                                       if (isset($corr[$y][$x]) && 
is_array($corr[$y][$x]))
+                                       {
+                                               if ($corr[$y][$x][2]==1)
+                                               {
+                                                       
$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'] = $sw[$x];
+                                               }
+                                               else
+                                               {
+                                                       // somme des colonnes 
correspondant au colspan
+                                                       $s = 0; for($i=0; 
$i<$corr[$y][$x][2]; $i++) $s+= $sw[$x+$i];
+                                                       
$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'] = $s;
+                                               }
+                                       }
+                               }
+                       }
+
+                       // on d\xE9termine, pour les cases sans rowspan, la 
hauteur maximale de chaque colone
+                       $sh = array();
+                       for($y=0; $y<count($corr); $y++)
+                       {
+                               $m=0;
+                               for($x=0; $x<count($corr[0]); $x++)
+                                       if (isset($corr[$y][$x]) && 
is_array($corr[$y][$x]) && $corr[$y][$x][3]==1)
+                                               $m = max($m, 
$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']);
+                               $sh[$y] = $m;   
+                       }
+
+
+                       // on v\xE9rifie que cette taille est valide avec les 
lignes en rowspan
+                       for($y=0; $y<count($corr); $y++)
+                       {
+                               for($x=0; $x<count($corr[0]); $x++)
+                               {
+                                       if (isset($corr[$y][$x]) && 
is_array($corr[$y][$x]) && $corr[$y][$x][3]>1)
+                                       {
+                                               // somme des colonnes 
correspondant au colspan
+                                               $s = 0; for($i=0; 
$i<$corr[$y][$x][3]; $i++) $s+= $sh[$y+$i];
+                                               
+                                               // si la somme est 
inf\xE9rieure \xE0 la taille necessaire => r\xE8gle de 3 pour adapter
+                                               if ($s>0 && 
$s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'])
+                                                       for($i=0; 
$i<$corr[$y][$x][3]; $i++)
+                                                               $sh[$y+$i] = 
$sh[$y+$i]/$s*$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'];
+                                       }
+                               }
+                       }
+                       
+
+                       // on applique les nouvelles hauteurs
+                       for($y=0; $y<count($corr); $y++)
+                       {
+                               for($x=0; $x<count($corr[0]); $x++)
+                               {
+                                       if (isset($corr[$y][$x]) && 
is_array($corr[$y][$x]))
+                                       {
+                                               if ($corr[$y][$x][3]==1)
+                                               {
+                                                       
$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'] = $sh[$y];
+                                               }
+                                               else
+                                               {
+                                                       // somme des lignes 
correspondant au rowspan
+                                                       $s = 0; for($i=0; 
$i<$corr[$y][$x][3]; $i++) $s+= $sh[$y+$i];
+                                                       
$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h'] = $s;
+                                                       
+                                                       for($j=1; 
$j<$corr[$y][$x][3]; $j++)
+                                                       {
+                                                               $tx = $x+1;
+                                                               $ty = $y+$j;
+                                                               for(true; 
isset($corr[$ty][$tx]) && !is_array($corr[$ty][$tx]); $tx++);
+                                                               if 
(isset($corr[$ty][$tx])) $cases[$corr[$ty][$tx][1]][$corr[$ty][$tx][0]]['dw']+= 
$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w'];
+                                                                               
                                                        
+                                                       }
+                                               }
+                                       }
+                               }
+                       }               
+               }
+
+               /**
+               * balise : TH
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TH($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       // identique \xE0 TD mais en gras
+                       if (!isset($param['style']['font-weight'])) 
$param['style']['font-weight'] = 'bold';
+                       $this->o_TD($param, 'th');
+                       
+                       return true;
+               }       
+
+               /**
+               * balise : TH
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TH($param)
+               {
+                       if ($this->forOneLine) return false;
+
+                       $this->maxH = 0;
+                       // identique \xE0 TD
+                       $this->c_TD($param);                    
+                       
+                       return true;
+               }
+
+               /**
+               * balise : IMG
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_IMG($param)
+               {
+                       // analyse du style
+                       $src    = str_replace('&amp;', '&', $param['src']);     
+
+                       $this->style->save();
+                       $this->style->value['width']    = 0;
+                       $this->style->value['height']   = 0;
+                       $this->style->value['border']   = array(
+                                                                               
                        'type'  => 'none',
+                                                                               
                        'width' => 0,
+                                                                               
                        'color' => array(0, 0, 0),
+                                                                               
                );
+                       $this->style->value['background'] = array(
+                                                                               
                        'color'         => null,
+                                                                               
                        'image'         => null,
+                                                                               
                        'position'      => null,
+                                                                               
                        'repeat'        => null
+                                                                               
                );
+                       $this->style->analyse('img', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+
+                       // affichage de l'image                 
+                       $this->Image($src, isset($param['sub_li']));
+
+                       // restauration du style
+                       $this->style->load();
+                       $this->style->FontSet();        
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : SELECT
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_SELECT($param)
+               {
+                       // preparation du champs
+                       if (!isset($param['name']))             $param['name']  
= 'champs_pdf_'.(count($this->lstChamps)+1);
+                       
+                       $param['name'] = strtolower($param['name']);
+                       
+                       if (isset($this->champs[$param['name']]))
+                               $this->champs[$param['name']]++;
+                       else
+                               $this->champs[$param['name']] = 1;
+                               
+                       $this->style->save();
+                       $this->style->analyse('select', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       $this->lstSelect = array();
+                       $this->lstSelect['name']        = $param['name'];
+                       $this->lstSelect['multi']       = 
isset($param['multiple']) ? true : false;
+                       $this->lstSelect['size']        = isset($param['size']) 
? $param['size'] : 1;
+                       $this->lstSelect['options']     = array();
+
+                       if ($this->lstSelect['multi'] && 
$this->lstSelect['size']<3) $this->lstSelect['size'] = 3;
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : OPTION
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_OPTION($param)
+               {
+                       // on extrait tout ce qui est contenu dans l'option
+                       $res = $this->parsing->getLevel($this->parse_pos);
+                       $this->parse_pos = $res[0]-2;
+                       $texte = $res[1];
+                       $value = isset($param['value']) ? $param['value'] : 
'auto_opt_'.(count($this->lstSelect)+1);
+                       
+                       $this->lstSelect['options'][$value] = $texte;
+                       
+                       return true;
+               }
+               
+               /**
+               * balise : OPTION
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_OPTION($param) { return true; }
+                               
+               /**
+               * balise : SELECT
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_SELECT()
+               {
+                       // position d'affichage
+                       $x = $this->pdf->getX();
+                       $y = $this->pdf->getY();
+                       $f = 1.08*$this->style->value['font-size'];
+
+                       $w = $this->style->value['width']; if (!$w) $w = 50; 
+                       $h = ($f*1.07*$this->lstSelect['size'] + 1);
+                       $prop = array();
+                       if ($this->lstSelect['multi']) 
$prop['multipleSelection'] = true;
+                       $this->pdf->form_Select($this->lstSelect['name'], $x, 
$y, $w, $h, $this->lstSelect['options'], $this->lstSelect['size']>1, $prop);
+                                                       
+                       $this->maxX = max($this->maxX, $x+$w);
+                       $this->maxY = max($this->maxY, $y+$h);
+                       $this->maxH = max($this->maxH, $h);
+                       $this->pdf->setX($x+$w);
+                       
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       $this->lstSelect = array();
+                       
+                       return true;
+               }
+
+               /**
+               * balise : TEXTAREA
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_TEXTAREA($param)
+               {
+                       // preparation du champs
+                       if (!isset($param['name']))             $param['name']  
= 'champs_pdf_'.(count($this->lstChamps)+1);
+                       
+                       $param['name'] = strtolower($param['name']);
+                       
+                       if (isset($this->champs[$param['name']]))
+                               $this->champs[$param['name']]++;
+                       else
+                               $this->champs[$param['name']] = 1;
+                               
+                       $this->style->save();
+                       $this->style->analyse('textarea', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+
+                       // position d'affichage
+                       $x = $this->pdf->getX();
+                       $y = $this->pdf->getY();
+                       $fx = 0.65*$this->style->value['font-size'];
+                       $fy = 1.08*$this->style->value['font-size'];
+
+                       // on extrait tout ce qui est contenu dans le textarea
+                       $res = $this->parsing->getLevel($this->parse_pos);
+                       $this->parse_pos = $res[0]-2;
+                       $texte = $res[1];
+
+                       $w = $fx*(isset($param['cols']) ? $param['cols'] : 
22)+1; 
+                       $h = $fy*1.07*(isset($param['rows']) ? $param['rows'] : 
3)+3;
+                       
+//                     if ($this->style->value['width']) $w = 
$this->style->value['width'];
+//                     if ($this->style->value['height']) $h = 
$this->style->value['height'];
+                       
+                       $prop = array();
+                       $prop['value'] = $texte;
+                       $prop['multiline'] = true;
+                       
+                       $this->pdf->form_InputText($param['name'], $x, $y, $w, 
$h, $prop);
+                                       
+                       $this->maxX = max($this->maxX, $x+$w);
+                       $this->maxY = max($this->maxY, $y+$h);
+                       $this->maxH = max($this->maxH, $h);
+                       $this->pdf->setX($x+$w);
+                                       
+                       return true;
+               }
+               
+               /**
+               * balise : TEXTAREA
+               * mode : FERMETURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function c_TEXTAREA()
+               {
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+                                               
+               /**
+               * balise : INPUT
+               * mode : OUVERTURE
+               * 
+               * @param        array   param\xE8tres de l'\xE9l\xE9ment de 
parsing
+               * @return       null
+               */      
+               function o_INPUT($param)
+               {
+                       // preparation du champs
+                       if (!isset($param['name']))             $param['name']  
= 'champs_pdf_'.(count($this->lstChamps)+1);
+                       if (!isset($param['value']))    $param['value'] = '';
+                       if (!isset($param['type']))             $param['type']  
= 'text';
+                       
+                       $param['name'] = strtolower($param['name']);
+                       $param['type'] = strtolower($param['type']);
+
+                       if (!in_array($param['type'], array('text', 'checkbox', 
'radio', 'hidden', 'submit', 'reset', 'button'))) $param['type'] = 'text';
+
+                       if (isset($this->champs[$param['name']]))
+                               $this->champs[$param['name']]++;
+                       else
+                               $this->champs[$param['name']] = 1;
+
+                       $this->style->save();
+                       $this->style->analyse('input', $param);
+                       $this->style->setPosition($this->pdf->x, $this->pdf->y);
+                       $this->style->FontSet();
+                       
+                       $name = $param['name'];
+               
+                       // position d'affichage
+                       $x = $this->pdf->getX();
+                       $y = $this->pdf->getY();
+                       $f = 1.08*$this->style->value['font-size'];
+                       
+                       switch($param['type'])
+                       {
+                               case 'checkbox':
+                                       $w = 3;
+                                       $h = $w;
+                                       if ($h<$f) $y+= ($f-$h)*0.5;
+                                       $this->pdf->form_InputCheckBox($name, 
$x, $y, $w, isset($param['checked']));
+                                       break;
+                               
+                               case 'radio':
+                                       $w = 3;
+                                       $h = $w;
+                                       if ($h<$f) $y+= ($f-$h)*0.5;
+                                       $this->pdf->form_InputRadio($name, $x, 
$y, $w);
+                                       break;
+                                       
+                               case 'hidden':
+                                       $w = 0;
+                                       $h = 0;
+                                       $this->pdf->form_InputHidden($name, 
$param['value']);
+                                       break;
+                                       
+                               case 'text':
+                                       $w = $this->style->value['width']; if 
(!$w) $w = 40; 
+                                       $h = $f*1.3;
+                                       $prop = array();
+                                       $prop['value'] = $param['value'];
+                                       $this->pdf->form_InputText($name, $x, 
$y, $w, $h, $prop);
+                                       break;
+
+                               case 'submit':
+                               case 'reset':
+                               case 'button':
+                                       $action = isset($param['onclick']) ? 
$param['onclick'] : '';
+                                       $w = $this->style->value['width'];      
if (!$w) $w = 40; 
+                                       $h = $this->style->value['height'];     
if (!$h) $h = $f*1.3;
+                                       $prop = array();
+                                       $this->pdf->form_InputButton($name, $x, 
$y, $w, $h, $param['value'], $action, $prop);
+                                       break;
+                                       
+                               default:
+                                       $w = 0;
+                                       $h = 0;
+                                       break;
+                       }
+                       
+                       $this->maxX = max($this->maxX, $x+$w);
+                       $this->maxY = max($this->maxY, $y+$h);
+                       $this->maxH = max($this->maxH, $h);
+                       $this->pdf->setX($x+$w);
+                       
+                       $this->style->load();
+                       $this->style->FontSet();
+                       
+                       return true;
+               }
+               
+               function CreateIndex($titre = 'Index', $size_title = 20, 
$size_bookmark = 15, $bookmark_title = true, $display_page = true)
+               {
+                       $this->pdf->CreateIndex($this, $titre, $size_title, 
$size_bookmark, $bookmark_title, $display_page);
+               }
+               
+               function textLOAD($langue)
+               {
+                       if (!preg_match('/^([a-z0-9]+)$/isU', $langue))
+                       {
+                               echo 'ERROR : language code <b>'.$langue.'</b> 
incorrect.';
+                               exit;
+                       }
+                       
+                       $file = 
dirname(__FILE__).'/langues/'.strtolower($langue).'.txt';
+                       if (!is_file($file))
+                       {
+                               echo 'ERROR : language code <b>'.$langue.'</b> 
unknown.<br>';
+                               echo 'You can create the translation file 
<b>'.$file.'</b> and send it to me in order to integrate it into a future 
version.';
+                               exit;                           
+                       }
+                       
+                       $texte = array();
+                       $infos = file($file);
+                       foreach($infos as $val)
+                       {
+                               $val = trim($val);
+                               $val = explode("\t", $val);
+                               if (count($val)<2) continue;
+                               
+                               $t_k = trim($val[0]); unset($val[0]);
+                               $t_v = trim(implode(' ', $val));
+                               if ($t_k && $t_v) $texte[$t_k] = $t_v;
+                       }
+                       global $HTML2PDF_TEXTE_FILE;
+                       $HTML2PDF_TEXTE_FILE = $texte;  
+               }
+               
+               function textGET($key)
+               {
+                       global $HTML2PDF_TEXTE_FILE;
+                       if (!isset($HTML2PDF_TEXTE_FILE[$key])) return '######';
+                       
+                       return $HTML2PDF_TEXTE_FILE[$key];
+               }
+               
+               function makeError($err, $file, $line, $other = null, $html = 
'')
+               {
+                       $msg = '';
+                       switch($err)
+                       {
+                               case 1:
+                                       $msg = (@HTML2PDF::textGET('err01'));
+                                       $msg = str_replace('[[OTHER]]', $other, 
$msg); 
+                                       break;
+                                       
+                               case 2:
+                                       $msg = (@HTML2PDF::textGET('err02'));
+                                       $msg = str_replace('[[OTHER_0]]', 
$other[0], $msg); 
+                                       $msg = str_replace('[[OTHER_1]]', 
$other[1], $msg); 
+                                       $msg = str_replace('[[OTHER_2]]', 
$other[2], $msg); 
+                                       break;
+                                       
+                               case 3:
+                                       $msg = (@HTML2PDF::textGET('err03'));
+                                       $msg = str_replace('[[OTHER]]', $other, 
$msg); 
+                                       break;
+                                       
+                               case 4:
+                                       $msg = (@HTML2PDF::textGET('err04'));
+                                       $msg = str_replace('[[OTHER]]', 
print_r($other, true), $msg); 
+                                       break;
+                                       
+                               case 5:
+                                       $msg = (@HTML2PDF::textGET('err05'));
+                                       $msg = str_replace('[[OTHER]]', 
print_r($other, true), $msg); 
+                                       break;
+                                       
+                               case 6:
+                                       $msg = (@HTML2PDF::textGET('err06'));
+                                       $msg = str_replace('[[OTHER]]', $other, 
$msg); 
+                                       break;  
+                                       
+                               case 7:
+                                       $msg = (@HTML2PDF::textGET('err07'));
+                                       break;  
+                       }
+                       echo '<span style="color: #AA0000; font-weight: 
bold;">'.(@HTML2PDF::textGET('txt01')).$err.'</span><br>';
+                       echo (@HTML2PDF::textGET('txt02')).' '.$file.'<br>';
+                       echo (@HTML2PDF::textGET('txt03')).' '.$line.'<br>';
+                       echo '<br>';
+                       echo $msg;
+                       echo '<br>';
+                       if ($html) echo '<br>HTML : 
...'.htmlentities($html).'...';
+                       exit;   
+               }
+       }
+}


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/html2pdf.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/ca.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/ca.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/ca.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  L'etiqueta <b>&lt;[[OTHER]]&gt;</b> encara no existeix.<br><br>Si voleu 
afegir-la, heu de crear els m\xE8todes <b>o_[[OTHER]]</b> (per l'obertura) i 
<b>c_[[OTHER]]</b> (pel tancament) seguint el model de les etiquetes 
existents.<br><br>A m\xE9s, si creeu nous m\xE8todes, envieu-ho a 
address@hidden per tal d'afegir-los a les seg\xFCents versions d'HTML2PDF, i 
que tothom en pugui gaudir.
+err02  Frase de 1000 l\xEDnies => massa llarga<br><b>Frase :</b> 
[[OTHER_0]]<br><b>Mida casella :</b> [[OTHER_1]]<br><b>Mida text :</b> 
[[OTHER_2]]<br>
+err03  Codi HTML no v\xE0lid, una etiqueta t\xE9 un tancament de m\xE9s : 
<b>&lt;[[OTHER]]&gt;</b>
+err04  Codi HTML no v\xE0lid, les etiquetes no estan tancades en l'ordre 
correcte.<br>Estat : <pre>[[OTHER]]</pre>
+err05  Codi HTML no v\xE0lid, totes les etiquetes han de tenir el seu 
tancament.<br>Estat : <pre>[[OTHER]]</pre>
+err06  Impossible carregar la imatge <b>[[OTHER]]</b>
+err07  El contenido de una etiqueta TD no encaja en una sola p\xE1gina
+txt01  ERROR n\xB0
+txt02  Fitxer :
+txt03  L\xEDnia :
+pdf01  Document generat el [[date_d]]/[[date_m]]/[[date_y]]
+pdf02  Document generat a les [[date_h]]:[[date_i]]
+pdf03  Document generat el [[date_d]]/[[date_m]]/[[date_y]] a les 
[[date_h]]:[[date_i]]
+pdf04  P\xE0gina [[current]]/[[nb]]
+pdf05  Els formularis requereixen l'\xFAs de l'Adobe Reader 9
+vue01  ENCABEZAR
+vue02  PEU DE P\xC0GINA
+vue03  P\xC0GINA
+vue04  Visualitzaci\xF3


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/ca.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/da.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/da.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/da.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  Tag <b>&lt;[[OTHER]]&gt;</b> endnu ikke eksisterer.<br><br>Hvis du 
\xF8nsker at tilf\xF8je det, skal du oprette de metoder <b>o_[[OTHER]]</b> (for 
\xE5bning) og <b>c_[[OTHER]]</b> (for lukning) ved at f\xF8lge den model af 
eksisterende tags.<br><br>Hvis du opretter disse metoder, s\xE5 t\xF8v ikke med 
at send mig en e-mail til address@hidden til indsat dem i den n\xE6ste version 
af HTML2PDF.
+err02  S\xE6tning af 1000 lines => er for lang<br><b>s\xE6tning :</b> 
[[OTHER_0]]<br><b>Bredde boksen :</b> [[OTHER_1]]<br><b>L\xE6ngde tekst :</b> 
[[OTHER_2]]<br>
+err03  HTML-kode er ugyldig, et tag er lukket for mange gange: 
<b>&lt;[[OTHER]]&gt;</b>
+err04  HTML-kode er ugyldig, tags er ikke afsluttet p\xE5 en ordentlig 
m\xE5de.<br>Status : <pre>[[OTHER]]</pre>
+err05  HTML-kode er ugyldig, alle tags skal lukkes. <br>Status : 
<pre>[[OTHER]]</pre>
+err06  Umuligt at indl\xE6se billedet <b>[[OTHER]]</b>
+err07  Indholdet af en TD tag ikke passer p\xE5 \xE9n side
+txt01  FEJL n\xB0
+txt02  File :
+txt03  Linje :
+pdf01  Siden oprettet d. [[date_y]]-[[date_m]]-[[date_d]]
+pdf02  Siden oprettet d. [[date_h]]:[[date_i]]
+pdf03  Siden oprettet d. [[date_y]]-[[date_m]]-[[date_d]] at 
[[date_h]]:[[date_i]]
+pdf04  Side [[current]]/[[nb]]
+pdf05  De formularer kr\xE6ver brug af Adobe Reader 9
+vue01  HEADER
+vue02  FOOTER
+vue03  PAGE
+vue04  View


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/da.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/de.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/de.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/de.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  Das Tag <b>&lt;[[OTHER]]&gt;</b> existiert noch nicht.<br><br>Wenn Sie 
es hinzuf\xFCgen m\xF6chten, sollen Sie die Methoden<b>o_[[OTHER]]</b> (zu 
\xF6ffnen) und <b>c_[[OTHER]]</b> (zu schlie\xDFen) nach dem Modell den 
existierenden Tags.<br><br>Wenn Sie diese Methoden au\xDFerdem aufbauen, bitte 
teilen Sie sie duch eine E-Mail an meine Adresse : address@hidden, so da\xDF 
sie k\xFCnftig in die n\xE4chste Version von HTML2PDF erscheinen.
+err02  1000-Linien Satz => zu lang<br><b>Satz :</b> [[OTHER_0]]<br><b>Breite 
des Eingabefelds :</b> [[OTHER_1]]<br><b>L\xE4nge des Texts :</b> 
[[OTHER_2]]<br>
+err03  Falsches HTML Code, \xFCberz\xE4hliges geschlo\xDFene Tag : 
<b>&lt;[[OTHER]]&gt;</b>
+err04  Falsches HTML Code, die Tags sind nicht in richtiger Ordnung 
geschlo\xDFen.<br>Status : <pre>[[OTHER]]</pre>
+err05  Falsches HTML Code, alle Tags sollen geschlo\xDFen sein.<br>Status : 
<pre>[[OTHER]]</pre>
+err06  Ladung des Bilds unm\xF6glich <b>[[OTHER]]</b>
+err07  Er Inhalt eines TD-Tag passt nicht nur auf einer Seite
+txt01  Fehler n\xB0
+txt02  Datei :
+txt03  Linie :
+pdf01  Datei aufgebaut am [[date_d]]/[[date_m]]/[[date_y]]
+pdf02  Datei aufgebaut um [[date_h]]:[[date_m]]
+pdf03  Datei aufgebaut am [[date_d]]/[[date_m]]/[[date_y]] um 
[[date_h]]:[[date_i]]
+pdf04  Seite [[current]]/[[nb]]
+pdf05  Die Formulare ben\xF6tigen Sie den Adobe Reader 9
+vue01  Seite-Header
+vue02  Fu\xDFzeile
+vue03  Seite
+vue04  Visualisierung


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/de.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/en.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/en.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/en.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  The tag <b>&lt;[[OTHER]]&gt;</b> does not yet exist.<br><br>If you want 
to add it, you must create the methods <b>o_[[OTHER]]</b> (for opening) and 
<b>c_[[OTHER]]</b> (for closure) by following the model of existing 
tags.<br><br>If you create these methods, do not hesitate to send me an email 
to address@hidden to included them in the next version of HTML2PDF.
+err02  Sentence of 1000 lines => too long<br><b>Sentence :</b> 
[[OTHER_0]]<br><b>Width box :</b> [[OTHER_1]]<br><b>Length text :</b> 
[[OTHER_2]]<br>
+err03  HTML code invalid, a tag is closed too many times: 
<b>&lt;[[OTHER]]&gt;</b>
+err04  HTML code invalid, the tags are not closed in an orderly 
fashion.<br>Status : <pre>[[OTHER]]</pre>
+err05  HTML code invalid, all tags must be closed.<br>Status : 
<pre>[[OTHER]]</pre>
+err06  Impossible to load the image <b>[[OTHER]]</b>
+err07  The content of a TD tag does not fit on only one page
+txt01  ERROR n\xB0
+txt02  File :
+txt03  Line :
+pdf01  Document generated on [[date_y]]-[[date_m]]-[[date_d]]
+pdf02  Document generated at [[date_h]]:[[date_i]]
+pdf03  Document generated on [[date_y]]-[[date_m]]-[[date_d]] at 
[[date_h]]:[[date_i]]
+pdf04  Page [[current]]/[[nb]]
+pdf05  The forms require the use of Adobe Reader 9
+vue01  HEADER
+vue02  FOOTER
+vue03  PAGE
+vue04  View


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/en.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/es.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/es.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/es.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  La etiqueta <b>&lt;[[OTHER]]&gt;</b> todav\xEDa no existe.<br><br>Si 
quiere a\xF1adirla, debe crear los m\xE9todos <b>o_[[OTHER]]</b> (para la 
apertura) y <b>c_[[OTHER]]</b> (para el cierre) siguiendo el modelo de las 
etiquetas existentes.<br><br>Si crea nuevos m\xE9todos, env\xEDelos a 
address@hidden para a\xF1adirlos a las siguientes versiones de HTML2PDF, y que 
todo el mundo se pueda beneficiar.
+err02  Frase de 1000 l\xEDneas => demasiado larga<br><b>Frase :</b> 
[[OTHER_0]]<br><b>Tama\xF1o casilla :</b> [[OTHER_1]]<br><b>Tama\xF1o texto 
:</b> [[OTHER_2]]<br>
+err03  C\xF3digo HTML no v\xE1lido, una etiqueta tiene un cierre de m\xE1s : 
<b>&lt;[[OTHER]]&gt;</b>
+err04  C\xF3digo HTML no v\xE1lido, las etiquetas no estan cerradas en el 
orden correcto.<br>Estado : <pre>[[OTHER]]</pre>
+err05  C\xF3digo HTML no v\xE1lido, todas las etiquetas deben tener su 
cierre.<br>Estado : <pre>[[OTHER]]</pre>
+err06  Imposible cargar la imagen <b>[[OTHER]]</b>
+err07  El contenido de una etiqueta TD no encaja en una sola p\xE1gina
+txt01  ERROR n\xB0
+txt02  Fichero :
+txt03  L\xEDnea :
+pdf01  Documento generado el [[date_d]]/[[date_m]]/[[date_y]]
+pdf02  Documento generado a las [[date_h]]:[[date_i]]
+pdf03  Documento generado el [[date_d]]/[[date_m]]/[[date_y]] a las 
[[date_h]]:[[date_i]]
+pdf04  P\xE1gina [[current]]/[[nb]]
+pdf05  Los formularios requieren el uso de Adobe Reader 9
+vue01  ENCABEZADO
+vue02  PIE DE P\xC1GINA
+vue03  P\xC1GINA
+vue04  Visualizaci\xF3n


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/es.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/fr.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/fr.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/fr.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  La balise <b>&lt;[[OTHER]]&gt;</b> n'existe pas encore.<br><br>Si vous 
voulez la rajouter, vous devez cr\xE9er les m\xE9thodes <b>o_[[OTHER]]</b> 
(pour l'ouverture) et <b>c_[[OTHER]]</b> (pour la fermeture) en suivant le 
mod\xE8le des balises existantes.<br><br>De plus, si vous cr\xE9ez ces 
m\xE9thodes, n'h\xE9sitez pas \xE0 en faire profiter tout le monde en 
m'\xE9crivant sur address@hidden afin qu'elles se retrouvent dans la prochaine 
version d'HTML2PDF.
+err02  Phrase de 1000 lignes => trop long<br><b>Phrase :</b> 
[[OTHER_0]]<br><b>Largeur case :</b> [[OTHER_1]]<br><b>Longueur text :</b> 
[[OTHER_2]]<br>
+err03  Code HTML non valide, une balise est ferm\xE9e en trop : 
<b>&lt;[[OTHER]]&gt;</b>
+err04  Code HTML non valide, les balises ne sont pas ferm\xE9es dans le bon 
ordre.<br>Etat : <pre>[[OTHER]]</pre>
+err05  Code HTML non valide, toutes les balises doivent \xEAtre 
ferm\xE9es.<br>Etat : <pre>[[OTHER]]</pre>
+err06  Impossible de charger l'image <b>[[OTHER]]</b>
+err07  le contenu d'une balise TD ne rentre pas sur une seule page
+txt01  ERREUR n\xB0
+txt02  Fichier :
+txt03  Ligne :
+pdf01  Document g\xE9n\xE9r\xE9 le [[date_d]]/[[date_m]]/[[date_y]]
+pdf02  Document g\xE9n\xE9r\xE9 \xE0 [[date_h]]:[[date_i]]
+pdf03  Document g\xE9n\xE9r\xE9 le [[date_d]]/[[date_m]]/[[date_y]] \xE0 
[[date_h]]:[[date_i]]
+pdf04  Page [[current]]/[[nb]]
+pdf05  Les formulaires n\xE9cessitent  l'utilisation de Adobe Reader 9
+vue01  HEADER
+vue02  FOOTER
+vue03  PAGE
+vue04  Restitution


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/fr.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/it.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/it.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/it.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  Il tag <b>&lt;[[OTHER]]&gt;</b> non esiste ancora.<br><br>Se si 
desidera aggiungere, \xE8 necessario creare metodi <b>o_[[OTHER]]</b> (di 
apertura) e <b>C_[[OTHER]]</b> (per la chiusura) secondo il modello esistente 
di tag.<br><br>Inoltre, se si creare questi metodi, non esitate a portare il 
mondo intero ha scritto su address@hidden in modo che alla fine nella prossima 
versione di HTML2PDF.
+err02  Citazione di 1000 linee => troppo lungo<br><b>frase :</b> 
[[OTHER_0]]<br><b>casella Larghezza :</b> [[OTHER_1]]<br><b>Lunghezza testo 
:</b> [[OTHER_2]]<br>
+err03  HTML non valido, un tag \xE8 chiusa troppo <b>&lt;[[OTHER]]&gt;</ b>
+err04  HTML non validi, i tag non sono chiusi nel corretto ordine.<br>Stato 
:<pre>[[OTHER]]</pre>
+err05  HTML non valido, tutte le tag deve essere chiuso.<br>Stato 
:<pre>[[OTHER]]</pre>
+err06  Impossibile caricare l'immagine <b>[[OTHER]]</b>
+err07  il contenuto di un tag TD non rientra in una sola pagina
+txt01  ERRORE n\xB0
+txt02  File :
+txt03  Linea :
+pdf01  Documento generato il [[date_d]]/[[date_m]]/[[date_y]]
+pdf02  Documento generato [[date_h]]:[[date_i]]
+pdf03  Documento generato il [[date_d]]/[[date_m]]/[[date_y]] nel 
[[date_h]]:[[date_i]]
+pdf04  Pagina [[current]]/[[nb]]
+pdf05  I moduli richiedono l'uso di Adobe Reader 9
+vue01  HEADER
+vue02  FOOTER
+vue03  PAGINA
+vue04  Visualization


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/it.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/nl.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/nl.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/nl.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  De tag <b>&lt;[[OTHER]]&gt;</b> bestaat nog niet.<br><br>Om deze toe te 
voegen, gebruik de methods <b>o_[[OTHER]]</b> (om te openen) en 
<b>c_[[OTHER]]</b> (om te sluiten) volgens het model van de bestaande 
tags.<br><br>Als u deze methods maakt, stuur deze dan a.u.b. via e-mail naar 
address@hidden voor opname in de volgende versie van HTML2PDF.
+err02  Zin van 1000 regels => te lang<br><b>Zin :</b> 
[[OTHER_0]]<br><b>Kaderbreedte :</b> [[OTHER_1]]<br><b>Tekstlengte :</b> 
[[OTHER_2]]<br>
+err03  Ongeldige HTML code, overvloedig afgesloten tag : 
<b>&lt;[[OTHER]]&gt;</b>
+err04  Ongeldige HTML code, de tags zijn niet correct afgesloten.<br>Status : 
<pre>[[OTHER]]</pre>
+err05  Ongeldige HTML code, alle tags dienen te zijn gesloten.<br>Status : 
<pre>[[OTHER]]</pre>
+err06  Kan afbeelding niet laden: <b>[[OTHER]]</b>
+err07  De inhoud van de cel (<TD>) past niet op een pagina
+txt01  Fout nr
+txt02  Bestand :
+txt03  Regel :
+pdf01  Document gemaakt op [[date_d]]-[[date_m]]-[[date_y]]
+pdf02  Document gemaakt om [[date_h]]:[[date_i]]
+pdf03  Document gemaakt op [[date_d]]-[[date_m]]-[[date_y]] om 
[[date_h]]:[[date_i]]
+pdf04  Pagina [[current]] van [[nb]]
+pdf05  De formulieren vereisen het gebruik van Adobe Reader 9
+vue01  Paginakop
+vue02  Paginavoet
+vue03  Pagina
+vue04  Bekijken


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/nl.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/pt.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/pt.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/pt.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  A tag <b>&lt;[[OTHER]]&gt;</b> ainda n\xE3o existe.<br><br>Se voc\xEA 
quer inser\xED-la, deve criar os m\xE9todos <b>o_[[OTHER]]</b> (para 
abr\xED-la) e <b>c_[[OTHER]]</b> (para fech\xE1-la) seguindo o modelo das tags 
existentes.<br><br>Se voc\xEA criar novos m\xE9todos, os envie para 
address@hidden para que as pr\xF3ximas vers\xF5es de HTML2PDF, e o restante do 
mundo se beneficie com isso.
+err02  Frase de 1000 linhas => muito grande<br><b>Frase :</b> 
[[OTHER_0]]<br><b>Tamanho do quadro :</b> [[OTHER_1]]<br><b>Tamanho do texto 
:</b> [[OTHER_2]]<br>
+err03  C\xF3digo HTML n\xE3o v\xE1lido, uma tag est\xE1 com fechamento 
sobrando : <b>&lt;[[OTHER]]&gt;</b>
+err04  C\xF3digo HTML n\xE3o v\xE1lido, as tags n\xE3o est\xE3o fechadas na 
ordem correta.<br>Estado : <pre>[[OTHER]]</pre>
+err05  C\xF3digo HTML n\xE3o v\xE1lido, todas as tags devem ser 
fechadas.<br>Estado : <pre>[[OTHER]]</pre>
+err06  Imposs\xEDvel carregar imagem <b>[[OTHER]]</b>
+err07  O conte\xFAdo de uma tag TD n\xE3o se encaixa em apenas uma p\xE1gina
+txt01  ERRO n\xB0
+txt02  Arquivo :
+txt03  Linha :
+pdf01  Documento generado em [[date_d]]/[[date_m]]/[[date_y]]
+pdf02  Documento generado \xE0s [[date_h]]:[[date_i]]
+pdf03  Documento generado em [[date_d]]/[[date_m]]/[[date_y]] \xE0s 
[[date_h]]:[[date_i]]
+pdf04  P\xE1gina [[current]]/[[nb]]
+pdf05  Os formul\xE1rios exigem a utiliza\xE7\xE3o do Adobe Reader 9
+vue01  CABE\xC7ALHO
+vue02  RODAP\xC9
+vue03  P\xC1GINA
+vue04  Visualiza\xE7\xE3o


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/pt.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/langues/tr.txt
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/langues/tr.txt          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/langues/tr.txt  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+err01  <b>&lt;[[OTHER]]&gt;</b> etiketi bulunamad\xFD.<br><br>Eklemek 
isterseniz, <b>o_[[OTHER]]</b> \xFEeklinde a\xE7\xFDp, <b>c_[[OTHER]]</b> 
\xFEeklinde kapatabilirsiniz.<br><br> Bu \xFEekilde etiketler \xFCretirseniz 
l\xFCtfen daha sonraki HTML2PDF versiyonuna eklenmek \xFCzere bana g\xF6nderin. 
( address@hidden ).
+err02  \xDD\xE7erik 1000 sat\xFDrdan fazla ve gerekenden uzun <br><b>Konu 
:</b> [[OTHER_0]]<br><b>Geni\xFElik :</b> [[OTHER_1]]<br><b>Yaz\xFD boyutu 
:</b> [[OTHER_2]]<br>
+err03  HTML kodu hatal\xFD, etiket birden fazla defa kapat\xFDlm\xFD\xFE: 
<b>&lt;[[OTHER]]&gt;</b>
+err04  HTML kodu hatal\xFD, etiketler gereken d\xFCzen i\xE7inde 
kapat\xFDlmam\xFD\xFE.<br>Durum : <pre>[[OTHER]]</pre>
+err05  HTML kodu hatal\xFD, b\xFCt\xFCn etiketler kapat\xFDlmal\xFD.<br>Durum 
: <pre>[[OTHER]]</pre>
+err06  Resim dosyas\xFD okunam\xFDyor <b>[[OTHER]]</b>
+err07  TD i\xE7eri\xF0i bir sayfaya s\xFD\xF0m\xFDyor
+txt01  HATA n\xB0
+txt02  Dosya :
+txt03  Sat\xFDr :
+pdf01  Dok\xFCman \xFCretilme tarihi [[date_y]]-[[date_m]]-[[date_d]]
+pdf02  Dok\xFCman \xFCretilme tarihi [[date_h]]:[[date_i]]
+pdf03  Dok\xFCman \xFCretilme tarihi [[date_y]]-[[date_m]]-[[date_d]] saati 
[[date_h]]:[[date_i]]
+pdf04  Sayfa [[current]]/[[nb]]
+pdf05  Adobe Reader 9 gerektirir
+vue01  DOSYA \xDCST\xDC
+vue02  DOSYA ALTI
+vue03  SAYFA
+vue04  G\xF6r\xFCn\xFCm


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/langues/tr.txt
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/parsingHTML.class.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/parsingHTML.class.php   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/parsingHTML.class.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,440 @@
+<?php
+/**
+ * Logiciel : HTML2PDF - classe ParsingHTML
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * @version            3.25 - 07/10/2009
+ */
+ 
+if (!defined('__CLASS_PARSINGHTML__'))
+{
+       define('__CLASS_PARSINGHTML__', true);
+       
+       class parsingHTML
+       {
+               var $html       = '';                   // code HTML \xE0 parser
+               var $code       = array();              // code HTML pars\xE9
+               var $num        = 0;                    // num\xE9ro de table
+               var $level      = 0;                    // niveaux de table
+               
+               /**
+                * Constructeur
+                *
+                * @return      null
+                */
+               function parsingHTML()
+               {
+                       $this->num              = 0;
+                       $this->level    = array($this->num);
+                       $this->html             = '';
+                       $this->code             = array();      
+               }
+               
+               /**
+                * D\xE9finir le code HTML \xE0 parser
+                *
+                * @param       string code html
+                * @return      null
+                */
+               function setHTML($html)
+               {
+                       $html = preg_replace('/<!--(.*)-->/isU', '', $html);
+                       $this->html = $html;    
+               }
+               
+               /**
+                * parser le code HTML
+                *
+                * @return      null
+                */
+               function parse()
+               {
+                       $parents = array();
+
+                       // chercher les balises HTML du code
+                       $tmp = array();
+                       $this->searchCode($tmp);
+                       
+                       // identifier les balises une \xE0 une
+                       $pre_in = false;
+                       $pre_br = array(
+                                               'name' => 'br',
+                                               'close' => false,
+                                               'param' => array(
+                                                       'style' => array(),
+                                                       'num'   => 0
+                                               )
+                                       );
+
+                       $balises_no_closed = array('br', 'hr', 'img', 'input', 
'link', 'option', 'col');
+                       $todos = array();
+                       foreach($tmp as $part)
+                       {
+                               // si c'est un texte
+                               if ($part[0]=='txt')
+                               {
+                                       // enregistrer l'action correspondante
+                                       if (!$pre_in)
+                                       {
+//                                             if (trim($part[1])!=='')
+//                                             {
+                                                       // remplacer tous les 
espaces, tabulations, saufs de ligne multiples par de simples espaces
+                                                       $part[1] = 
preg_replace('/([\s]+)/is', ' ', $part[1]);
+                                       
+                                                       $todos[] = array(
+                                                                               
        'name'  => 'write',
+                                                                               
        'close' => false,
+                                                                               
        'param' => array('txt' => $part[1]),
+                                                                               
);
+//                                             }
+                                       }
+                                       else
+                                       {
+                                               $part[1] = str_replace("\r", 
'', $part[1]);
+                                               $part[1] = explode("\n", 
$part[1]);
+                                               
+                                               foreach($part[1] as $k => $txt)
+                                               {
+                                                       $txt = 
str_replace("\t", '        ', $txt);
+                                                       $txt = str_replace(' ', 
'&nbsp;', $txt);
+                                                       if ($k>0) $todos[] = 
$pre_br;
+
+                                                               $todos[] = 
array(
+                                                                               
        'name'  => 'write',
+                                                                               
        'close' => false,
+                                                                               
        'param' => array('txt' => $txt),
+                                                                               
);
+                                               }
+                                       }
+                               }
+                               // sinon, analyser le code
+                               else
+                               {
+                                       $res = $this->analiseCode($part[1]);
+                                       if ($res)
+                                       {
+                                               $res['html_pos'] = $part[2];
+                                               if (!in_array($res['name'], 
$balises_no_closed))
+                                               {
+                                                       if ($res['close'])
+                                                       {
+                                                               if 
(count($parents)<1)
+                                                                       
@HTML2PDF::makeError(3, __FILE__, __LINE__, $res['name'], 
$this->getHtmlErrorCode($res['html_pos']));
+                                                               else if 
($parents[count($parents)-1]!=$res['name'])
+                                                                       
@HTML2PDF::makeError(4, __FILE__, __LINE__, $parents, 
$this->getHtmlErrorCode($res['html_pos']));
+                                                               else
+                                                                       
unset($parents[count($parents)-1]);
+                                                       }
+                                                       else
+                                                       {
+                                                               if 
($res['autoclose'])
+                                                               {
+                                                                       
$todos[] = $res;
+                                                                       
$res['params'] = array();
+                                                                       
$res['close'] = true;
+                                                               }
+                                                               else
+                                                                       
$parents[count($parents)] = $res['name'];
+                                                                               
                                
+                                                       }
+                                                       if 
(($res['name']=='pre' || $res['name']=='code') && !$res['autoclose'])
+                                                                       $pre_in 
= !$res['close'];
+                                               }
+                                               
+                                               $todos[] = $res;
+                                       }
+                               }       
+                       }
+
+                       // pour chaque action identifi\xE9e, il faut nettoyer 
le d\xE9but et la fin des textes
+                       // en fonction des balises qui l'entourent.
+                       $balises_clean = array('page', 'page_header', 
'page_footer', 'form',
+                                                                       
'table', 'thead', 'tfoot', 'tr', 'td', 'th', 'br',
+                                                                       'div', 
'hr', 'p', 'ul', 'ol', 'li',
+                                                                       'h1', 
'h2', 'h3', 'h4', 'h5', 'h6');
+                       $nb = count($todos);
+                       for($k=0; $k<$nb; $k++)
+                       {
+                               //si c'est un texte
+                               if ($todos[$k]['name']=='write')
+                               {
+                                       // et qu'une balise sp\xE9cifique le 
pr\xE9c\xE8de => on nettoye les espaces du d\xE9but du texte
+                                       if ($k>0 && 
in_array($todos[$k-1]['name'], $balises_clean))
+                                               $todos[$k]['param']['txt'] = 
ltrim($todos[$k]['param']['txt']);
+
+                                       // et qu'une balise sp\xE9cifique le 
suit => on nettoye les espaces de la fin du texte
+                                       if ($k<count($todos)-1 && 
in_array($todos[$k+1]['name'], $balises_clean))
+                                               $todos[$k]['param']['txt'] = 
rtrim($todos[$k]['param']['txt']);
+                                               
+                                       if (!strlen($todos[$k]['param']['txt']))
+                                               unset($todos[$k]);
+                               }
+                       }
+                       if (count($parents)) @HTML2PDF::makeError(5, __FILE__, 
__LINE__, $parents);
+
+                       // liste des actions sauv\xE9e
+                       $this->code = array_values($todos);;
+               }
+               
+               /**
+                * parser le code HTML
+                *
+                * @param       &array  tableau de retour des donn\xE9es
+                * @return      null
+                */
+               function searchCode(&$tmp)
+               {
+                       // s\xE9parer les balises du texte
+                       $tmp = array();
+                       $reg = '/(<[^>]+>)|([^<]+)+/isU';
+
+                       // pour chaque \xE9l\xE9ment trouv\xE9 :
+                       $str = '';
+                       $offset = 0;
+                       while(preg_match($reg, $this->html, $parse, 
PREG_OFFSET_CAPTURE, $offset))
+                       {
+                               // si une balise a \xE9t\xE9 d\xE9tect\xE9e
+                               if ($parse[1][0])
+                               {
+                                       // sauvegarde du texte pr\xE9c\xE9dent 
si il existe
+                                       if ($str!=='')  $tmp[] = 
array('txt',$str);
+               
+                                       // sauvegarde de la balise
+                                       $tmp[] = 
array('code',trim($parse[1][0]), $offset);
+                                       
+                                       // initialisation du texte suivant
+                                       $str = '';      
+                               }
+                               else
+                               {
+                                       // ajout du texte \xE0 la fin de celui 
qui est d\xE9j\xE0 d\xE9tect\xE9
+                                       $str.= $parse[2][0];
+                               }
+                               // Update offset to the end of the match
+                               $offset = $parse[0][1] + strlen($parse[0][0]);
+                               unset($parse);
+                       }
+                       // si un texte est pr\xE9sent \xE0 la fin, on 
l'enregistre
+                       if ($str!='') $tmp[] = array('txt',$str);
+                       unset($str);
+               }
+               
+               /**
+                * analyse une balise HTML
+                *
+                * @param       string  code HTML \xE0 identifier
+                * @return      array   action correspondante
+                */
+               function analiseCode($code)
+               {
+                       // nom de la balise et ouverture ou fermeture
+                       $balise = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)';
+                       preg_match('/'.$balise.'/isU', $code, $match);
+                       $close  = ($match[1]=='/' ? true : false);
+                       $autoclose = preg_match('/\/>$/isU', $code);
+                       
+                       $name   = strtolower($match[2]);
+                       
+                       // param\xE8tres obligatoires en fonction du nom de la 
balise
+                       $param  = array();
+                       $param['style'] = '';
+                       if ($name=='img')       { $param['alt'] = '';   
$param['src'] = ''; }
+                       if ($name=='a')         { $param['href'] = '';  }
+                       
+                       // lecture des param\xE9tres du type nom=valeur
+                       $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)';
+                       preg_match_all('/'.$prop.'/is', $code, $match);
+                       for($k=0; $k<count($match[0]); $k++)
+                               $param[trim(strtolower($match[1][$k]))] = 
trim($match[2][$k]);
+
+                       // lecture des param\xE9tres du type nom="valeur"
+                       $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]';
+                       preg_match_all('/'.$prop.'/is', $code, $match);
+                       for($k=0; $k<count($match[0]); $k++)
+                               $param[trim(strtolower($match[1][$k]))] = 
trim($match[2][$k]);
+
+                       // lecture des param\xE9tres du type nom='valeur'
+                       $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']";
+                       preg_match_all('/'.$prop.'/is', $code, $match);
+                       for($k=0; $k<count($match[0]); $k++)
+                               $param[trim(strtolower($match[1][$k]))] = 
trim($match[2][$k]);
+               
+                       // mise en conformit\xE9 en style de chaque param\xE8tre
+                       $color  = "#000000";
+                       $border = null;
+                       foreach($param as $key => $val)
+                       {
+                               $key = strtolower($key);
+                               switch($key)
+                               {
+                                       case 'width':
+                                               unset($param[$key]);
+                                               $param['style'] = 'width: 
'.$val.'px; '.$param['style'];
+                                               break;  
+
+                                       case 'align':
+                                               if ($name!=='table')
+                                               {
+                                                       unset($param[$key]);
+                                                       $param['style'] = 
'text-align: '.$val.'; '.$param['style'];
+                                               }
+                                               break;
+                                               
+                                       case 'valign':
+                                               unset($param[$key]);
+                                               $param['style'] = 
'vertical-align: '.$val.'; '.$param['style'];
+                                               break;
+                                               
+                                       case 'height':
+                                               unset($param[$key]);
+                                               $param['style'] = 'height: 
'.$val.'px; '.$param['style'];       
+                                               break;  
+
+                                       case 'bgcolor':
+                                               unset($param[$key]);
+                                               $param['style'] = 'background: 
'.$val.'; '.$param['style'];                                     
+                                               break;  
+
+                                       case 'bordercolor':
+                                               unset($param[$key]);
+                                               $color = $val;
+                                               break;  
+
+                                       case 'border':
+                                               unset($param[$key]);
+                                               if (preg_match('/^[0-9]$/isU', 
$val)) $val = $val.'px';
+                                               $border = $val;
+                                               break;
+                                       
+                                       case 'cellpadding':
+                                       case 'cellspacing':
+                                               if 
(preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px';
+                                               break;
+                                               
+                                       case 'colspan':
+                                       case 'rowspan':
+                                               $val = 
preg_replace('/[^0-9]/isU', '', $val);
+                                               if (!$val) $val = 1;
+                                               $param[$key] = $val;
+                                               break;
+                               }
+                       }
+                       if ($border!==null)
+                       {
+                               if ($border)    $param['style'] = 'border: 
solid '.$border.' '.$color.'; '.$param['style'];
+                               else                    $param['style'] = 
'border: none'.$param['style']; 
+                       }
+                       
+                       // lecture des styles - d\xE9composition
+                       $styles = explode(';', $param['style']);
+                       $param['style'] = array();
+                       foreach($styles as $style)
+                       {
+                               $tmp = explode(':', $style);
+                               if (count($tmp)>1)
+                               {
+                                       $cod = $tmp[0]; unset($tmp[0]); $tmp = 
implode(':', $tmp); 
+                                       $param['style'][trim(strtolower($cod))] 
= preg_replace('/[\s]+/isU', ' ', trim($tmp));
+                               }
+                       }
+                       
+                       // d\xE9termination du niveau de table pour les 
ouverture, avec ajout d'un level
+                       if (in_array($name, array('ul', 'ol', 'table')) && 
!$close)
+                       {
+                               $this->num++;
+                               $this->level[count($this->level)] = $this->num;
+                       } 
+                       
+                       // attribution du niveau de table o\xF9 se trouve 
l'\xE9l\xE9ment
+                       if (!isset($param['num'])) $param['num'] = 
$this->level[count($this->level)-1];
+
+                       // pour les fins de table : suppression d'un level
+                       if (in_array($name, array('ul', 'ol', 'table')) && 
$close)
+                       {
+                               unset($this->level[count($this->level)-1]);     
                
+                       } 
+
+                       // retour de l'action identifi\xE9e
+                       return array('name' => $name, 'close' => $close ? 1 : 
0, 'autoclose' => $autoclose, 'param' => $param);
+               }
+               
+               // r\xE9cup\xE9rer un niveau complet d'HTML entre une ouverture 
de balise et la fermeture correspondante
+               function getLevel($k)
+               {
+                       // si le code n'existe pas : fin
+                       if (!isset($this->code[$k])) return '';
+                       
+                       // quelle balise faudra-t-il d\xE9tecter
+                       $detect = $this->code[$k]['name'];
+                       
+                       $level = 0;             // niveau de profondeur
+                       $end = false;   // etat de fin de recherche
+                       $code = '';             // code extrait
+                       
+                       // tant que c'est pas fini, on boucle
+                       while (!$end)
+                       {
+                               // action courante
+                               $row = $this->code[$k];
+                               
+                               // si write => on ajoute le texte
+                               if ($row['name']=='write')
+                               {
+                                       $code.= $row['param']['txt'];   
+                               }
+                               // sinon, c'est une balise html
+                               else
+                               {
+                                       $not = false; // indicateur de non 
prise en compte de la balise courante
+                                       
+                                       // si c'est la balise que l'on cherche
+                                       if ($row['name']==$detect)
+                                       {
+                                               if ($level==0) { $not = true; } 
                                // si on est \xE0 la premiere balise : on 
l'ignore
+                                               $level+= ($row['close'] ? -1 : 
1);                              // modification du niveau en cours en fonction 
de l'ouvertre / fermeture
+                                               if ($level==0) { $not = true; 
$end = true; }    // si on est au niveau 0 : on a fini
+                                       }
+                                       
+                                       // si on doit prendre en compte la 
balise courante
+                                       if (!$not)
+                                       {
+                                               // ecriture du code HTML de la 
balise
+                                               $code.= '<'.($row['close'] ? 
'/' : '').$row['name'];
+                                               foreach($row['param'] as $key 
=> $val)
+                                               {
+                                                       if ($key=='style')
+                                                       {
+                                                               $tmp = '';
+                                                               if 
(isset($val['text-align'])) unset($val['text-align']);
+                                                               foreach($val as 
$ks => $vs) $tmp.= $ks.':'.$vs.'; ';
+                                                               if (trim($tmp)) 
$code.= ' '.$key.'="'.$tmp.'"';
+                                                       }
+                                                       else
+                                                       {
+                                                               $code.= ' 
'.$key.'="'.$val.'"';
+                                                       }       
+                                               }
+                                               $code.= '>';
+                                       }
+                               }
+                               
+                               // on continue tant qu'il y a du code \xE0 
analyser...
+                               if (isset($this->code[$k+1]))
+                                       $k++;
+                               else
+                                       $end = true;    
+                       }
+                       
+                       // retourne la position finale et le code HTML extrait
+                       return array($k, $code);
+               }
+               
+               function getHtmlErrorCode($pos)
+               {
+                       return substr($this->html, $pos-30, 70);
+               }
+       }
+}


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/parsingHTML.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/inc/html2pdf/qrcode/qrcode.class.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/qrcode/qrcode.class.php 
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/qrcode/qrcode.class.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,56 @@
+<?php
+/*
+ * ATTENTION : 
+ * Vous devez t\xE9l\xE9charger la librairie "QR-code generator" (sous licence 
LGPL)
+ * a cette adresse : http://prgm.spipu.net/php_qrcode
+ * et mettre tout son contenu dans ce repertoire (qrcode)
+ * en remplacant \xE9galement ce fichier (qrcode.class.php)
+ * 
+ * WARNING: 
+ * You have to download the librairy "QR-code generator" (under LGPL licence)
+ * at this url : http://prgm.spipu.net/php_qrcode
+ * and to put all his content in this folder (qrcode)
+ * and to replace also this file (qrcode.class.php)
+ */
+
+if (!defined('__CLASS_QRCODE__'))
+{
+       define('__CLASS_QRCODE__', '0.9');
+       
+       class QRcode
+       {
+               public function __construct($value, $level='L')
+               {
+                       echo '
+<pre>
+       <b>ATTENTION :</b> 
+               Vous devez t\xE9l\xE9charger la librairie "QR-code generator" 
(sous licence LGPL)
+               a cette adresse : <a href="http://prgm.spipu.net/php_qrcode"; 
target="_blank">http://prgm.spipu.net/php_qrcode</a>
+               et mettre tout son contenu dans ce repertoire : 
'.dirname(__FILE__).'
+               en remplacant \xE9galement ce fichier : '.basename(__FILE__).'
+               
+       <b>WARNING:</b> 
+               You have to download the librairy "QR-code generator" (under 
LGPL licence)
+               at this url : <a href="http://prgm.spipu.net/php_qrcode"; 
target="_blank">http://prgm.spipu.net/php_qrcode</a>
+               and to put all his contents in this folder '.dirname(__FILE__).'
+               and to replace also this file : '.basename(__FILE__).'
+ </pre>';
+               exit;
+               }
+               
+               public function getQrSize()
+               {
+                       return 0;       
+               }
+               
+               public function displayFPDF(&$fpdf, $x, $y, $s, $background, 
$color)
+               {
+                       return true;
+               }
+
+               public function displayHTML()
+               {
+                       return true;
+               }
+       }
+}
\ No newline at end of file


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/qrcode/qrcode.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/html2pdf/styleHTML.class.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/html2pdf/styleHTML.class.php     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/html2pdf/styleHTML.class.php     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,1476 @@
+<?php
+/**
+ * Logiciel : HTML2PDF - classe styleHTML
+ * 
+ * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY 
+ * Distribu\xE9 sous la licence LGPL. 
+ *
+ * @author             Laurent MINGUET <address@hidden>
+ * @version            3.25 - 07/10/2009
+ */
+ 
+if (!defined('__CLASS_STYLEHTML__'))
+{
+       define('__CLASS_STYLEHTML__', true);
+       
+       class styleHTML
+       {
+               var $css                = array();              // tableau des 
CSS
+               var $css_keys   = array();              // tableau des clefs 
CSS, pour l'ordre d'execution
+               var $value              = array();              // valeurs 
actuelles
+               var $table              = array();              // tableau 
d'empilement pour historisation des niveaux
+               var $pdf                = null;                 // 
r\xE9f\xE9rence au PDF parent
+               var $htmlColor  = array();              // liste des couleurs 
HTML
+               var $onlyLeft   = false;                // indique si on est 
dans un sous HTML et qu'on bloque \xE0 gauche
+               
+               /**
+                * Constructeur
+                *
+                * @param       &pdf            r\xE9f\xE9rence \xE0 l'objet 
HTML2PDF parent
+                * @return      null
+                */
+               function styleHTML(&$pdf)
+               {
+                       $this->init();          // initialisation
+                       $this->pdf = &$pdf;
+               }
+               
+               /**
+                * Initialisation du style
+                *
+                * @return      null
+                */
+               function init()
+               {
+                       $color = array();
+                       $color['AliceBlue']                     = '#F0F8FF';
+                       $color['AntiqueWhite']          = '#FAEBD7';
+                       $color['Aqua']                          = '#00FFFF';
+                       $color['Aquamarine']            = '#7FFFD4';
+                       $color['Azure']                         = '#F0FFFF';
+                       $color['Beige']                         = '#F5F5DC';
+                       $color['Bisque']                        = '#FFE4C4';
+                       $color['Black']                         = '#000000';
+                       $color['BlanchedAlmond']        = '#FFEBCD';
+                       $color['Blue']                          = '#0000FF';
+                       $color['BlueViolet']            = '#8A2BE2';
+                       $color['Brown']                         = '#A52A2A';
+                       $color['BurlyWood']                     = '#DEB887';
+                       $color['CadetBlue']                     = '#5F9EA0';
+                       $color['Chartreuse']            = '#7FFF00';
+                       $color['Chocolate']                     = '#D2691E';
+                       $color['Coral']                         = '#FF7F50';
+                       $color['CornflowerBlue']        = '#6495ED';
+                       $color['Cornsilk']                      = '#FFF8DC';
+                       $color['Crimson']                       = '#DC143C';
+                       $color['Cyan']                          = '#00FFFF';
+                       $color['DarkBlue']                      = '#00008B';
+                       $color['DarkCyan']                      = '#008B8B';
+                       $color['DarkGoldenRod']         = '#B8860B';
+                       $color['DarkGray']                      = '#A9A9A9';
+                       $color['DarkGrey']                      = '#A9A9A9';
+                       $color['DarkGreen']                     = '#006400';
+                       $color['DarkKhaki']                     = '#BDB76B';
+                       $color['DarkMagenta']           = '#8B008B';
+                       $color['DarkOliveGreen']        = '#556B2F';
+                       $color['Darkorange']            = '#FF8C00';
+                       $color['DarkOrchid']            = '#9932CC';
+                       $color['DarkRed']                       = '#8B0000';
+                       $color['DarkSalmon']            = '#E9967A';
+                       $color['DarkSeaGreen']          = '#8FBC8F';
+                       $color['DarkSlateBlue']         = '#483D8B';
+                       $color['DarkSlateGray']         = '#2F4F4F';
+                       $color['DarkSlateGrey']         = '#2F4F4F';
+                       $color['DarkTurquoise']         = '#00CED1';
+                       $color['DarkViolet']            = '#9400D3';
+                       $color['DeepPink']                      = '#FF1493';
+                       $color['DeepSkyBlue']           = '#00BFFF';
+                       $color['DimGray']                       = '#696969';
+                       $color['DimGrey']                       = '#696969';
+                       $color['DodgerBlue']            = '#1E90FF';
+                       $color['FireBrick']                     = '#B22222';
+                       $color['FloralWhite']           = '#FFFAF0';
+                       $color['ForestGreen']           = '#228B22';
+                       $color['Fuchsia']                       = '#FF00FF';
+                       $color['Gainsboro']                     = '#DCDCDC';
+                       $color['GhostWhite']            = '#F8F8FF';
+                       $color['Gold']                          = '#FFD700';
+                       $color['GoldenRod']                     = '#DAA520';
+                       $color['Gray']                          = '#808080';
+                       $color['Grey']                          = '#808080';
+                       $color['Green']                         = '#008000';
+                       $color['GreenYellow']           = '#ADFF2F';
+                       $color['HoneyDew']                      = '#F0FFF0';
+                       $color['HotPink']                       = '#FF69B4';
+                       $color['IndianRed']                     = '#CD5C5C';
+                       $color['Indigo']                        = '#4B0082';
+                       $color['Ivory']                         = '#FFFFF0';
+                       $color['Khaki']                         = '#F0E68C';
+                       $color['Lavender']                      = '#E6E6FA';
+                       $color['LavenderBlush']         = '#FFF0F5';
+                       $color['LawnGreen']                     = '#7CFC00';
+                       $color['LemonChiffon']          = '#FFFACD';
+                       $color['LightBlue']                     = '#ADD8E6';
+                       $color['LightCoral']            = '#F08080';
+                       $color['LightCyan']                     = '#E0FFFF';
+                       $color['LightGoldenRodYellow']  = '#FAFAD2';
+                       $color['LightGray']                     = '#D3D3D3';
+                       $color['LightGrey']                     = '#D3D3D3';
+                       $color['LightGreen']            = '#90EE90';
+                       $color['LightPink']                     = '#FFB6C1';
+                       $color['LightSalmon']           = '#FFA07A';
+                       $color['LightSeaGreen']         = '#20B2AA';
+                       $color['LightSkyBlue']          = '#87CEFA';
+                       $color['LightSlateGray']        = '#778899';
+                       $color['LightSlateGrey']        = '#778899';
+                       $color['LightSteelBlue']        = '#B0C4DE';
+                       $color['LightYellow']           = '#FFFFE0';
+                       $color['Lime']                          = '#00FF00';
+                       $color['LimeGreen']                     = '#32CD32';
+                       $color['Linen']                         = '#FAF0E6';
+                       $color['Magenta']                       = '#FF00FF';
+                       $color['Maroon']                        = '#800000';
+                       $color['MediumAquaMarine']      = '#66CDAA';
+                       $color['MediumBlue']            = '#0000CD';
+                       $color['MediumOrchid']          = '#BA55D3';
+                       $color['MediumPurple']          = '#9370D8';
+                       $color['MediumSeaGreen']        = '#3CB371';
+                       $color['MediumSlateBlue']       = '#7B68EE';
+                       $color['MediumSpringGreen']     = '#00FA9A';
+                       $color['MediumTurquoise']       = '#48D1CC';
+                       $color['MediumVioletRed']       = '#C71585';
+                       $color['MidnightBlue']          = '#191970';
+                       $color['MintCream']                     = '#F5FFFA';
+                       $color['MistyRose']                     = '#FFE4E1';
+                       $color['Moccasin']                      = '#FFE4B5';
+                       $color['NavajoWhite']           = '#FFDEAD';
+                       $color['Navy']                          = '#000080';
+                       $color['OldLace']                       = '#FDF5E6';
+                       $color['Olive']                         = '#808000';
+                       $color['OliveDrab']                     = '#6B8E23';
+                       $color['Orange']                        = '#FFA500';
+                       $color['OrangeRed']                     = '#FF4500';
+                       $color['Orchid']                        = '#DA70D6';
+                       $color['PaleGoldenRod']         = '#EEE8AA';
+                       $color['PaleGreen']                     = '#98FB98';
+                       $color['PaleTurquoise']         = '#AFEEEE';
+                       $color['PaleVioletRed']         = '#D87093';
+                       $color['PapayaWhip']            = '#FFEFD5';
+                       $color['PeachPuff']                     = '#FFDAB9';
+                       $color['Peru']                          = '#CD853F';
+                       $color['Pink']                          = '#FFC0CB';
+                       $color['Plum']                          = '#DDA0DD';
+                       $color['PowderBlue']            = '#B0E0E6';
+                       $color['Purple']                        = '#800080';
+                       $color['Red']                           = '#FF0000';
+                       $color['RosyBrown']                     = '#BC8F8F';
+                       $color['RoyalBlue']                     = '#4169E1';
+                       $color['SaddleBrown']           = '#8B4513';
+                       $color['Salmon']                        = '#FA8072';
+                       $color['SandyBrown']            = '#F4A460';
+                       $color['SeaGreen']                      = '#2E8B57';
+                       $color['SeaShell']                      = '#FFF5EE';
+                       $color['Sienna']                        = '#A0522D';
+                       $color['Silver']                        = '#C0C0C0';
+                       $color['SkyBlue']                       = '#87CEEB';
+                       $color['SlateBlue']                     = '#6A5ACD';
+                       $color['SlateGray']                     = '#708090';
+                       $color['SlateGrey']                     = '#708090';
+                       $color['Snow']                          = '#FFFAFA';
+                       $color['SpringGreen']           = '#00FF7F';
+                       $color['SteelBlue']                     = '#4682B4';
+                       $color['Tan']                           = '#D2B48C';
+                       $color['Teal']                          = '#008080';
+                       $color['Thistle']                       = '#D8BFD8';
+                       $color['Tomato']                        = '#FF6347';
+                       $color['Turquoise']                     = '#40E0D0';
+                       $color['Violet']                        = '#EE82EE';
+                       $color['Wheat']                         = '#F5DEB3';
+                       $color['White']                         = '#FFFFFF';
+                       $color['WhiteSmoke']            = '#F5F5F5';
+                       $color['Yellow']                        = '#FFFF00';
+                       $color['YellowGreen']           = '#9ACD32';
+                       
+                       $this->htmlColor = array();
+                       foreach($color as $key => $val) 
$this->htmlColor[strtolower($key)] = $val;                      
+                       unset($color);
+                       
+                       $this->table = array();
+                       
+                       $this->value = array();
+                       $this->initStyle();
+                       
+                       // initialisation des styles sans h\xE9ritages
+                       $this->resetStyle();
+               }
+               
+               function initStyle()
+               {
+                       $this->value['id_balise']                       = 
'body';               // balise
+                       $this->value['id_name']                         = null; 
                // name
+                       $this->value['id_id']                           = null; 
                // id
+                       $this->value['id_class']                        = null; 
                // class
+                       $this->value['id_lst']                          = 
array('*');   // lst de dependance
+                       $this->value['mini-size']                       = 1.;   
                // rapport de taille    sp\xE9cifique aux sup, sub
+                       $this->value['mini-decal']                      = 0;    
                // rapport de position  sp\xE9cifique aux sup, sub
+                       $this->value['font-family']                     = 
'Arial';
+                       $this->value['font-bold']                       = false;
+                       $this->value['font-italic']                     = false;
+                       $this->value['font-underline']          = false;
+                       $this->value['font-overline']           = false;
+                       $this->value['font-linethrough']        = false;
+                       $this->value['text-transform']          = 'none';
+                       $this->value['font-size']                       = 
$this->ConvertToMM('10pt');
+                       $this->value['text-indent']                     = 0;
+                       $this->value['text-align']                      = 
'left';
+                       $this->value['vertical-align']          = 'middle';
+                       $this->value['line-height']                     = 
'normal';
+
+                       $this->value['position']                        = null;
+                       $this->value['x']                                       
= null;
+                       $this->value['y']                                       
= null;
+                       $this->value['width']                           = 0;
+                       $this->value['height']                          = 0;
+                       $this->value['top']                                     
= null;
+                       $this->value['right']                           = null;
+                       $this->value['bottom']                          = null;
+                       $this->value['left']                            = null;
+                       $this->value['float']                           = null;
+                       $this->value['display']                         = null;
+                       $this->value['rotate']                          = null;
+
+                       $this->value['color']                           = 
array(0, 0, 0);
+                       $this->value['background']                      = 
array('color' => null, 'image' => null, 'position' => null, 'repeat' => null);
+                       $this->value['border']                          = 
array();
+                       $this->value['padding']                         = 
array();
+                       $this->value['margin']                          = 
array();
+                       $this->value['margin-auto']                     = false;
+
+                       $this->value['list-style-type']         = '';
+                       $this->value['list-style-image']        = '';
+
+                       $this->value['xc']                                      
= null;
+                       $this->value['yc']                                      
= null;
+               }
+               
+               /**
+                * Initialisation des styles sans h\xE9ritages
+                *
+                * @param       string  balise HTML
+                * @return      null
+                */
+               function resetStyle($balise = '')
+               {
+                       $collapse = isset($this->value['border']['collapse']) ? 
$this->value['border']['collapse'] : false;
+                       if (!in_array($balise, array('tr', 'td', 'th'))) 
$collapse = false;
+                       
+                       $this->value['position']                        = null;
+                       $this->value['x']                                       
= null;
+                       $this->value['y']                                       
= null;
+                       $this->value['width']                           = 0;
+                       $this->value['height']                          = 0;
+                       $this->value['top']                                     
= null;
+                       $this->value['right']                           = null;
+                       $this->value['bottom']                          = null;
+                       $this->value['left']                            = null;
+                       $this->value['float']                           = null;
+                       $this->value['display']                         = null;
+                       $this->value['rotate']                          = null;
+                       $this->value['background']                      = 
array('color' => null, 'image' => null, 'position' => null, 'repeat' => null);
+                       $this->value['border']  = array(
+                                                                               
't' => $this->readBorder('none'),
+                                                                               
'r' => $this->readBorder('none'),
+                                                                               
'b' => $this->readBorder('none'),
+                                                                               
'l' => $this->readBorder('none'),
+                                                                               
'radius' => array(0, 0),
+                                                                               
'collapse' => $collapse,
+                                                                       );
+
+                       if (!in_array($balise, array('h1', 'h2', 'h3', 'h4', 
'h5', 'h6')))
+                       $this->value['margin']  = array(
+                                                                       't' => 
0,
+                                                                       'r' => 
0,
+                                                                       'b' => 
0,
+                                                                       'l' => 0
+                                                               );
+                       $this->value['margin-auto'] = false;
+                       
+                       if (in_array($balise, array('div')))
+                               $this->value['vertical-align']   = 'top';
+
+                       if (in_array($balise, array('ul', 'li')))
+                       {
+                               $this->value['list-style-type']         = '';
+                               $this->value['list-style-image']        = '';
+                       }
+
+                       if (!in_array($balise, array('tr', 'td')))
+                       {
+                               $this->value['padding'] = array(
+                                                                               
't' => 0,
+                                                                               
'r' => 0,
+                                                                               
'b' => 0,
+                                                                               
'l' => 0
+                                                                       );
+                       }
+                       else
+                       {
+                               $this->value['padding'] = array(
+                                                                               
't' => $this->ConvertToMM('1px'),
+                                                                               
'r' => $this->ConvertToMM('1px'),
+                                                                               
'b' => $this->ConvertToMM('1px'),
+                                                                               
'l' => $this->ConvertToMM('1px')
+                                                                       );
+                       }
+                       
+                       if ($balise=='hr')
+                       {
+                               $this->value['border']  = array(
+                                                                               
't' => $this->readBorder('solid 1px #000000'),
+                                                                               
'r' => $this->readBorder('solid 1px #000000'),
+                                                                               
'b' => $this->readBorder('solid 1px #000000'),
+                                                                               
'l' => $this->readBorder('solid 1px #000000'),
+                                                                               
'radius' => array(0, 0),
+                                                                               
'collapse' => false,
+                                                                       );
+                               $this->ConvertBackground('#FFFFFF', 
$this->value['background']);
+                       }
+
+                       $this->value['xc']                                      
= null;
+                       $this->value['yc']                                      
= null;
+               }
+               
+               /**
+                * Initialisation de la font PDF
+                *
+                * @return      null
+                */
+               function FontSet()
+               {
+                       $b = ($this->value['font-bold']                 ? 'B' : 
'');
+                       $i = ($this->value['font-italic']               ? 'I' : 
'');
+                       $u = ($this->value['font-underline']    ? 'U' : '');
+                       
+                       // taille en mm, \xE0 ramener en pt
+                       $size = $this->value['font-size'];
+                       $size = 72 * $size / 25.4;
+                       
+                       $this->pdf->setOverline($this->value['font-overline']);
+                       
$this->pdf->setLinethrough($this->value['font-linethrough']);
+                       
+                       // application de la fonte 
+                       $this->pdf->SetFont($this->value['font-family'], 
$b.$i.$u, $this->value['mini-size']*$size);
+                       
$this->pdf->SetTextColor($this->value['color'][0],$this->value['color'][1], 
$this->value['color'][2]);
+                       if ($this->value['background']['color'])
+                               
$this->pdf->SetFillColor($this->value['background']['color'][0],$this->value['background']['color'][1],
 $this->value['background']['color'][2]);
+                       else
+                               $this->pdf->SetFillColor(255);                  
        
+               }
+
+               /**
+                * Monter d'un niveau dans l'historisation
+                *
+                * @return      null
+                */             
+               function save()
+               {
+                       $this->table[count($this->table)] = $this->value;
+               }
+               
+               /**
+                * Descendre d'un niveau dans l'historisation
+                *
+                * @return      null
+                */             
+               function load()
+               {
+                       if (count($this->table))
+                       {
+                               $this->value = 
$this->table[count($this->table)-1];
+                               unset($this->table[count($this->table)-1]);
+                       }
+               }
+
+               function restorePosition(&$current_x, &$current_y)
+               {
+                       if ($this->value['y']==$current_y) $current_y = 
$this->value['yc'];
+               }
+               
+               function setPosition(&$current_x, &$current_y)
+               {
+                       $this->value['xc'] = $current_x;
+                       $this->value['yc'] = $current_y;
+                       
+                       if ($this->value['position']=='relative' || 
$this->value['position']=='absolute')
+                       {
+                               if ($this->value['right']!==null)
+                               {
+                                       $x = $this->getLastWidth(true) - 
$this->value['right'] - $this->value['width'];
+                                       if ($this->value['margin']['r']) $x-= 
$this->value['margin']['r'];
+                               } 
+                               else
+                               {
+                                       $x = $this->value['left'];
+                                       if ($this->value['margin']['l']) $x+= 
$this->value['margin']['l'];
+                               }
+                               
+                               if ($this->value['bottom']!==null)
+                               {
+                                       $y = $this->getLastHeight(true) - 
$this->value['bottom'] - $this->value['height'];
+                                       if ($this->value['margin']['b']) $y-= 
$this->value['margin']['b'];
+                               }       
+                               else
+                               {
+                                       $y = $this->value['top'];
+                                       if ($this->value['margin']['t']) $y+= 
$this->value['margin']['t'];
+                               }
+                                                               
+                               if ($this->value['position']=='relative')
+                               {
+                                       $this->value['x'] = $current_x + $x;
+                                       $this->value['y'] = $current_y + $y;
+                               }
+                               else
+                               {
+                                       $this->value['x'] = 
$this->getLastAbsoluteX()+$x;
+                                       $this->value['y'] = 
$this->getLastAbsoluteY()+$y;                                       
+                               }
+                       }
+                       else
+                       {
+                               $this->value['x'] = $current_x;
+                               $this->value['y'] = $current_y; 
+                               if ($this->value['margin']['l'])        
$this->value['x']+= $this->value['margin']['l'];
+                               if ($this->value['margin']['t'])        
$this->value['y']+= $this->value['margin']['t'];
+                       }
+                       
+                       $current_x = $this->value['x'];
+                       $current_y = $this->value['y'];
+               }
+
+               /**
+                * Analyse un tableau de style provenant du parseurHTML
+                *
+                * @param       string  nom de la balise
+                * @param       array   tableau de style
+                * @return      null
+                */                     
+               function analyse($balise, &$param)
+               {
+                       // preparation
+                       $balise = strtolower($balise);
+                       $id             = isset($param['id'])           ? 
strtolower(trim($param['id']))        : null; if (!$id)       $id             = 
null;
+                       $name   = isset($param['name'])         ? 
strtolower(trim($param['name']))      : null; if (!$name)     $name   = null;
+
+                       // lecture de la propriete classe
+                       $class = array();
+                       $tmp    = isset($param['class'])        ? 
preg_replace('/[\s]+/', ' ', strtolower($param['class']))     : '';
+                       $tmp = explode(' ', $tmp);
+                       foreach($tmp as $k => $v)
+                       {
+                               $v = trim($v);
+                               if ($v) $class[] = $v;
+                       }
+
+                       // identification de la balise et des styles direct qui 
pourraient lui \xEAtre appliqu\xE9s
+                       $this->value['id_balise']       = $balise;
+                       $this->value['id_name']         = $name;
+                       $this->value['id_id']           = $id;
+                       $this->value['id_class']        = $class;
+                       $this->value['id_lst']          = array();
+                       $this->value['id_lst'][] = '*';
+                       $this->value['id_lst'][] = $balise;
+                       if (count($class))
+                       {
+                               foreach($class as $v)
+                               { 
+                                       $this->value['id_lst'][] = '*.'.$v;
+                                       $this->value['id_lst'][] = '.'.$v;
+                                       $this->value['id_lst'][] = 
$balise.'.'.$v;
+                               }
+                       }
+                       if ($id)
+                       {
+                               $this->value['id_lst'][] = '*#'.$id;
+                               $this->value['id_lst'][] = '#'.$id;
+                               $this->value['id_lst'][] = $id.'#'.$id;
+                       }
+
+                       // style CSS
+                       $styles = $this->getFromCSS();
+
+                       // on ajoute le style propre \xE0 la balise
+                       $styles = array_merge($styles, $param['style']);
+                       if (isset($param['allwidth']) && 
!isset($styles['width'])) $styles['width'] = '100%';
+
+                       // mise \xE0 zero des styles non h\xE9rit\xE9s
+                       $this->resetStyle($balise);
+                                       
+                       // interpreration des nouvelles valeurs
+                       $correct_width = false;
+                       $no_width = true;
+
+                       foreach($styles as $nom => $val)
+                       {
+                               switch($nom)
+                               {
+                                       case 'font-family':
+                                               $val = explode(',', $val);
+                                               $val = trim($val[0]);
+
+                                               if ($val) 
$this->value['font-family'] = $val;
+                                               break;
+                                               
+                                       case 'font-weight':
+                                               $this->value['font-bold'] = 
($val=='bold');
+                                               break;
+                                       
+                                       case 'font-style':
+                                               $this->value['font-italic'] = 
($val=='italic');
+                                               break;
+                                       
+                                       case 'text-decoration':
+                                               $val = explode(' ', $val);
+                                               $this->value['font-underline']  
        = (in_array('underline',        $val));
+                                               $this->value['font-overline']   
        = (in_array('overline',         $val));
+                                               
$this->value['font-linethrough']        = (in_array('line-through',     $val));
+                                               break;
+                                       
+                                       case 'text-indent':
+                                               $this->value['text-indent']     
                = $this->ConvertToMM($val);
+                                               break;
+                                       
+                                       case 'text-transform':
+                                               if (!in_array($val, 
array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none';
+                                               $this->value['text-transform']  
        = $val;
+                                               break;
+                                               
+                                       case 'font-size':
+                                               $val = $this->ConvertToMM($val, 
$this->value['font-size']);
+                                               if ($val) 
$this->value['font-size'] = $val;
+                                               break;
+                                       
+                                       case 'color':
+                                               $res = null;
+                                               $this->value['color'] = 
$this->ConvertToRVB($val, $res);
+                                               
+                                               if ($balise=='hr')
+                                               {
+                                                       
$this->value['border']['l']['color'] = $this->value['color'];
+                                                       
$this->value['border']['t']['color'] = $this->value['color'];
+                                                       
$this->value['border']['r']['color'] = $this->value['color'];
+                                                       
$this->value['border']['b']['color'] = $this->value['color'];
+                                               }
+                                               break;
+                                       
+                                       case 'text-align':
+                                               $this->value['text-align'] = 
$val;
+                                               break;
+                                               
+                                       case 'vertical-align':
+                                               $this->value['vertical-align'] 
= $val;
+                                               break;
+                                       
+                                       case 'width':
+                                               $this->value['width'] = 
$this->ConvertToMM($val, $this->getLastWidth());
+                                               if ($this->value['width'] && 
substr($val, -1)=='%') $correct_width=true;
+                                               $no_width = false;
+                                               break;
+                                       
+                                       case 'height':
+                                               $this->value['height'] = 
$this->ConvertToMM($val, $this->getLastHeight());
+                                               break;
+                               
+                                       case 'line-height':
+                                               if 
(preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val*100).'%';
+                                               $this->value['line-height'] = 
$val;
+                                               break;
+                                       case 'rotate':
+                                               if (!in_array($val, array(0, 
-90, 90, 180, 270, -180, -270))) $val = null;
+                                               if ($val<0) $val+= 360;
+                                               $this->value['rotate'] = $val;
+                                               break;
+                                       case 'padding':
+                                               $val = explode(' ', $val);
+                                               foreach($val as $k => $v)
+                                               {
+                                                       $v = trim($v);
+                                                       if ($v!='') $val[$k] = 
$v;
+                                                       else    unset($val[$k]);
+                                               }
+                                               $val = array_values($val);
+                                               if (count($val)!=4)
+                                               {
+                                                       $val = 
$this->ConvertToMM($val[0], 0);
+                                                       
$this->value['padding']['t'] = $val;
+                                                       
$this->value['padding']['r'] = $val;
+                                                       
$this->value['padding']['b'] = $val;
+                                                       
$this->value['padding']['l'] = $val;
+                                               }
+                                               else
+                                               {
+                                                       
$this->value['padding']['t'] = $this->ConvertToMM($val[0], 0);
+                                                       
$this->value['padding']['r'] = $this->ConvertToMM($val[1], 0);
+                                                       
$this->value['padding']['b'] = $this->ConvertToMM($val[2], 0);
+                                                       
$this->value['padding']['l'] = $this->ConvertToMM($val[3], 0);                  
                                
+                                               }
+                                               break;
+                                               
+                                       case 'padding-top':
+                                               $this->value['padding']['t'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+
+                                       case 'padding-right':
+                                               $this->value['padding']['r'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+
+                                       case 'padding-bottom':
+                                               $this->value['padding']['b'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+
+                                       case 'padding-left':
+                                               $this->value['padding']['l'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+                                                                               
                
+                                       case 'margin':
+                                               if ($val=='auto')
+                                               {
+                                                       
$this->value['margin-auto'] = true;
+                                                       break;  
+                                               }
+                                               $val = explode(' ', $val);
+                                               foreach($val as $k => $v)
+                                               {
+                                                       $v = trim($v);
+                                                       if ($v!='') $val[$k] = 
$v;
+                                                       else    unset($val[$k]);
+                                               }
+                                               $val = array_values($val);
+                                               if (count($val)!=4)
+                                               {
+                                                       $val = 
$this->ConvertToMM($val[0], 0);
+                                                       
$this->value['margin']['t'] = $val;
+                                                       
$this->value['margin']['r'] = $val;
+                                                       
$this->value['margin']['b'] = $val;
+                                                       
$this->value['margin']['l'] = $val;
+                                               }
+                                               else
+                                               {
+                                                       
$this->value['margin']['t'] = $this->ConvertToMM($val[0], 0);
+                                                       
$this->value['margin']['r'] = $this->ConvertToMM($val[1], 0);
+                                                       
$this->value['margin']['b'] = $this->ConvertToMM($val[2], 0);
+                                                       
$this->value['margin']['l'] = $this->ConvertToMM($val[3], 0);                   
                                
+                                               }
+                                               break;
+                                               
+                                       case 'margin-top':
+                                               $this->value['margin']['t'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+
+                                       case 'margin-right':
+                                               $this->value['margin']['r'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+
+                                       case 'margin-bottom':
+                                               $this->value['margin']['b'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+
+                                       case 'margin-left':
+                                               $this->value['margin']['l'] = 
$this->ConvertToMM($val, 0);
+                                               break;
+       
+                                       case 'border':
+                                               $val = $this->readBorder($val);
+                                               $this->value['border']['t'] = 
$val;
+                                               $this->value['border']['r'] = 
$val;
+                                               $this->value['border']['b'] = 
$val;
+                                               $this->value['border']['l'] = 
$val;
+                                               break;
+                                               
+                                       case 'border-style':
+                                               $val = explode(' ', $val);
+                                               foreach($val as $val_k => 
$val_v)
+                                                       if (!in_array($val_v, 
array('solid', 'dotted', 'dashed')))
+                                                               $val[$val_k] = 
null; 
+                                               $this->duplicateBorder($val);
+                                               
+                                               if ($val[0]) 
$this->value['border']['t']['type'] = $val[0];
+                                               if ($val[1]) 
$this->value['border']['r']['type'] = $val[1];
+                                               if ($val[2]) 
$this->value['border']['b']['type'] = $val[2];
+                                               if ($val[3]) 
$this->value['border']['l']['type'] = $val[3];
+                                               break;
+
+                                       case 'border-top-style':
+                                               if (in_array($val, 
array('solid', 'dotted', 'dashed'))) 
+                                                       
$this->value['border']['t']['type'] = $val;
+                                               break;
+
+                                       case 'border-right-style':
+                                               if (in_array($val, 
array('solid', 'dotted', 'dashed'))) 
+                                                       
$this->value['border']['r']['type'] = $val;
+                                               break;
+
+                                       case 'border-bottom-style':
+                                               if (in_array($val, 
array('solid', 'dotted', 'dashed'))) 
+                                                       
$this->value['border']['b']['type'] = $val;
+                                               break;
+
+                                       case 'border-left-style':
+                                               if (in_array($val, 
array('solid', 'dotted', 'dashed'))) 
+                                                       
$this->value['border']['l']['type'] = $val;
+                                               break;
+
+                                       case 'border-color':
+                                               $res = false;
+                                               $val = preg_replace('/,[\s]+/', 
',', $val); 
+                                               $val = explode(' ', $val);
+
+                                               foreach($val as $val_k => 
$val_v)
+                                               {
+                                                               $val[$val_k] = 
$this->ConvertToRVB($val_v, $res);
+                                                               if (!$res) 
$val[$val_k] = null;
+                                               }
+                                               $this->duplicateBorder($val);
+
+                                               if (is_array($val[0])) 
$this->value['border']['t']['color'] = $val[0];
+                                               if (is_array($val[1])) 
$this->value['border']['r']['color'] = $val[1];
+                                               if (is_array($val[2])) 
$this->value['border']['b']['color'] = $val[2];
+                                               if (is_array($val[3])) 
$this->value['border']['l']['color'] = $val[3];
+                                               
+                                               break;
+
+                                       case 'border-top-color':
+                                               $res = false;
+                                               $val = 
$this->ConvertToRVB($val, $res); 
+                                               if ($res) 
$this->value['border']['t']['color'] = $val;
+                                               break;
+
+                                       case 'border-right-color':
+                                               $res = false;
+                                               $val = 
$this->ConvertToRVB($val, $res); 
+                                               if ($res) 
$this->value['border']['r']['color'] = $val;
+                                               break;
+
+                                       case 'border-bottom-color':
+                                               $res = false;
+                                               $val = 
$this->ConvertToRVB($val, $res); 
+                                               if ($res) 
$this->value['border']['b']['color'] = $val;
+                                               break;
+
+                                       case 'border-left-color':
+                                               $res = false;
+                                               $val = 
$this->ConvertToRVB($val, $res); 
+                                               if ($res) 
$this->value['border']['l']['color'] = $val;
+                                               break;
+                                               
+                                       case 'border-width':
+                                               $val = explode(' ', $val);
+                                               foreach($val as $val_k => 
$val_v)
+                                               {
+                                                               $val[$val_k] = 
$this->ConvertToMM($val_v, 0);
+                                               }
+                                               $this->duplicateBorder($val);
+                                               
+                                               if ($val[0]) 
$this->value['border']['t']['width'] = $val[0];
+                                               if ($val[1]) 
$this->value['border']['r']['width'] = $val[1];
+                                               if ($val[2]) 
$this->value['border']['b']['width'] = $val[2];
+                                               if ($val[3]) 
$this->value['border']['l']['width'] = $val[3];
+                                               break;
+
+                                       case 'border-top-width':
+                                               $val = $this->ConvertToMM($val, 
0);; 
+                                               if ($val) 
$this->value['border']['t']['width'] = $val;
+                                               break;
+
+                                       case 'border-right-width':
+                                               $val = $this->ConvertToMM($val, 
0);; 
+                                               if ($val) 
$this->value['border']['r']['width'] = $val;
+                                               break;
+
+                                       case 'border-bottom-width':
+                                               $val = $this->ConvertToMM($val, 
0);; 
+                                               if ($val) 
$this->value['border']['b']['width'] = $val;
+                                               break;
+
+                                       case 'border-left-width':
+                                               $val = $this->ConvertToMM($val, 
0);; 
+                                               if ($val) 
$this->value['border']['l']['width'] = $val;
+                                               break;
+                                                                               
        
+                                       case 'border-collapse':
+                                               if ($balise=='table') 
$this->value['border']['collapse'] = ($val=='collapse');
+                                               break;
+                                               
+                                       case 'border-radius':
+                                               // nettoyage des valeurs
+                                               $val = explode(' ', $val);
+                                               foreach($val as $k => $v)
+                                               {
+                                                       $v = trim($v);
+                                                       if ($v)
+                                                       {
+                                                               $v = 
$this->ConvertToMM($v, 0);
+                                                               if ($v) 
$val[$k] = $v;
+                                                               else    
unset($val[$k]);
+                                                       }
+                                                       else    
unset($val[$k]);        
+                                               }
+                                               $val = array_values($val);
+                                               
+                                               if (!isset($val[1]) && 
isset($val[0])) $val[1] = $val[0];
+                                               if (count($val)==2)
+                                                       
$this->value['border']['radius'] = array($val[0], $val[1]);
+
+                                               break;
+                                               
+                                       case 'border-top':
+                                               $this->value['border']['t'] = 
$this->readBorder($val);
+                                               break;
+
+                                       case 'border-right':
+                                               $this->value['border']['r'] = 
$this->readBorder($val);
+                                               break;
+
+                                       case 'border-bottom':
+                                               $this->value['border']['b'] = 
$this->readBorder($val);
+                                               break;
+
+                                       case 'border-left':
+                                               $this->value['border']['l'] = 
$this->readBorder($val);
+                                               break;
+                                       
+                                       case 'background-color':
+                                               
$this->value['background']['color'] = $this->ConvertBackgroundColor($val);
+                                               break;
+
+                                       case 'background-image':
+                                               
$this->value['background']['image'] = $this->ConvertBackgroundImage($val);
+                                               break;
+
+                                       case 'background-position':
+                                               $res = null;
+                                               
$this->value['background']['position'] = $this->ConvertBackgroundPosition($val, 
$res);
+                                               break;
+
+                                       case 'background-repeat':
+                                               
$this->value['background']['repeat'] = $this->ConvertBackgroundRepeat($val);
+                                               break;
+
+                                       case 'background':
+                                               $this->ConvertBackground($val, 
$this->value['background']);
+                                               break;
+
+                                       case 'position':
+                                               if ($val=='absolute')           
$this->value['position'] = 'absolute';
+                                               else if ($val=='relative')      
$this->value['position'] = 'relative';
+                                               else                            
                $this->value['position'] = null;
+                                               break;
+
+                                       case 'float':
+                                               if ($val=='left')               
        $this->value['float'] = 'left';
+                                               else if ($val=='right')         
$this->value['float'] = 'right';
+                                               else                            
                $this->value['float'] = null;
+                                               break;
+
+                                       case 'display':
+                                               if ($val=='inline')             
        $this->value['display'] = 'inline';
+                                               else if ($val=='block')         
$this->value['display'] = 'block';
+                                               else if ($val=='none')          
$this->value['display'] = 'none';
+                                               else                            
                $this->value['display'] = null;
+                                               break;
+                                                                               
        
+                                       case 'top':
+                                       case 'bottom':
+                                       case 'left':
+                                       case 'right':
+                                               $this->value[$nom] = $val;
+                                               break;
+
+                                       case 'list-style':
+                                       case 'list-style-type':
+                                       case 'list-style-image':
+                                               if ($nom=='list-style') $nom = 
'list-style-type';
+                                               $this->value[$nom] = $val;
+                                               break;
+                               
+                                       default:
+                                               break;  
+                               }                               
+                       }
+
+                       if ($this->onlyLeft) $this->value['text-align'] = 
'left';
+                       
+                       // correction de la largeur pour correspondre au 
mod\xE8le de boite quick
+                       if ($no_width && in_array($balise, array('div')) && 
$this->value['position']!='absolute')
+                       {
+                               $this->value['width'] = $this->getLastWidth();
+                               $this->value['width']-= 
$this->value['margin']['l'] + $this->value['margin']['r'];
+                       }
+                       else
+                       {
+                               if ($correct_width)
+                               {
+                                       if (!in_array($balise, array('table', 
'div', 'hr')))
+                                       {
+                                               $this->value['width']-= 
$this->value['padding']['l'] + $this->value['padding']['r'];
+                                               $this->value['width']-= 
$this->value['border']['l']['width'] + $this->value['border']['r']['width'];
+                                       }
+                                       if (in_array($balise, array('th', 
'td')))
+                                       {
+                                               $this->value['width']-= 
$this->ConvertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : 
'2px');
+                                       }
+                                       if ($this->value['width']<0) 
$this->value['width']=0;
+                               }
+                               else
+                               {
+                                       if ($this->value['width'])
+                                       {
+                                               if 
($this->value['border']['l']['width'])       $this->value['width']   += 
$this->value['border']['l']['width'];
+                                               if 
($this->value['border']['r']['width'])       $this->value['width']   += 
$this->value['border']['r']['width'];                        
+                                               if 
($this->value['padding']['l'])                       $this->value['width']   += 
$this->value['padding']['l'];
+                                               if 
($this->value['padding']['r'])                       $this->value['width']   += 
$this->value['padding']['r'];
+                                       }               
+                               }
+                       }
+                       if ($this->value['height'])
+                       {
+                               if ($this->value['border']['b']['width']) { 
$this->value['height']      += $this->value['border']['b']['width']; }
+                               if ($this->value['border']['t']['width']) { 
$this->value['height']      += $this->value['border']['t']['width']; }
+                               if ($this->value['padding']['b'])               
        $this->value['height']  += $this->value['padding']['b'];
+                               if ($this->value['padding']['t'])               
        $this->value['height']  += $this->value['padding']['t'];                
+                       }                       
+                       
+                       if ($this->value['top']!=null)          
$this->value['top']             = $this->ConvertToMM($this->value['top'],       
        $this->getLastHeight(true));
+                       if ($this->value['bottom']!=null)       
$this->value['bottom']  = $this->ConvertToMM($this->value['bottom'],    
$this->getLastHeight(true));
+                       if ($this->value['left']!=null)         
$this->value['left']    = $this->ConvertToMM($this->value['left'],              
$this->getLastWidth(true));
+                       if ($this->value['right']!=null)        
$this->value['right']   = $this->ConvertToMM($this->value['right'],             
$this->getLastWidth(true));
+                       
+                       if ($this->value['top'] && $this->value['bottom'] && 
$this->value['height'])    $this->value['bottom']  = null;
+                       if ($this->value['left'] && $this->value['right'] && 
$this->value['width'])             $this->value['right']   = null;
+               }
+               
+               /**
+                * R\xE9cup\xE9ration de la hauteur de ligne courante
+                *
+                * @return      float   hauteur en mm
+                */
+               function getLineHeight()
+               {
+                       $val = $this->value['line-height'];
+                       if ($val=='normal') $val = '108%';
+                       return $this->ConvertToMM($val, 
$this->value['font-size']);
+               }
+               
+               /**
+                * R\xE9cup\xE9ration de la largeur de l'objet parent
+                *
+                * @return      float   largeur
+                */
+               function getLastWidth($mode = false)
+               {
+                       for($k=count($this->table); $k>0; $k--)
+                       {
+                               if ($this->table[$k-1]['width'])
+                               {
+                                       $w = $this->table[$k-1]['width'];
+                                       if ($mode)
+                                       {
+                                               $w+= 
$this->table[$k-1]['border']['l']['width'] + 
$this->table[$k-1]['padding']['l']+0.02;
+                                               $w+= 
$this->table[$k-1]['border']['r']['width'] + 
$this->table[$k-1]['padding']['r']+0.02;
+                                       }
+                                       return $w;
+                               }
+                       }
+                       return $this->pdf->w - $this->pdf->lMargin - 
$this->pdf->rMargin;
+               }
+
+               /**
+                * R\xE9cup\xE9ration de la hauteur de l'objet parent
+                *
+                * @return      float   hauteur
+                */
+               function getLastHeight($mode = false)
+               {
+                       for($k=count($this->table); $k>0; $k--)
+                       {
+                               if ($this->table[$k-1]['height'])
+                               {
+                                       $h = $this->table[$k-1]['height'];
+                                       if ($mode)
+                                       {
+                                               $h+= 
$this->table[$k-1]['border']['t']['width'] + 
$this->table[$k-1]['padding']['t']+0.02;
+                                               $h+= 
$this->table[$k-1]['border']['b']['width'] + 
$this->table[$k-1]['padding']['b']+0.02;
+                                       }
+                                       return $h;
+                               }
+                       }
+                       return $this->pdf->h - $this->pdf->tMargin - 
$this->pdf->bMargin;
+               }
+               
+               function getFloat()
+               {
+                       if ($this->value['float']=='left')      return 'left';
+                       if ($this->value['float']=='right')     return 'right';
+                       return null;
+               }
+               
+               function getParentBalise()
+               {
+                       $nb = count($this->table);
+                       if ($nb>0)
+                               return $this->table[$nb-1]['id_balise'];
+                       return null;
+               }
+               
+               function getLastAbsoluteX()
+               {
+                       for($k=count($this->table); $k>0; $k--)
+                       {
+                               if ($this->table[$k-1]['x'] && 
$this->table[$k-1]['position']) return $this->table[$k-1]['x'];
+                       }
+                       return $this->pdf->lMargin;
+               }
+               
+               function getLastAbsoluteY()
+               {
+                       for($k=count($this->table); $k>0; $k--)
+                       {
+                               if ($this->table[$k-1]['y'] && 
$this->table[$k-1]['position']) return $this->table[$k-1]['y'];
+                       }
+                       return $this->pdf->tMargin;
+               }
+               
+               /**
+                * R\xE9cup\xE9ration des propri\xE9t\xE9s CSS de la balise en 
cours
+                *
+                * @return      array()         tableau des propri\xE9t\xE9s CSS
+                */             
+               function getFromCSS()
+               {
+                       $styles = array();      // style \xE0 appliquer
+                       $getit  = array();      // styles \xE0 r\xE9cuperer
+
+                       // identification des styles direct, et ceux des parents
+                       $lst = array();
+                       $lst[] = $this->value['id_lst'];
+                       for($i=count($this->table)-1; $i>=0; $i--) $lst[] = 
$this->table[$i]['id_lst'];
+
+                       // identification des styles \xE0 r\xE9cuperer
+                       foreach($this->css_keys as $key => $num)
+                               if ($this->getReccursiveStyle($key, $lst))
+                                       $getit[$key] = $num;
+
+                       // si des styles sont \xE0 recuperer
+                       if (count($getit))
+                       {
+                               // on les r\xE9cup\xE8re, mais dans l'odre de 
d\xE9finition, afin de garder les priorit\xE9s
+                               asort($getit);
+                               foreach($getit as $key => $val) $styles = 
array_merge($styles, $this->css[$key]);                               
+                       }
+                       
+                       return $styles; 
+               }
+               
+               /**
+                * Identification des styles \xE0 r\xE9cuperer, en fonction de 
la balise et de ses parents
+                *
+                * @param       string          clef CSS \xE0 analyser
+                * @param       array()         tableau des styles direct, et 
ceux des parents
+                * @param       string          prochaine etape
+                * @return      boolean         clef autoris\xE9e ou non
+                */
+               function getReccursiveStyle($key, $lst, $next = null)
+               {
+                       // si propchaine etape, on construit les valeurs
+                       if ($next!==null)
+                       {
+                               if ($next) $key = trim(substr($key, 0, 
-strlen($next))); // on el\xE8ve cette etape
+                               unset($lst[0]);
+                               if (!count($lst)) return false; // pas d'etape 
possible
+                               $lst = array_values($lst);
+                       }
+                       
+                       // pour chaque style direct possible de l'etape en cours
+                       foreach($lst[0] as $nom)
+                       {
+                               if ($key==$nom) return true; // si la clef 
conrrespond => ok
+                               if (substr($key, -strlen(' '.$nom))==' '.$nom 
&& $this->getReccursiveStyle($key, $lst, $nom)) return true; // si la clef est 
la fin, on analyse ce qui pr\xE9c\xE8de
+                       }
+
+                       // si on est pas \xE0 la premiere etape, on doit 
analyse toutes les sous etapes                 
+                       if ($next!==null && $this->getReccursiveStyle($key, 
$lst, '')) return true;
+               
+                       // aucun style trouv\xE9        
+                       return false;   
+               }
+               
+               /**
+                * Analyse d'une propri\xE9t\xE9 Border
+                *
+                * @param       string          propri\xE9t\xE9 border
+                * @return      array()         propri\xE9t\xE9 d\xE9cod\xE9e
+                */
+               function readBorder($val)
+               {
+                       $none = array('type' => 'none', 'width' => 0, 'color' 
=> array(0, 0, 0));
+
+                       // valeurs par d\xE9fault
+                       $type   = 'solid';
+                       $width  = $this->ConvertToMM('1pt');
+                       $color  = array(0, 0, 0);
+
+                       // nettoyage des valeurs
+                       $val = explode(' ', $val);
+                       foreach($val as $k => $v)
+                       {
+                               $v = trim($v);
+                               if ($v) $val[$k] = $v;
+                               else    unset($val[$k]);        
+                       }
+                       $val = array_values($val);
+                       // identification des valeurs
+                       $res = null;
+                       foreach($val as $key)
+                       {
+                               if ($key=='none' || $key=='hidden') return 
$none;
+                               
+                               if ($this->ConvertToMM($key)!==null)            
                                        $width = $this->ConvertToMM($key);      
+                               else if (in_array($key, array('solid', 
'dotted', 'dashed')))    $type = $key;   
+                               else
+                               {
+                                       $tmp = $this->ConvertToRVB($key, $res);
+                                       if ($res) $color = $tmp;
+                               }
+                       }
+                       if (!$width) return $none;
+                       return array('type' => $type, 'width' => $width, 
'color' => $color);
+               }
+               
+               function duplicateBorder(&$val)
+               {
+                       if (count($val)==1)
+                       {
+                               $val[1] = $val[0];
+                               $val[2] = $val[0];
+                               $val[3] = $val[0];
+                       }
+                       else if (count($val)==2)
+                       {
+                               $val[2] = $val[0];
+                               $val[3] = $val[1];
+                       }
+                       else if (count($val)==3)
+                       {
+                               $val[3] = $val[1];
+                       }
+               }
+
+               function ConvertBackground($stl, &$res)
+               {
+                       // Image
+                       $text = '/url\(([^)]*)\)/isU';
+                       if (preg_match($text, $stl, $match))
+                       {
+                               $res['image'] = 
$this->ConvertBackgroundImage($match[0]);                               
+                               $stl = preg_replace($text, '', $stl);
+                               $stl = preg_replace('/[\s]+/', ' ', $stl);
+                       }
+                       
+                       // protection des espaces 
+                       $stl = preg_replace('/,[\s]+/', ',', $stl); 
+                       $lst = explode(' ', $stl);
+                       
+                       $pos = '';
+                       foreach($lst as $val)
+                       {
+                               $ok = false;
+                               $color = $this->ConvertToRVB($val, $ok);
+                               
+                               if ($ok)
+                               {
+                                       $res['color'] = $color;
+                               }
+                               else if ($val=='transparent')
+                               {
+                                       $res['color'] = null;
+                               }
+                               else
+                               {
+                                       $repeat = 
$this->ConvertBackgroundRepeat($val);
+                                       if ($repeat)
+                                       {
+                                               $res['repeat'] = $repeat;
+                                       }
+                                       else
+                                       {
+                                               $pos.= ($pos ? ' ' : '').$val;
+                                       }
+                               }
+                       }
+                       if ($pos)
+                       {
+                               $pos = $this->ConvertBackgroundPosition($pos, 
$ok);
+                               if ($ok) $res['position'] = $pos;
+                       }
+               }
+
+               function ConvertBackgroundColor($val)
+               {
+                       $res = null;
+                       if ($val=='transparent')        return null;
+                       else                                            return 
$this->ConvertToRVB($val, $res);
+               }
+
+               function ConvertBackgroundImage($val)
+               {
+                       if ($val=='none')
+                               return null;
+                       else if (preg_match('/^url\(([^)]*)\)$/isU', $val, 
$match))
+                               return $match[1];
+                       else
+                               return null;
+               }
+               
+               function ConvertBackgroundPosition($val, &$res)
+               {
+                       $val = explode(' ', $val);
+                       if (count($val)<2)
+                       {
+                               if (!$val[0]) return null;
+                               $val[1] = 'center';
+                       }
+                       if (count($val)>2) return null;
+
+                       $x = 0;
+                       $y = 0;
+                       $res = true;
+                       
+                       if ($val[0]=='left')            $x = '0%';
+                       else if ($val[0]=='center')     $x = '50%';
+                       else if ($val[0]=='right')      $x = '100%';
+                       else if ($val[0]=='top')        $y = '0%';
+                       else if ($val[0]=='bottom')     $y = '100%';
+                       else if (preg_match('/^[-]?[0-9\.]+%$/isU',     
$val[0])) $x = $val[0];
+                       else if ($this->ConvertToMM($val[0])) $x = 
$this->ConvertToMM($val[0]);
+                       else $res = false;
+                       
+                       if ($val[1]=='left')            $x = '0%';
+                       else if ($val[1]=='right')      $x = '100%';
+                       else if ($val[1]=='top')        $y = '0%';
+                       else if ($val[1]=='center')     $y = '50%';
+                       else if ($val[1]=='bottom')     $y = '100%';
+                       else if (preg_match('/^[-]?[0-9\.]+%$/isU',     
$val[1])) $y = $val[1];
+                       else if ($this->ConvertToMM($val[1])) $y = 
$this->ConvertToMM($val[1]);
+                       else $res = false;
+
+                       $val[0] = $x;
+                       $val[1] = $y;
+                       
+                       return $val;    
+               }
+               
+               function ConvertBackgroundRepeat($val)
+               {
+                       switch($val)
+                       {
+                               case 'repeat':
+                                       return array(true, true);
+                               case 'repeat-x':
+                                       return array(true, false);
+                               case 'repeat-y':
+                                       return array(false, true);
+                               case 'no-repeat':
+                                       return array(false, false);
+                       }
+                       return null;
+               }
+               /**
+                * Convertir une longueur en mm
+                *
+                * @param       string                  longueur, avec 
unit\xE9, \xE0 convertir
+                * @param       float                   longueur du parent
+                * @return      float                   longueur exprim\xE9e en 
mm
+                */     
+               function ConvertToMM($val, $old=0.)
+               {
+                       $val = trim($val);
+                       if (preg_match('/^[0-9\.\-]+$/isU', $val))              
        $val.= 'px';
+                       if (preg_match('/^[0-9\.\-]+px$/isU', $val))            
$val = 25.4/96. * str_replace('px', '', $val);
+                       else if (preg_match('/^[0-9\.\-]+pt$/isU', $val))       
$val = 25.4/72. * str_replace('pt', '', $val);
+                       else if (preg_match('/^[0-9\.\-]+in$/isU', $val))       
$val = 25.4 * str_replace('in', '', $val);
+                       else if (preg_match('/^[0-9\.\-]+mm$/isU', $val))       
$val = 1.*str_replace('mm', '', $val);
+                       else if (preg_match('/^[0-9\.\-]+%$/isU', $val))        
$val = 1.*$old*str_replace('%', '', $val)/100.;
+                       else                                                    
                                        $val = null;    
+
+                       return $val;
+               }
+               
+               /**
+                * D\xE9composition d'un code couleur HTML
+                *
+                * @param       string                  couleur au format CSS
+                * @return      array(r, v, b)  couleur exprim\xE9 par ses 
comporantes R, V, B, de 0 \xE0 255.
+                */     
+               function ConvertToRVB($val, &$res)
+               {
+                       $val = trim($val);
+                       $res = true;
+                               
+                       if (strtolower($val)=='transparent') return array(null, 
null, null);
+                       if (isset($this->htmlColor[strtolower($val)])) $val = 
$this->htmlColor[strtolower($val)];
+                       
+                       if 
(preg_match('/rgb\([\s]*([0-9%]+)[\s]*,[\s]*([0-9%]+)[\s]*,[\s]*([0-9%]+)[\s]*\)/isU',
 $val, $match))
+                       {
+                               $r =$match[1]; if (substr($r, -1)=='%') $r = 
floor(255*substr($r, 0, -1)/100);
+                               $v =$match[2]; if (substr($v, -1)=='%') $v = 
floor(255*substr($v, 0, -1)/100);
+                               $b =$match[3]; if (substr($b, -1)=='%') $b = 
floor(255*substr($b, 0, -1)/100);
+                       }
+                       else if (strlen($val)==7 && substr($val, 0, 1)=='#')
+                       {
+                               $r = hexdec(substr($val, 1, 2));
+                               $v = hexdec(substr($val, 3, 2));
+                               $b = hexdec(substr($val, 5, 2));
+                       }
+                       else if (strlen($val)==4 && substr($val, 0, 1)=='#')
+                       {
+                               $r = hexdec(substr($val, 1, 1).substr($val, 1, 
1));
+                               $v = hexdec(substr($val, 2, 1).substr($val, 2, 
1));
+                               $b = hexdec(substr($val, 3, 1).substr($val, 3, 
1));
+                       }
+                       else
+                       {
+                               $r=0;
+                               $v=0;
+                               $b=0;
+                               $res = false;
+                       }
+                       return array(floor($r), floor($v), floor($b));  
+               }
+               
+               /**
+                * Analyser une feuille de style
+                *
+                * @param       string                  code CSS
+                * @return      null
+                */     
+               function analyseStyle(&$code)
+               {
+                       // on remplace tous les espaces, tab, \r, \n, par des 
espaces uniques
+                       $code = preg_replace('/[\s]+/', ' ', $code);
+
+                       // on enl\xE8ve les commentaires
+                       $code = preg_replace('/\/\*.*?\*\//s', '', $code);
+
+                       // on analyse chaque style
+                       preg_match_all('/([^{}]+){([^}]*)}/isU', $code, $match);
+                       for($k=0; $k<count($match[0]); $k++)
+                       {
+                               // noms
+                               $noms   = strtolower(trim($match[1][$k]));
+                               
+                               // style, s\xE9par\xE9 par des; => on remplie 
le tableau correspondant
+                               $styles = trim($match[2][$k]);
+                               $styles = explode(';', $styles);
+                               $stl = array();
+                               foreach($styles as $style)
+                               {
+                                       $tmp = explode(':', $style);
+                                       if (count($tmp)>1)
+                                       {
+                                               $cod = $tmp[0]; unset($tmp[0]); 
$tmp = implode(':', $tmp); 
+                                               $stl[trim(strtolower($cod))] = 
trim($tmp);
+                                       }
+                               }
+                               
+                               // d\xE9composition des noms par les ,
+                               $noms = explode(',', $noms);
+                               foreach($noms as $nom)
+                               {
+                                       $nom = trim($nom);
+                                       // Si il a une fonction sp\xE9cifique, 
comme :hover => on zap
+                                       if (strpos($nom, ':')!==false) continue;
+                                       if (!isset($this->css[$nom]))
+                                               $this->css[$nom] = $stl;
+                                       else
+                                               $this->css[$nom] = 
array_merge($this->css[$nom], $stl);
+                                       
+                               }
+                       }
+                       
+                       $this->css_keys = array_flip(array_keys($this->css));
+               }
+               
+               /**
+                * Extraction des feuille de style du code HTML
+                *
+                * @param       string                  code HTML
+                * @return      null
+                */     
+               function readStyle(&$html)
+               {
+                       $style = ' ';
+
+                       // extraction des balises link, et suppression de 
celles-ci dans le code HTML
+                       preg_match_all('/<link([^>]*)>/isU', $html, $match);
+                       $html = preg_replace('/<link[^>]*>/isU',        '', 
$html);                     
+                       $html = preg_replace('/<\/link[^>]*>/isU',      '', 
$html);
+                       
+                       // analyse de chaque balise
+                       foreach($match[1] as $code)
+                       {
+                               $tmp = array();
+                               // lecture des param\xE9tres du type nom=valeur
+                               $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)';
+                               preg_match_all('/'.$prop.'/is', $code, $match);
+                               for($k=0; $k<count($match[0]); $k++)
+                                       $tmp[trim(strtolower($match[1][$k]))] = 
trim($match[2][$k]);
+       
+                               // lecture des param\xE9tres du type 
nom="valeur"
+                               $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]';
+                               preg_match_all('/'.$prop.'/is', $code, $match);
+                               for($k=0; $k<count($match[0]); $k++)
+                                       $tmp[trim(strtolower($match[1][$k]))] = 
trim($match[2][$k]);
+       
+                               // lecture des param\xE9tres du type 
nom='valeur'
+                               $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']";
+                               preg_match_all('/'.$prop.'/is', $code, $match);
+                               for($k=0; $k<count($match[0]); $k++)
+                                       $tmp[trim(strtolower($match[1][$k]))] = 
trim($match[2][$k]);
+
+                               // si de type text/css => on garde
+                               if (isset($tmp['type']) && 
strtolower($tmp['type'])=='text/css' && isset($tmp['href']))
+                               {
+                                       $content = 
@file_get_contents($tmp['href']);
+                                       $url = $tmp['href'];
+                                       if (strpos($url, 'http://')!==false)
+                                       {
+                                               $url = str_replace('http://', 
'', $url);
+                                               $url = explode('/', $url);
+                                               $url_main = 
'http://'.$url[0].'/';
+                                               $url_self = $url; 
unset($url_self[count($url_self)-1]); $url_self = 'http://'.implode('/', 
$url_self).'/';
+
+                                               $content = 
preg_replace('/url\(([^\\\\][^)]*)\)/isU', 'url('.$url_self.'$1)', $content);
+                                               $content = 
preg_replace('/url\((\\\\[^)]*)\)/isU', 'url('.$url_main.'$1)', $content);
+                                       }
+
+                                       $style.= $content."\n";
+                               }
+                       }
+
+
+                       // extraction des balises style, et suppression de 
celles-ci dans le code HTML
+                       preg_match_all('/<style[^>]*>(.*)<\/style[^>]*>/isU', 
$html, $match);
+                       $html = 
preg_replace('/<style[^>]*>(.*)<\/style[^>]*>/isU', '', $html);                 
+
+                       // analyse de chaque balise
+                       foreach($match[1] as $code)
+                       {
+                               $code = str_replace('<!--', '', $code);
+                               $code = str_replace('-->', '', $code);
+                               $style.= $code."\n";
+                       } 
+                       
+                       $this->analyseStyle($style);
+               }
+       }
+}


Property changes on: 
people/sigurdne/modules/property/trunk/inc/html2pdf/styleHTML.class.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/inc/import/README
===================================================================
--- people/sigurdne/modules/property/trunk/inc/import/README                    
        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/import/README    2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1 @@
+The import filters are separated by the phpgw_domain - for mulitple domains - 
one has to create one catalog for each domain.

Added: people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK
===================================================================
--- people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,323 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_BKK,v 1.11 2007/01/26 14:58:55 sigurdne Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
+               var $id = -1;
+               var $spbudact_code='12304321';
+               var $mvakode=0;
+               var $kildeid=1;
+               var $splitt=0;
+               var $type = 'fixed';
+               var $header_count = 1;
+               var $soXport;
+               var $invoice;
+               var $meter_table;
+
+               var $import = array(
+                       'Bestilling' => 'pmwrkord_code', 
+                       'Fakt. Nr' => 'fakturanr',
+                       'M\xE5ler nr' => 'maalernr',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima',
+                       'Omr' => 'omraade',
+                       'Adresse' => 'merknad',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Bel\xF8p [kr]' => 'belop'
+                       );
+
+               var $header = array('Fakt. Nr','M\xE5ler 
nr','Konto','Objekt','MVA','Bel\xF8p [kr]','Omr','Adresse');
+
+               var $import_bkk = 
array('boligbyggelag','dato','kundenr','lopenr', 'maalernr' , 
'installasjonsnr', 
+                       
'anleggsid','stedsnavn','kunde_navn','navn','netto','mva');
+                       
+               var $import_bkk_offset = array(
+                       'boligbyggelag' => '0', 
+                       'dato' => '5', 
+                       'kundenr' => '16', 
+                       'lopenr' => '25', 
+                       'maalernr' => '30', 
+                       'installasjonsnr' => '43', 
+                       'anleggsid' => '54', 
+                       'stedsnavn' => '59',
+                       'kunde_navn' => '95',
+                       'navn' => '126',
+                       'netto' => '157',
+                       'mva' => '172'
+                       );
+
+               var $import_bkk_len = array(
+                       'boligbyggelag' => '5', 
+                       'dato' => '10', 
+                       'kundenr' => '8', 
+                       'lopenr' => '4', 
+                       'maalernr' => '8', 
+                       'installasjonsnr' => '9', 
+                       'anleggsid' => '4', 
+                       'stedsnavn' => '35',
+                       'kunde_navn' => '30',
+                       'navn' => '30',
+                       'netto' => '14',
+                       'mva' => '14'
+                       );
+
+               function import_conv()
+               {
+
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
+                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->dateformat       = $this->bocommon->dateformat;
+                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
+                       $this->config = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();
+                       $this->meter_table = 
$this->config->config_data['meter_table'];
+
+               }
+
+               function import($invoice_common,$download)
+               {
+
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $conv_type      = $invoice_common['conv_type'];
+
+                       if(!$buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'])
+                       {
+                               echo '<b>KID-nummer mangler</b><br><br>';
+                               return;
+                       }
+                       $valid_data= False;
+                       $buffer = array();
+                       $buffer = $this->import_start_file($buffer);
+                       $fp = fopen($tsvfile,'rb');
+//print_r($buffer);
+
+//print_r($header);
+//echo '<br>';
+                       for ($i = 0; $i < $this->header_count && 
fgets($fp,8000); ++$i);
+
+                       while ($data = fgets($fp,8000))
+                       {
+//print_r($data);
+                               $num = count($this->import_bkk);
+//echo 'data :'.$data.'<br>';
+                               $buffer = $this->import_start_record($buffer);
+//print_r($buffer);
+                               for ($c=0; $c<$num; $c++ )
+                               {
+                                       //Send name/value pairs along with the 
buffer
+                                       if ($this->import_bkk[$c] != '' && 
substr($data,5,10) !='')
+                                       {
+//echo 'len :'.$this->import_bkk_len[$this->import_bkk[$c]].'<br>';
+//print_r(fread($data,$this->import_bkk_len[$this->import_bkk[$c]]));
+//print_r($this->import_bkk[$c]);
+                                               
$value=substr($data,$this->import_bkk_offset[$this->import_bkk[$c]],$this->import_bkk_len[$this->import_bkk[$c]]);
+                                               $name=$this->import_bkk[$c];
+                                               if ($name=='installasjonsnr')
+                                               {
+                                                       $name='anleggsnr';
+                                                       
$value=substr($data,43,9)." ".substr($data,54,4);
+                                               }
+                                               if ($name=='netto')
+                                               {
+                                                       $name='belop';
+                                                       
$value=(floatval(substr($data,157,14)) + floatval(substr($data,172,14)))/100;
+                                                       $valid_data= True;      
                        
+                                               }
+//echo 'name :'.$name;
+//echo '  value :'.$value.'<br>';
+//print_r($buffer);
+
+                                               $buffer = 
$this->import_new_attrib($buffer,$name,$value,$invoice_common);
+                                       }
+                               }
+                               if ($valid_data)
+                               {
+                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
+                                       $valid_data= False;
+                               }
+                       }
+                       fclose($fp);
+//print_r($buffer);
+
+
+//echo 'download'.$download.'<br>';
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+                       $this->header = array('Fakt. Nr','M\xE5ler 
nr','Konto','Objekt','MVA','Tjeneste','Bel\xF8p [kr]','Omr','Adresse');
+
+                       return $buffer;
+               }
+               
+
+               function import_start_file($buffer)
+               {
+                       return $buffer;
+               }
+
+               function import_start_record($buffer)
+               {
+//print_r($buffer);
+                       $top=array();
+                       ++$this->id;
+                       $this->currentrecord = $top;
+                       return $buffer;
+               }
+
+               function import_new_attrib($buffer,$name,$value,$invoice_common)
+               {
+
+                       $value = trim($value);
+               //      $value = str_replace('\n','<BR>',$value);
+               //      $value = str_replace('\r','',$value);
+
+                       $this->currentrecord += array($name => $value);
+//print_r($buffer);
+                       return $buffer;
+               }
+
+               function import_end_record($buffer,$invoice_common)
+               {
+                       $buffer[$this->id]='';
+                       while ( list($name, $value) = 
each($this->currentrecord))
+                       {
+                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
+
+                               if($invoice_common['num_days'])
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
+                               }
+                               else
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
+                               }
+
+                               if($name=='belop')
+                               {
+                                       $value = str_replace('kr','',$value);
+                                       $value = str_replace(' ','',$value);
+                                       $value = str_replace(',','.',$value);
+
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $value = -1 * abs($value);
+                                       }
+
+                                       $godkjentbelop=$value;
+                               }
+
+                               if($name=='anleggsnr')
+                               {
+                                       $buffer[$this->id]['merknad'] = 
'anleggsnr:' . $value;
+                                       
+                                       
$maalerinfo=$this->soXport->anleggsnr_to_objekt($value,$this->meter_table);
+                                       $dima=$maalerinfo['dima'];
+                                       $loc1=$maalerinfo['loc1'];
+//                                     $maalernr=$maalerinfo['maalernr'];
+                                       $omraade=$maalerinfo['district'];
+                                       if($invoice_common['auto_tax'])
+                                       {
+                                               
$mvakode=$this->soXport->auto_tax($dima);
+                                               
+                                               if($mvakode)
+                                               {
+                                                       
$buffer[$this->id]['mvakode'] = $mvakode;
+                                               }
+                                               else
+                                               {
+                                                       
$buffer[$this->id]['mvakode'] = $this->mvakode;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $buffer[$this->id]['mvakode'] = 
$this->mvakode;
+                                       }
+
+                               }
+                               if($name=='stedsnavn')
+                               {
+                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. $value;
+                               }
+
+                               $buffer[$this->id][$name] = $value;
+                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
+                               $buffer[$this->id]['fakturanr'] = 
$invoice_common['invoice_num'];
+                               $buffer[$this->id]['dima'] = $dima;
+                               $buffer[$this->id]['loc1'] = $loc1;
+                               $buffer[$this->id]['omraade'] = $omraade;
+//                             $buffer[$this->id]['maalernr'] = $maalernr;
+                               $buffer[$this->id]['splitt'] = $this->splitt;
+                               $buffer[$this->id]['kildeid'] = $this->kildeid;
+//                             $buffer[$this->id]['mvakode'] = $this->mvakode;
+                               $buffer[$this->id]['spbudact_code'] = 
$this->spbudact_code;
+                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
+                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
+                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
+                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
+                               $buffer[$this->id]['periode'] = 
$invoice_common['smonth'];
+                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
+                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
+                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
+                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
+                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
+                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+
+                               if($invoice_common['auto_tax'])
+                               {
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
+                                       $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+                               }
+                       }
+                       return $buffer;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }
+?>

Added: 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK_csv
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK_csv    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_BKK_csv    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,314 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_BKK_csv,v 1.8 2007/03/18 16:33:16 sigurdne 
Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
+               var $id = -1;
+               var $spbudact_code='12304321';
+               var $mvakode=0;
+               var $kildeid=1;
+               var $splitt=0;
+               var $type = 'fixed';
+               var $header_count = 1;
+               var $soXport;
+               var $invoice;
+               var $meter_table;
+
+               var $import = array(
+                       'Bestilling' => 'pmwrkord_code', 
+                       'Fakt. Nr' => 'fakturanr',
+                       'MÃ¥ler nr' => 'maalernr',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima',
+                       'Omr' => 'omraade',
+                       'Adresse' => 'stedsnavn',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Belop [kr]' => 'belop'
+                       );
+
+               var $header = array('Fakt. Nr','MÃ¥ler 
nr','Konto','Objekt','MVA','Belop [kr]','Omr','Adresse');
+
+               var $import_bkk = 
array('kundenr','under_fakturanr','Utskriftsdato','Forfdato','Maalepunktid',
+                       'stedsnavn','Girobeloep','maalernr','kunde_navn');
+       
+
+               var $import_bkk_offset = array(
+                       'kundenr' => 0, 
+                       'under_fakturanr' => 1,
+                       'Utskriftsdato' => 2,
+                       'Forfdato' => 3,
+                       'Maalepunktid' => 4,
+                       'stedsnavn' => 8,
+                       'Girobeloep' => 14,
+                       'maalernr' => 19, 
+                       'kunde_navn' => 6
+                       );
+
+               function import_conv()
+               {
+
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
+                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->dateformat       = $this->bocommon->dateformat;
+                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
+                       $this->config = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();
+                       $this->meter_table = 
$this->config->config_data['meter_table'];
+
+               //      $this->db               = $GLOBALS['phpgw']->db;
+                       $this->db               = $this->bocommon->new_db();
+                       $this->join             = $this->bocommon->join;
+
+
+               }
+
+               function import($invoice_common,$download)
+               {
+
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $conv_type      = $invoice_common['conv_type'];
+
+                       if(!$buffer[0]['kidnr'] = $invoice_common['kid_nr'])
+                       {
+                               echo '<b>KID-nummer mangler</b><br><br>';
+                               return;
+                       }
+                       $valid_data= False;
+                       $buffer = array();
+                       $fp = fopen($tsvfile,'rb');
+                       $column_header = true;
+                       $this->id = -1;
+                       while ($data = fgetcsv($fp,8000,";"))
+                       {
+                               $num = count($this->import_bkk);
+                               
+                               $this->currentrecord = array();
+                               for ($c=0; $c<$num; $c++ )
+                               {
+                                       //Send name/value pairs along with the 
buffer
+                                       if ($data[14] && !$column_header)
+                                       {
+                                               
$value=$data[$this->import_bkk_offset[$this->import_bkk[$c]]];
+                                               $name=$this->import_bkk[$c];
+                                               if ($name=='Maalepunktid')
+                                               {
+                                                       $name='anleggsnr';
+                                                       $value= '7070575000' . 
$value;
+                                               }
+                                               if ($name=='Girobeloep')
+                                               {
+                                                       $name='belop';          
                                        
+                                                       $valid_data= True;      
                        
+                                               }
+                                               
$this->import_new_attrib($name,$value,$invoice_common);
+                                       }
+                               }
+                               if ($valid_data)
+                               {
+                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
+                                       $valid_data= False;
+                               }
+                               
+                               unset($column_header);
+                               $this->id++;
+                       }
+
+                       fclose($fp);
+
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+                       $this->header = array('Fakt. Nr','MÃ¥ler 
nr','Konto','Objekt','MVA','Tjeneste','Belop [kr]','Omr','Adresse');
+                       return $buffer;
+               }
+               
+
+               function import_new_attrib($name,$value,$invoice_common)
+               {
+
+                       $value = trim($value);
+               //      $value = str_replace('\n','<BR>',$value);
+               //      $value = str_replace('\r','',$value);
+
+                       $this->currentrecord += array($name => $value);
+               }
+
+               function import_end_record($buffer,$invoice_common)
+               {
+                       $buffer[$this->id]='';
+                       while ( list($name, $value) = 
each($this->currentrecord))
+                       {
+                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
+
+                               if($invoice_common['num_days'])
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
+                               }
+                               else
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
+                               }
+
+                               if($name=='belop')
+                               {
+                                       $value = str_replace('kr','',$value);
+                                       $value = str_replace(' ','',$value);
+                                       $value = str_replace(',','.',$value);
+
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $value = -1 * abs($value);
+                                       }
+
+                                       $godkjentbelop=$value;
+                               }
+
+                               if($name=='anleggsnr')
+                               {
+                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. 'anleggsnr:' . $this->bocommon->ascii2utf($value);
+                                       
+                                       
$maalerinfo=$this->anleggsnr_to_objekt($value,$this->meter_table);
+                                       $dima=$maalerinfo['dima'];
+                                       $loc1=$maalerinfo['loc1'];
+                                       $omraade=$maalerinfo['district'];
+
+                                       if($invoice_common['auto_tax'])
+                                       {
+                                               
$mvakode=$this->soXport->auto_tax($dima);
+                                               
+                                               if($mvakode)
+                                               {
+                                                       
$buffer[$this->id]['mvakode'] = $mvakode;
+                                               }
+                                               else
+                                               {
+                                                       
$buffer[$this->id]['mvakode'] = $this->mvakode;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $buffer[$this->id]['mvakode'] = 
$this->mvakode;
+                                       }
+
+                               }
+                               if($name=='maalernr')
+                               {
+                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. 'maalernr: '  . $value;
+                               }
+                               if($name=='under_fakturanr')
+                               {
+                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. 'Fakturanr: '  . $value;
+                               }
+                               if($name=='kundenr')
+                               {
+                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. 'Kundenr: '  . $value;
+                               }
+                               if($name=='kunde_navn')
+                               {
+                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. 'Kundenavn: '  . $this->bocommon->ascii2utf($value);
+                               }
+                               if($name=='stedsnavn')
+                               {
+                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. 'Adresse: '  . $this->bocommon->ascii2utf($value);
+                               }
+
+                               $buffer[$this->id][$name] = $value;
+                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
+                               $buffer[$this->id]['fakturanr'] = 
$invoice_common['invoice_num'];
+                               $buffer[$this->id]['dima'] = $dima;
+                               $buffer[$this->id]['loc1'] = $loc1;
+                               $buffer[$this->id]['omraade'] = $omraade;
+                               $buffer[$this->id]['splitt'] = $this->splitt;
+                               $buffer[$this->id]['kildeid'] = $this->kildeid;
+                               $buffer[$this->id]['spbudact_code'] = 
$this->spbudact_code;
+                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
+                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
+                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
+                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
+                               $buffer[$this->id]['periode'] = 
$invoice_common['smonth'];
+                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
+                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
+                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
+                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
+                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
+                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+
+                               if($invoice_common['auto_tax'])
+                               {
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
+                                       $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+                               }
+                       }
+
+                       return $buffer;
+               }
+
+
+               function anleggsnr_to_objekt($anleggsnr,$meter_table)
+               {
+                       $this->db->query("select 
$meter_table.ext_meter_id,$meter_table.loc1,$meter_table.loc2,$meter_table.loc3,fm_part_of_town.district_id
 "
+                       . " from $meter_table $this->join fm_location1 ON 
$meter_table.loc1 = fm_location1.loc1 $this->join "
+                         . " fm_part_of_town ON fm_location1.part_of_town_id = 
fm_part_of_town.part_of_town_id where 
$meter_table.ext_system_id2='$anleggsnr'");
+
+                       $this->db->next_record();
+                       $loc1 = $this->db->f('loc1');
+                       $loc2 = $this->db->f('loc2');
+       //              $loc3 = $this->db->f('loc3');
+
+                       $maalerinfo['loc1']=$loc1;
+                       $maalerinfo['dima']=$loc1.$loc2;//.$loc3;
+                       $maalerinfo['maalernr']=$this->db->f('ext_meter_id');
+                       $maalerinfo['district']=$this->db->f('district_id');
+                       return $maalerinfo;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }
+?>

Added: 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner
===================================================================
--- people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner 
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,404 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_Kemner,v 1.9 2007/01/26 14:58:56 sigurdne 
Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+       class import_conv
+       {
+               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
+               var $id = -1;
+               var $spbudact_code='11954111';
+               var $dimb=40;
+               var $mvakode=0;
+               var $kildeid=1;
+               var $splitt=0;
+               var $type = 'fixed';
+               var $header_count = 0;
+               var $soXport;
+               var $invoice;
+
+               var $import = array(
+                       'Bilagsnr' => 'bilagsnr', 
+                       'Ref.' => 'fakturanr', 
+                       'Gnr/Bnr-seksjon' => 'gid',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima', //objectclass: organizationalPerson
+                       'DimB' => 'dimb',
+                       'KID' => 'kidnr',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Bel\xF8p [kr]' => 'belop',
+                       'Referanse' => 'referanse',
+                       'BOEI Gateadresse' => 'boei_gateadresse',
+                       );
+
+       //      var $header = 
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Bel\xF8p
 [kr]','Referanse','BOEI Gateadresse');
+               var $header = 
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Bel\xF8p
 [kr]','Referanse');
+
+               function import_conv()
+               {
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
+                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->dateformat       = $this->bocommon->dateformat;
+                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       
+               }
+
+               function import($invoice_common,$download)
+               {
+               
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $conv_type      = $invoice_common['conv_type'];
+
+                       $Ingen = 0;
+                       $FilGodkjent = 1;
+                       $Betalingskrav = 2;
+                       $Bel\xF8pspost1 = 3;
+                       $Bel\xF8pspost2 = 4;
+                       $Spesifikasjon = 5;
+                       $LinjeNr = 0;
+                       $ePostNiv\xE5 = $Ingen;
+                       $errorcount = 0;
+                       $last_case_merknad='';
+                       $bilagsnr = $this->invoice->next_bilagsnr();
+                       $buffer = array();
+                       $buffer = $this->import_start_file($buffer);
+                       $fp = fopen($tsvfile,'r');
+
+                       while ($data = fgets($fp,8000))
+                       {
+//-----------------------------
+//print_r($buffer);
+                               
+                               $LinjeNr = $LinjeNr + 1;
+                               if (strlen($data) >= 80)
+                               {
+                                       if ($last_case_merknad && 
substr($data,0,8)!=$last_case_merknad)
+                                       {
+                                               if ($Merknad)
+                                               {
+                                                       $buffer = 
$this->import_new_attrib($buffer,merknad,$Merknad,$invoice_common);
+                                               }
+                                               $Merknad='';
+                                               $buffer = 
$this->import_end_record($buffer,$invoice_common);
+                                               $last_case_merknad='';
+                                       }
+                                   switch(substr($data,0,8))
+                                   {
+                                       Case 'NY000010':
+                                           //Start forsendelse
+                                           if (($LinjeNr == 1) && 
($ePostNiv\xE5 == $Ingen))
+                                           {
+                                               $ePostNiv\xE5 = $FilGodkjent;
+                                           }
+                                           else
+                                           {
+                                               echo lang('Importer_BBS') . 
lang('Filen inneholder flere start poster p\xE5 linje nr:') . $LinjeNr . 
lang('Importen kan ikke fortsette');
+                                               break 2;
+                                           }
+                       
+                                       break;
+                                       
+                                       Case 'NY210020':
+                                           //Start betalingskrav
+                                           if ($ePostNiv\xE5 == $FilGodkjent)
+                                           {
+                                               $ePostNiv\xE5 = $Betalingskrav;
+                                           }
+                                           else
+                                           {
+                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
+                                               break 2;
+                                           }
+                       
+                                           $OppdragsNr = substr($data,17,7);
+                                           $OppdragsKonto = substr($data, 24, 
11);
+                                       break;
+                                       
+                                       Case 'NY210230':
+                                       break;
+                                       
+                                       Case 'NY212130':
+                                       $buffer = 
$this->import_start_record($buffer);
+
+             
+                                           //Bel\xF8pspost 1
+                                           if ($ePostNiv\xE5 == $Betalingskrav 
Or $ePostNiv\xE5 >= $Bel\xF8pspost2)
+                                           {
+                                               $ePostNiv\xE5 = $Bel\xF8pspost1;
+                                           }
+                                           else
+                                           {
+                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
+                                               break 2;
+                                           }
+                       
+                                           //Lagre eksisterende post
+                                           if (!oRsTmp.EOF && !oRsTmp.BOF)
+                                           {
+                                               if (oRsTmp.EditMode == 
adEditAdd)
+                                               {
+                                                   oRsTmp.Update;
+                                               }
+                                           }
+                       
+                                           //Opprett post
+                                               $TransaksjonsNr = substr($data, 
8, 7);
+                                               $Gnr = substr($data, 56, 5);
+                                               $Bnr = substr($data, 61, 4);
+                                               $sekjonnr = substr($data, 69, 
3);
+                       
+                                               $forfall_day = substr($data, 
15, 2);
+                                               $forfall_month = substr($data, 
17, 2);
+                                               $forfall_year = substr($data, 
19, 2);
+                                               $periode = $forfall_month - 1;
+
+                                               $forfallsdato = 
date($this->dateformat,mktime(2,0,0,$forfall_month,$forfall_day,$forfall_year));
+                                               $fakturadato= 
date($this->dateformat,mktime(2,0,0,$forfall_month,$forfall_day,$forfall_year)-(86400*30));
+
+                                               $belop = 
intval(substr($data,32,17))/100;
+
+                                               if( $invoice_common['art'] == 2 
) // kreditnota
+                                               {
+                                                       $belop = -1 * 
abs($belop);
+                                               }
+
+                                               $kidnr = substr($data, 54, 20);
+                                               $gid = 
$Gnr.'/'.$Bnr.'-'.$sekjonnr;
+                       
+                                               $buffer = 
$this->import_new_attrib($buffer,periode,$periode,$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,forfallsdato,$forfallsdato,$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,fakturadato,$fakturadato,$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,belop,$belop,$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,kidnr,$kidnr,$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,gid,$gid,$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,bilagsnr,$bilagsnr,$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,dimb,$this->dimb,$invoice_common);
+                                               $bilagsnr++;
+
+                                               //Finn dima fra Boei
+                                               $gabinfo = 
$this->soXport->gabnr_to_objekt($Gnr,$Bnr,$sekjonnr);
+                                               $buffer = 
$this->import_new_attrib($buffer,dima,$gabinfo['dima'],$invoice_common);
+                                               $buffer = 
$this->import_new_attrib($buffer,loc1,$gabinfo['loc1'],$invoice_common);
+                                               //finn boei gateadresse for 
kongroll
+                                               
$boei_gateadresse=$this->soXport->dima_to_address($dima);
+                                               $buffer = 
$this->import_new_attrib($buffer,boei_gateadresse,$boei_gateadresse,$invoice_common);
+                                               
+                                       break;
+                                       
+                                       Case 'NY210231':
+                                       break;
+                                       
+                                       Case 'NY212131':
+                                           //Bel\xF8pspost 2
+                                           if ($ePostNiv\xE5 == 
$Bel\xF8pspost1)
+                                           {
+                                               $ePostNiv\xE5 = $Bel\xF8pspost2;
+                                           }
+                                           else
+                                           {
+                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
+                                               break 2;
+                                           }
+                       
+                                           //Sjekk transaksjonsnr
+                                           if ((intval(substr($data, 8, 7))) 
<> $TransaksjonsNr)
+                                           {
+                                               echo lang('Importer_BBS') 
.lang('Transaksjonsnr p\xE5 bel\xF8pspost 2 stemmer ikke med nr p\xE5 
bel\xF8pspost 1. Linjenr:') . $LinjeNr . lang('Importen kan ikke fortsette');
+                                               break 2;
+                                           }
+                       
+                                           $Navn = substr($data, 15, 10);
+                                           $referanse = substr($data, 50, 25);
+                                           $buffer = 
$this->import_new_attrib($buffer,referanse,$referanse,$invoice_common);         
       
+                                       $Merknad = 'Kemner adr: 
'.$referanse."\r\n".'BOEI adr: '.$boei_gateadresse."\r\n";
+                                       break;
+                                       
+                                       Case 'NY212149':
+                                           //Spesifikasjonsrecord
+                                           if ($ePostNiv\xE5 >= 
$Bel\xF8pspost2)
+                                           {
+                                               $ePostNiv\xE5 = $Spesifikasjon;
+                                           }
+                                           else
+                                           {
+                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
+                                               break 2;
+                                           }
+                       
+                                           //Hent merknad
+                                       $Merknad.=strval(substr($data, 20, 
40))."\r\n";
+                                       $last_case_merknad=substr($data,0,8);
+                       
+                                       break;
+                                       
+                                       Case 'NY210088':
+                                           //Slutt betalingskrav
+                                           if ($ePostNiv\xE5 >= $Betalingskrav 
&& $ePostNiv\xE5 <> $Bel\xF8pspost1)
+                                           {
+                                               $ePostNiv\xE5 = $FilGodkjent;
+                                           }
+                                           else
+                                           {
+                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
+                                               break 2;
+                                           }
+                       
+                                       break;
+                                       
+                                       Case 'NY000089':
+                                           //Slutt forsendelse
+                                           if ($ePostNiv\xE5 == $FilGodkjent)
+                                           {
+                                               $ePostNiv\xE5 = $Ingen;
+                                           }
+                                           else
+                                           {
+                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
+                                               break 2;
+                                           }
+                                       
+                                       break;
+                                   }
+                       
+                                   //Filen m\xE5 altid begynne med en gyldig 
start record
+                                   if ($LinjeNr == 1 && $ePostNiv\xE5 == 
$Ingen)
+                                   {
+                                       echo lang('Importer_BBS') . lang('Filen 
starter ikke med riktig recordtype. Importen kan ikke fortsette');
+                                       break;
+                                   }
+                               }
+//-----------------------------
+                       }
+                       fclose($fp);
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+//print_r($buffer);
+                       $this->header = 
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Tjeneste','Bel\xF8p
 [kr]','Referanse');
+                       return $buffer;
+
+               }
+               
+
+               function import_start_file($buffer)
+               {
+                       return $buffer;
+               }
+
+               function import_start_record($buffer)
+               {
+                       $top=array();
+                       ++$this->id;
+                       $this->currentrecord = $top;
+                       return $buffer;
+               }
+
+               function import_new_attrib($buffer,$name,$value,$invoice_common)
+               {
+//                     $value = trim($value);
+//                     $value = str_replace('\n','<BR>',$value);
+//                     $value = str_replace('\r','',$value);
+//echo '<br> '.$name.': => '.$value;
+
+                       $this->currentrecord += array($name => $value);
+                       return $buffer;
+               }
+
+               function import_end_record($buffer,$invoice_common)
+               {
+                       $buffer[$this->id]='';
+
+                       while ( list($name, $value) = 
each($this->currentrecord))
+                       {
+                               if($name=='belop')
+                               {
+                                       $godkjentbelop=$value;
+                               }
+
+
+                               if($name=='dima' && 
$invoice_common['auto_tax']):
+                               {
+                                       
$mvakode=$this->soXport->auto_tax($value);
+                                       
+                                       if($mvakode)
+                                       {
+                                               $buffer[$this->id]['mvakode'] = 
$mvakode;
+                                       }
+                                       else
+                                       {
+                                               $buffer[$this->id]['mvakode'] = 
$this->mvakode;
+                                       }
+                               }
+                               elseif($name=='dima' && 
!$invoice_common['auto_tax']):
+                               {
+                                       $buffer[$this->id]['mvakode'] = 
$this->mvakode;
+                               }
+                               endif;
+
+                               $buffer[$this->id][$name] = $value;
+                               $buffer[$this->id]['fakturanr'] = 
$invoice_common['invoice_num'];
+                               $buffer[$this->id]['splitt'] = $this->splitt;
+                               $buffer[$this->id]['kildeid'] = $this->kildeid;
+
+                               $buffer[$this->id]['spbudact_code'] = 
$this->spbudact_code;
+                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
+                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
+                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
+                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
+                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
+//                             $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
+                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+
+                               if($invoice_common['auto_tax'])
+                               {
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
+                                       $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+                               }
+                       }
+                       return $buffer;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }
+?>

Added: 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner_xml
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner_xml 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Kemner_xml 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,273 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_Kemner_xml,v 1.13 2007/03/18 16:33:16 
sigurdne Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $spbudact_code='11954111';
+               var $dimb=99;
+               var $mvakode=0;
+               var $kildeid=1;
+               var $splitt=0;
+               var $soXport;
+               var $invoice;
+
+               var $import = array(
+                       'Bilagsnr' => 'bilagsnr', 
+                       'Fakturanr' => 'fakturanr', 
+                       'Gnr/Bnr-seksjon' => 'gid',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima', //objectclass: organizationalPerson
+                       'DimB' => 'dimb',
+                       'KID' => 'kidnr',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Belop [kr]' => 'belop',
+                       'Referanse' => 'referanse',
+                       'BOEI Gateadresse' => 'boei_gateadresse',
+                       );
+
+               var $header = 
array('Bilagsnr','Fakturanr','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Tjeneste','Belop
 [kr]','Referanse');
+
+               function import_conv()
+               {
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
+                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->dateformat       = $this->bocommon->dateformat;
+                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+//                     $this->xmltool          = 
CreateObject('phpgwapi.xmltool');
+               }
+
+               function import($invoice_common,$download)
+               {
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $valid_data= False;
+                       $bilagsnr = $this->invoice->next_bilagsnr();
+
+                       $buffer = array();
+
+/*                     $xmldata=file_get_contents($tsvfile);
+                       $this->xmltool->import_xml($xmldata);
+                       $var_result = $this->xmltool->export_var();
+*/
+                       $xmlparse = CreateObject('property.XmlToArray');
+                       $xmlparse->setEncoding('UTF-8');
+                       $var_result = $xmlparse->parseFile($tsvfile);
+
+                       set_time_limit(300);
+
+//_debug_array($var_result);
+
+                       if(is_array($var_result['Invoice'][0]))
+                       {
+                               $data=$var_result['Invoice'];
+                       }
+                       else
+                       {
+                               $data[0]=$var_result['Invoice'];
+                       }
+
+                       if (isset($data) AND is_array($data))
+                       {
+                               $num = count($data);
+                               $fakturadato = false;
+                               $forfallsdato = false;
+                               $periode = false;
+
+                               for ($i = 0; $i < $num; ++$i)
+                               {
+                                       $Gnr            = 
$data[$i]['Header'][0]['Text1'];
+                                       $Bnr            = 
$data[$i]['Header'][0]['Text2'];
+                                       $sekjonnr       = 
$data[$i]['Header'][0]['Text4'];
+
+                                       $fakturanr      = 
$data[$i]['InvoiceNo'];
+                                       if(!$fakturadato)
+                                       {
+                                               $fakturadato    = 
date($this->dateformat,strtotime($data[$i]['Header'][0]['InvoiceDate']));
+                                       }
+                                       
+                                       if(!$forfallsdato)
+                                       {
+                                               $forfallsdato   = 
date($this->dateformat,strtotime($data[$i]['Header'][0]['DueDate']));
+                                       }
+
+                                       if(!$periode)
+                                       {
+                                               $periode = 
date('n',strtotime($data[$i]['Header'][0]['InvoiceDate']));
+                                       }
+                                       
+                                       $belop  = 
$data[$i]['Summary'][0]['TotalInclTax'];
+
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $belop = -1 * abs($belop);
+                                       }
+                                       $kidnr  = 
$data[$i]['Header'][0]['PaymentInfo'][0]['BacsId'];
+
+                                       $gid = $Gnr.'/'.$Bnr.'-'.$sekjonnr;
+                                       $item_type = 1;
+                                       $item_id = '1201' . 
$data[$i]['Header'][0]['HeaderText'];
+                                       
+                                       $buffer[$i]['fakturanr'] = $fakturanr;
+                                       $buffer[$i]['periode'] = $periode;
+                                       $buffer[$i]['forfallsdato'] = 
$forfallsdato;
+                                       $buffer[$i]['fakturadato'] = 
$fakturadato;
+                                       $buffer[$i]['belop'] = $belop;
+                                       $buffer[$i]['godkjentbelop'] = $belop;
+                                       
+                                       $buffer[$i]['kidnr'] = $kidnr;
+                                       $buffer[$i]['gid'] = $gid;
+                                       $buffer[$i]['bilagsnr'] = $bilagsnr;
+
+                                       if(isset($invoice_common['dim_b']) && 
$invoice_common['dim_b'])
+                                       {
+                                               $buffer[$i]['dimb'] = 
$invoice_common['dim_b'];
+                                       }
+                                       else
+                                       {
+                                               $buffer[$i]['dimb'] = 
$this->dimb;
+                                       }
+
+                                       $buffer[$i]['item_type'] = $item_type;
+                                       $buffer[$i]['item_id'] = $item_id;
+
+                               //Finn dima fra Boei
+                                       $gabinfo = 
$this->soXport->gabnr_to_objekt($Gnr,$Bnr,$sekjonnr);
+                                       $buffer[$i]['dima'] = $gabinfo['dima'];
+                                       $buffer[$i]['loc1'] = $gabinfo['loc1'];
+                                       $buffer[$i]['mvakode'] = $this->mvakode;
+
+                                       if($gabinfo['loc1'] && 
(isset($invoice_common['auto_tax']) && $invoice_common['auto_tax']))
+                                       {
+                                               
$mvakode=$this->soXport->auto_tax($gabinfo['loc1']);
+                                       
+                                               if($mvakode)
+                                               {
+                                                       $buffer[$i]['mvakode'] 
= $mvakode;
+                                               }
+                                       }
+
+                                       if(isset($invoice_common['auto_tax']) 
&& $invoice_common['auto_tax'])
+                                       {
+                                               $buffer[$i]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$i]['mvakode'] 
,$this->spbudact_code);
+                                               $buffer[$i]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$i]['mvakode'] 
,$invoice_common['vendor_id']);
+                                       }
+
+                                       $buffer[$i]['kostra_id'] = 
$this->soXport->get_kostra_id($gabinfo['loc1']);
+                                       
+                                       //finn boei gateadresse for kontroll
+                                       
$boei_gateadresse=$this->soXport->dima_to_address($gabinfo['dima']);
+                                       $buffer[$i]['boei_gateadresse'] = 
utf8_encode($boei_gateadresse);
+
+                                       $referanse = 
utf8_encode($data[$i]['Header'][0]['ShipTo'][0]['AddressInfo'][0]['Address']);
+       
+                                       $buffer[$i]['referanse'] = $referanse;  
              
+
+                                       $merknad = '';
+
+                                       $merknad = 'Kemner adr: 
'.$referanse."\r\n".'BOEI adr: '.$boei_gateadresse."\r\n";
+
+                                       foreach 
($data[$i]['Details'][0]['Detail'] as $detail)
+                                       {
+                                               if 
(is_array($detail['Products'][0]['SellerProductDescr']))
+                                               {
+                                                       $merknad .= 
implode("",$detail['Products'][0]['SellerProductDescr']) . "\t";
+                                               }
+                                               else
+                                               {
+                                                       $merknad .= 
$detail['Products'][0]['SellerProductDescr'] . "\t";
+                                               }
+                                               
+
+                                               if 
(is_array($detail['Products'][0]['UnitCode']))
+                                               {
+                                                       $merknad .= 
implode("",$detail['Products'][0]['UnitCode']) . "\t";
+                                               }
+                                               else
+                                               {
+                                                       $merknad .= 
$detail['Products'][0]['UnitCode'] . "\t";
+                                               }
+                                               
+                                               if 
(is_array($detail['Products'][0]['Quantity']))
+                                               {
+                                                       $merknad .= 
implode("",$detail['Products'][0]['Quantity']) . "\t";
+                                               }
+                                               else
+                                               {
+                                                       $merknad .= 
$detail['Products'][0]['Quantity'] . "\t";
+                                               }
+                                               
+                                               if 
(is_array($detail['Products'][0]['Price']))
+                                               {
+                                                       $merknad .= 
implode("",$detail['Products'][0]['Price'])."\r\n";
+                                               }
+                                               else
+                                               {
+                                                       $merknad .= 
$detail['Products'][0]['Price']."\r\n";
+                                               }
+
+                                       }
+                                       
+                                       $buffer[$i]['merknad'] = 
utf8_encode($merknad);
+                                       $buffer[$i]['splitt'] = $this->splitt;
+                                       $buffer[$i]['kildeid'] = $this->kildeid;
+                                       $buffer[$i]['spbudact_code'] = 
$this->spbudact_code;
+                                       $buffer[$i]['typeid'] = 
$invoice_common['type'];
+                                       $buffer[$i]['regtid'] = 
date($this->datetimeformat);
+                                       $buffer[$i]['artid'] = 
$invoice_common['art'];
+                                       $buffer[$i]['spvend_code'] = 
$invoice_common['vendor_id'];
+                                       $buffer[$i]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                                       $buffer[$i]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                                       $buffer[$i]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+//_debug_array($bilagsnr);
+                                       $bilagsnr++;
+                               }
+                       }
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+                       return $buffer;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }

Added: 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,298 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_Service,v 1.19 2007/03/18 16:33:16 sigurdne 
Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
+               var $id = -1;
+               var $kildeid=1;
+               var $splitt=0;
+               var $type = 'csv';
+               var $header_count = 18;
+               var $soXport;
+               var $invoice;
+
+               var $import = array(
+                       'Bestilling' => 'pmwrkord_code', 
+                       'Fakt. Nr' => 'fakturanr',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima',
+                       'Fag/Timer/Matr' => 'dimd',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Belop [kr]' => 'belop'
+                       );
+
+               var $header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Belop [kr]');
+
+               function import_conv()
+               {
+       //              $this->db               = $GLOBALS['phpgw']->db;
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
+                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->db               = $this->bocommon->new_db();
+                       $this->dateformat       = $this->bocommon->dateformat;
+                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
+               }
+
+               function import($invoice_common,$download)
+               {
+
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $conv_type      = $invoice_common['conv_type'];
+                       $valid_data= False;
+                       $buffer = array();
+                       $buffer = $this->import_start_file($buffer);
+                       $fp = fopen($tsvfile,'r');
+
+                       for ($i = 1; $i < $this->header_count && 
fgetcsv($fp,8000,';'); ++$i);
+
+                       while ($data = fgetcsv($fp,8000,';'))
+                       {
+                               $num = count($data);
+                               $buffer = $this->import_start_record($buffer);
+                               $valid_data=0;
+                               for ($c=0; $c<$num; $c++ )
+                               {
+                                       //Send name/value pairs along with the 
buffer
+                                       if ($this->import[$this->header[$c]] != 
'')
+                                       {
+
+//echo '<br>'.$c.': '.$this->import[$this->header[$c]].' => '.$data[$c];
+                                               $buffer = 
$this->import_new_attrib($buffer, 
$this->import[$this->header[$c]],$data[$c],$invoice_common);
+                                               if($data[$c])
+                                               {
+                                                       $valid_data++;
+                                               }
+                                       }
+                               }
+                               if ($valid_data > 0)
+                               {
+                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
+                                       $valid_data= False;
+                               }
+                       }
+                       fclose($fp);
+
+
+//echo 'download'.$download.'<br>';
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+//_debug_array($buffer);
+                       $this->header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Belop [kr]');
+
+                       return $buffer;
+               }
+               
+
+               function import_start_file($buffer)
+               {
+                       return $buffer;
+               }
+
+               function import_start_record($buffer)
+               {
+                       $top=array();
+                       ++$this->id;
+                       $this->currentrecord = $top;
+                       return $buffer;
+               }
+
+               function import_new_attrib($buffer,$name,$value,$invoice_common)
+               {
+
+                       $value = $this->bocommon->ascii2utf(trim($value));
+                       $value = str_replace('\n','<BR>',$value);
+                       $value = str_replace('\r','',$value);
+
+                       $this->currentrecord += array($name => $value);
+
+                       return $buffer;
+               }
+
+               function import_end_record($buffer,$invoice_common)
+               {
+                       $buffer[$this->id]='';
+                       while ( list($name, $value) = 
each($this->currentrecord))
+                       {
+                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
+
+                               if($invoice_common['num_days'])
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
+                               }
+                               else
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
+                               }
+
+                               if($name=='belop')
+                               {
+                                       $value = str_replace('kr','',$value);
+                                       $value = str_replace(' ','',$value);
+                                       $value = str_replace(',','.',$value);
+                                       
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $value = -1 * abs($value);
+                                       }
+                                       
+                                       $godkjentbelop = $value;
+                               }
+                               if($name=='pmwrkord_code')
+                               {
+                                       
if(!$this->soXport->check_order(intval($value)))
+                                       {
+                                               $value='';
+                                       }
+                                       else
+                                       {
+                                               
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value)); 
+                                       }
+                               }
+                               if($name=='spbudact_code')
+                               {
+                                       $value = 
$this->check_spbudact_code($value);
+                               }
+
+                               if($name=='fakturanr')
+                               {
+                                       if($invoice_common['invoice_num'])
+                                       {
+                                               
$value=$invoice_common['invoice_num'];
+                                       }
+                               }
+
+                               if($name=='mvakode' && 
$invoice_common['auto_tax'])
+                               {
+                                       $value = 
$this->soXport->auto_tax($buffer[$this->id]['dima']);
+                               }
+
+                               if($name=='dima')
+                               {
+                                       $value = $this->check_dima($value);
+                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
+                               }
+
+                               $buffer[$this->id][$name] = $value;
+                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
+                               $buffer[$this->id]['splitt'] = $this->splitt;
+                               $buffer[$this->id]['kildeid'] = $this->kildeid;
+                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
+                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
+                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
+                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
+                               $buffer[$this->id]['periode'] = 
$invoice_common['smonth'];
+                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
+                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
+                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
+                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
+                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
+                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+
+                               if($invoice_common['auto_tax'])
+                               {
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
+                               }
+                               $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+                       }
+                       return $buffer;
+               }
+               
+               function check_spbudact_code($id)
+               {
+                       $b_account='';
+                       $this->db->query("select id from fm_b_account where 
id='$id'");
+                       $this->db->next_record();
+                       if ($this->db->f('id'))
+                       { 
+                               $b_account = $this->db->f('id');
+                       }
+                       else
+                       {
+                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
+                               $this->db->next_record();
+                               $b_account = $this->db->f('id');
+                       }
+                       
+                       return $b_account;
+               }
+
+               function check_dima($id)
+               {
+                       $loc1=substr($id,0,4);
+                       $loc2=substr($id,4,2);
+                       
+                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS 
NULL))");
+                       $this->db->next_record();
+                       if ($this->db->f('loc1'))
+                       { 
+                               $dima = $this->db->f('loc1');
+                               
+                               if ($loc2)
+                               {
+                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'  AND 
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
+                                       $this->db->next_record();
+                                       if ($this->db->f('location_code'))
+                                       { 
+                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
+                                       }
+                                       else
+                                       {
+                                               unset($dima);
+                                       }
+                               }
+                       }
+                       
+                       return $dima;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }
+?>

Added: 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service_xml
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service_xml
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_Service_xml
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,314 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_Service_xml,v 1.18 2007/02/06 08:02:49 
sigurdne Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
+               var $id = -1;
+               var $kildeid=1;
+               var $splitt=0;
+               var $type = 'csv';
+               var $header_count = 17;
+               var $soXport;
+               var $invoice;
+
+               var $import = array(
+                       'Bestilling' => 'pmwrkord_code', 
+                       'Fakt. Nr' => 'fakturanr',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima',
+                       'Fag/Timer/Matr' => 'dimd',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Bel\xF8p [kr]' => 'belop'
+                       );
+
+               var $header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Bel\xF8p [kr]');
+
+               function import_conv()
+               {
+       //              $this->db               = $GLOBALS['phpgw']->db;
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
+                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
+                       $this->db               = $this->bocommon->new_db();
+                       $this->dateformat       = $this->bocommon->dateformat;
+                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
+                       $this->xmltool          = 
CreateObject('phpgwapi.xmltool');
+               }
+
+               function import($invoice_common,$download)
+               {
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $conv_type      = $invoice_common['conv_type'];
+                       $valid_data= False;
+                       $buffer = array();
+                       $buffer = $this->import_start_file($buffer);
+
+                       $xmldata=file_get_contents($tsvfile);
+                       $this->xmltool->import_xml($xmldata);
+                       $var_result = $this->xmltool->export_var();
+                       if(is_array($var_result['Worksheet']['Table']['Row']))
+                       {
+                               
$data_temp=$var_result['Worksheet']['Table']['Row'];
+                       }
+                       else
+                       {
+                               
$data_temp=$var_result['Worksheet'][0]['Table']['Row'];
+                       }
+                       $rows = count($data_temp);
+//_debug_array($data_temp);
+//  _debug_array($var_result['Worksheet'][0]['Table']['Row']);
+//_debug_array($var_result['Worksheet']['Table']['Row']);
+
+                       if (isset($data_temp) AND is_array($data_temp))
+                       {
+
+                               for ($i = $this->header_count; $i < $rows; ++$i)
+                               {
+                                       $data=$data_temp[$i]['Cell'];
+                       
+                                       $num = count($data);
+                                       $buffer = 
$this->import_start_record($buffer);
+                                       $valid_data=0;
+                                       for ($c=0; $c<$num; $c++ )
+                                       {
+                                               //Send name/value pairs along 
with the buffer
+                                               if 
($this->import[$this->header[$c]] != '' && $data[$c]['Data'] != '')
+                                               {
+
+//echo '<br>'.$c.': '.$this->import[$this->header[$c]].' => 
'.$data[$c]['Data'];
+                                                       $buffer = 
$this->import_new_attrib($buffer, 
$this->import[$this->header[$c]],$data[$c]['Data'],$invoice_common);
+                                                       $valid_data= True;
+                                                       if($data[$c]['Data'])
+                                                       {
+                                                               $valid_data++;
+                                                       }
+                                               }
+                                       }
+                                       if ($valid_data > 0)
+                                       {
+                                               $buffer = 
$this->import_end_record($buffer,$invoice_common);
+                                               $valid_data= False;
+                                       }
+                               }
+                       }
+
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+//print_r($buffer);
+                       $this->header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Bel\xF8p [kr]');
+                       return $buffer;
+               }
+               
+
+               function import_start_file($buffer)
+               {
+                       return $buffer;
+               }
+
+               function import_start_record($buffer)
+               {
+                       $top=array();
+                       ++$this->id;
+                       $this->currentrecord = $top;
+                       return $buffer;
+               }
+
+               function import_new_attrib($buffer,$name,$value,$invoice_common)
+               {
+
+                       $value = trim($value);
+                       $value = str_replace('\n','<BR>',$value);
+                       $value = str_replace('\r','',$value);
+
+                       $this->currentrecord += array($name => $value);
+
+                       return $buffer;
+               }
+
+               function import_end_record($buffer,$invoice_common)
+               {
+                       $buffer[$this->id]='';
+                       while ( list($name, $value) = 
each($this->currentrecord))
+                       {
+                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
+
+                               if($invoice_common['num_days'])
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
+                               }
+                               else
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
+                               }
+
+                               if($name=='belop')
+                               {
+                                       $value = str_replace('kr','',$value);
+                                       $value = str_replace(' ','',$value);
+                                       $value = str_replace(',','.',$value);
+
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $value = -1 * abs($value);
+                                       }
+
+                                       $godkjentbelop=$value;
+                               }
+                               if($name=='pmwrkord_code')
+                               {
+                                       
if(!$this->soXport->check_order(intval($value)))
+                                       {
+                                               $value='';
+                                       }
+                                       else
+                                       {
+                                               
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value)); 
+                                       }
+                               }
+                               if($name=='spbudact_code')
+                               {
+                                       $value = 
$this->check_spbudact_code($value);
+                               }
+
+                               if($name=='fakturanr')
+                               {
+                                       if($invoice_common['invoice_num'])
+                                       {
+                                               
$value=$invoice_common['invoice_num'];
+                                       }
+                               }
+
+                               if($name=='mvakode' && 
$invoice_common['auto_tax'])
+                               {
+                                       $value = 
$this->soXport->auto_tax($buffer[$this->id]['dima']);
+                               }
+
+                               if($name=='dima')
+                               {
+                                       $value = $this->check_dima($value);
+                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
+                               }
+
+                               $buffer[$this->id][$name] = $value;
+                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
+                               $buffer[$this->id]['splitt'] = $this->splitt;
+                               $buffer[$this->id]['kildeid'] = $this->kildeid;
+                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
+                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
+                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
+                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
+                               $buffer[$this->id]['periode'] = 
$invoice_common['smonth'];
+                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
+                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
+                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
+                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
+                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
+                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+
+                               if($invoice_common['auto_tax'])
+                               {
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
+                               }
+                               $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+                       }
+                       return $buffer;
+               }
+
+               function check_spbudact_code($id)
+               {
+                       $b_account='';
+                       $this->db->query("select id from fm_b_account where 
id='$id'");
+                       $this->db->next_record();
+                       if ($this->db->f('id'))
+                       { 
+                               $b_account = $this->db->f('id');
+                       }
+                       else
+                       {
+                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
+                               $this->db->next_record();
+                               $b_account = $this->db->f('id');
+                       }
+                       
+                       return $b_account;
+               }
+
+               function check_dima($id)
+               {
+                       $loc1=substr($id,0,4);
+                       $loc2=substr($id,4,2);
+                       
+                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS 
NULL))");
+                       $this->db->next_record();
+                       if ($this->db->f('loc1'))
+                       { 
+                               $dima = $this->db->f('loc1');
+                               
+                               if ($loc2)
+                               {
+                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'  AND 
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
+                                       $this->db->next_record();
+                                       if ($this->db->f('location_code'))
+                                       { 
+                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
+                                       }
+                                       else
+                                       {
+                                               unset($dima);
+                                       }
+                               }
+                       }
+                       
+                       return $dima;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }
+?>

Added: 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_basware_X205
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_basware_X205
                           (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/import/default/Import_fra_basware_X205
   2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,307 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_basware_xml,v 1.13 2007/03/18 16:33:16 
sigurdne Exp $
+       */
+
+       /**
+        * Filteret benytter format X205 for integrasjon mellom Contempus 
Invoice og ClockWork Logistics.
+        * Formatet sender innskannede fakturaer fra Contempus til ClockWork - 
og Portico Estate
+        * @package property
+        */
+
+
+       class import_conv
+       {
+               var $mvakode=0;
+               var $kildeid=1;
+               var $splitt=0;
+               var $soXport;
+               var $invoice;
+               var $bestiller = 85; //cat_id for rolle
+               var $attestant = 84; //cat_id for rolle
+               var $budsjettansvarlig = 83; //cat_id for rolle
+
+               var $import = array(
+                       'Bilagsnr' => 'bilagsnr', 
+                       'Fakturanr' => 'fakturanr', 
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima', //objectclass: organizationalPerson
+                       'DimB' => 'dimb',
+                       'KID' => 'kidnr',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Belop [kr]' => 'belop',
+                       'Referanse' => 'referanse',
+                       'BOEI Gateadresse' => 'boei_gateadresse',
+                       );
+
+               var $header = 
array('Bilagsnr','Fakturanr','Konto','Objekt','DimB','KID','MVA','Tjeneste','Belop
 [kr]','Referanse');
+
+               function import_conv()
+               {
+                       $this->soXport                  = 
CreateObject('property.soXport');     
+                       $this->invoice                  = 
CreateObject('property.soinvoice');
+                       $this->responsible              = 
CreateObject('property.soresponsible');
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->join                             = & 
$this->db->join;
+                       $this->left_join                = & 
$this->db->left_join;
+                       $this->like                             = & 
$this->db->like;
+                       $this->dateformat               = 
$this->db->date_format();
+                       $this->datetimeformat   = $this->db->datetime_format();
+               }
+
+               function import($invoice_common,$download)
+               {
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $valid_data= False;
+                       $bilagsnr = $this->invoice->next_bilagsnr();
+
+                       $buffer = array();
+
+                       $xmlparse = CreateObject('property.XmlToArray');
+                       $xmlparse->setEncoding('UTF-8');
+                       $var_result = $xmlparse->parseFile($tsvfile);
+
+                       set_time_limit(300);
+
+                       if (isset($var_result['INVOICES']) AND 
is_array($var_result['INVOICES']))
+                       {
+                               $transferdate =  str_replace('.', '-', 
$var_result['TRANSACTIONINFORMATION'][0]['TRANSFERDATE']);// 2009.05.28
+                               $transfertime =  
$var_result['TRANSACTIONINFORMATION'][0]['TRANSFERTIME'];// 13:10:28
+                               $regtid         = 
date($this->datetimeformat,strtotime("{$transferdate} {$transfertime}"));
+
+                               $i = 0;
+                               foreach ($var_result['INVOICES'] as $dummy => 
$entry)
+                               {
+                                       $_data = 
$entry['INVOICE'][0]['INVOICEHEADER'][0];
+                               
+//_debug_array($_data);
+//die();
+
+                                       $_data['KEY']; // => 1400050146
+//                                     $_data['SCANNINGNO']; // => 
11E28NJINL3VR6
+//                                     $_data['AMOUNT']; // => 312500
+                                       $_data['ARRIVAL']; // => 2009.05.28
+                                       $_data['CLIENT.CODE']; // => 14
+                                       $_data['CURRENCY.CURRENCYID']; // => NOK
+                                       $_data['EXCHANGERATE']; // => 1
+//                                     $_data['INVOICEDATE']; // => 2009.05.28
+                                       $_data['LOCALAMOUNT']; // => 312500
+                                       $_data['LOCALVATAMOUNT']; // => 62500
+//                                     $_data['MATURITY']; // => 2009.06.30
+                                       $_data['PAYAMOUNT']; // => 0
+                                       $_data['POSTATUSUPDATED']; // => 0
+//                                     $_data['PURCHASEORDERNO']; // => 
1409220008
+                                       $_data['PURCHASEORDERSTATUS.CODE']; // 
=> WaitForMatch
+                                       $_data['SUPPLIER.BANKGIRO']; // => 
70580621110
+//                                     $_data['SUPPLIER.CODE']; // => 100644
+//                                     $_data['SUPPLIERREF']; // => 7869
+                                       $_data['VATAMOUNT']; // => 62500
+
+
+                                       $order_id               = 
$_data['PURCHASEORDERNO'];
+                                       $fakturanr              = $_data['KEY'];
+                                       $fakturadato    = 
date($this->dateformat,strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
+                                       $forfallsdato   = 
date($this->dateformat,strtotime(str_replace('.', '-', $_data['MATURITY'])));
+                                       $periode                = 
date('n',strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
+                                       $belop                  = 
$_data['AMOUNT']/100;
+
+                                       if( $belop < 0 )
+                                       {
+                                               $invoice_common['art'] = 2;
+                                       }
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $belop = -1 * abs($belop);
+                                       }
+
+                                       $kidnr  = $_data['KIDNO'];
+
+                                       $buffer[$i]['external_ref']             
= $_data['SCANNINGNO'];
+                                       $buffer[$i]['pmwrkord_code']    = 
$order_id;
+                                       $buffer[$i]['fakturanr']                
= $fakturanr;
+                                       $buffer[$i]['periode']                  
= $periode;
+                                       $buffer[$i]['forfallsdato']             
= $forfallsdato;
+                                       $buffer[$i]['fakturadato']              
= $fakturadato;
+                                       $buffer[$i]['belop']                    
= $belop;
+                                       $buffer[$i]['godkjentbelop']    = 
$belop;
+                                       
+                                       $buffer[$i]['kidnr']                    
= $kidnr;
+                                       $buffer[$i]['bilagsnr']                 
= $bilagsnr;
+                                       $buffer[$i]['referanse']                
= "ordre: {$order_id}";
+
+                                       $order_info = 
$this->get_order_info($order_id);
+
+                                       if(isset($invoice_common['dim_b']) && 
$invoice_common['dim_b'])
+                                       {
+                                               $buffer[$i]['dimb'] = 
$invoice_common['dim_b'];
+                                       }
+                                       else
+                                       {
+                                               $buffer[$i]['dimb'] = 
$order_info['dimb'];
+                                       }
+
+                                       $buffer[$i]['dima'] = 
$order_info['dima'];
+                                       $buffer[$i]['loc1'] = 
$order_info['loc1'];
+
+                                       $buffer[$i]['mvakode'] = $this->mvakode;
+
+                                       if($buffer[$i]['dima'] && 
(isset($invoice_common['auto_tax']) && $invoice_common['auto_tax']))
+                                       {
+                                               $mvakode = 
$this->soXport->auto_tax($buffer[$i]['dima']);
+                                       
+                                               if($mvakode)
+                                               {
+                                                       $buffer[$i]['mvakode'] 
= $mvakode;
+                                               }
+                                       }
+
+                                       if(isset($invoice_common['vendor_id']) 
&& $invoice_common['vendor_id'])
+                                       {
+                                               $vendor_id = 
$invoice_common['vendor_id'];
+                                       }
+                                       else if ($order_id)
+                                       {
+                                               $vendor_id = 
$order_info['vendor_id'];
+                                       }
+                                       else
+                                       {
+                                               $vendor_id = 
$_data['SUPPLIER.CODE'];
+                                       }
+                                       
+                                       
+                                       if(isset($invoice_common['auto_tax']) 
&& $invoice_common['auto_tax'])
+                                       {
+                                               $buffer[$i]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$i]['mvakode'], 
$order_info['spbudact_code']);
+                                               $buffer[$i]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$i]['mvakode'], $vendor_id);
+                                       }
+
+                                       $buffer[$i]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$i]['loc1']);
+                                       
+                                       $merknad = "lag meg ein link til bilde 
av faktura - ref: {$_data['SCANNINGNO']}";
+                                       
+                                       $buffer[$i]['merknad'] = $merknad;
+                                       $buffer[$i]['splitt'] = $this->splitt;
+                                       $buffer[$i]['kildeid'] = $this->kildeid;
+                                       $buffer[$i]['spbudact_code'] = 
$order_info['spbudact_code'];
+                                       $buffer[$i]['typeid'] = 
isset($invoice_common['type']) && $invoice_common['type'] ? 
$invoice_common['type'] : 1;
+                                       $buffer[$i]['regtid'] = $regtid;
+                                       $buffer[$i]['artid'] = 
$invoice_common['art'];
+                                       $buffer[$i]['spvend_code'] = $vendor_id;
+
+                                       $oppsynsmannid = '';
+                                       if(isset($invoice_common['janitor']) && 
$invoice_common['janitor'])
+                                       {
+                                               $oppsynsmannid = 
$invoice_common['janitor'];
+                                       }
+                                       else if($order_info['janitor'])
+                                       {
+                                               $oppsynsmannid = 
$order_info['janitor'];                                
+                                       }
+
+                                       $saksbehandlerid = '';
+                                       if(isset($invoice_common['supervisor']) 
&& $invoice_common['supervisor'])
+                                       {
+                                               $saksbehandlerid = 
$invoice_common['supervisor'];
+                                       }
+                                       else if($order_info['supervisor'])
+                                       {
+                                               $saksbehandlerid = 
$order_info['supervisor'];   
+                                       }
+
+                                       $budsjettansvarligid = '';
+                                       
if(isset($invoice_common['budget_responsible']) && 
$invoice_common['budget_responsible'])
+                                       {
+                                               $budsjettansvarligid = 
$invoice_common['budget_responsible'];
+                                       }
+                                       else 
if($order_info['budget_responsible'])
+                                       {
+                                               $budsjettansvarligid = 
$order_info['budget_responsible'];
+                                       }
+
+                                       $buffer[$i]['oppsynsmannid']            
= $oppsynsmannid;
+                                       $buffer[$i]['saksbehandlerid']          
= $saksbehandlerid;
+                                       $buffer[$i]['budsjettansvarligid']      
= $budsjettansvarligid;
+
+                                       $bilagsnr++;
+                                       $i++;
+                               }
+                       }
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+                       return $buffer;
+               }
+
+               function get_order_info($order_id = '')
+               {
+                       $order_info = array();
+                       $order_id = (int) $order_id;
+                       $sql = "SELECT 
fm_workorder.location_code,fm_workorder.vendor_id,fm_workorder.account_id,fm_workorder.ecodimb,
 fm_workorder.user_id"
+                       . " FROM fm_workorder {$this->join} fm_project ON 
fm_workorder.project_id = fm_project.id WHERE fm_workorder.id = $order_id";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       if ($this->db->f('location_code'))
+                       { 
+                               $parts = 
explode('-',$this->db->f('location_code'));
+                               $order_info['dima'] = implode('', $parts);
+                               $order_info['loc1'] = $parts[0];
+                       }
+                       
+                       $order_info['vendor_id']                        = 
$this->db->f('vendor_id');
+                       $order_info['spbudact_code']            = 
$this->db->f('account_id');
+                       $order_info['dimb']                                     
= $this->db->f('ecodimb');
+                       
+                       $criteria_janitor                                       
= array('ecodimb' => $order_info['dimb'], 'cat_id' => $this->bestiller ); 
//bestiller
+                       $janitor_contact_id                                     
= $this->responsible->get_responsible($criteria_janitor);
+                       $janitor_user_id                                        
= $this->responsible->get_contact_user_id($janitor_contact_id);
+                       $order_info['janitor']                          = 
$GLOBALS['phpgw']->accounts->get($janitor_user_id)->lid;
+
+                       $criteria_supervisor                            = 
array('ecodimb' => $order_info['dimb'], 'cat_id' => $this->attestant); // 
attestere
+                       $supervisor_contact_id                          = 
$this->responsible->get_responsible($criteria_supervisor);
+                       $supervisor_user_id                                     
= $this->responsible->get_contact_user_id($supervisor_contact_id);
+                       $order_info['supervisor']                       = 
$GLOBALS['phpgw']->accounts->get($supervisor_user_id)->lid;
+
+                       $criteria_budget_responsible            = 
array('ecodimb' => $order_info['dimb'], 'cat_id' => $this->budsjettansvarlig); 
//anviser
+                       $budget_responsible_contact_id          = 
$this->responsible->get_responsible($criteria_budget_responsible);
+                       $budget_responsible_user_id                     = 
$this->responsible->get_contact_user_id($budget_responsible_contact_id);
+                       $order_info['budget_responsible']       = 
$GLOBALS['phpgw']->accounts->get($budget_responsible_user_id)->lid;
+
+                       return $order_info;
+               }
+
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }

Added: 
people/sigurdne/modules/property/trunk/inc/import/default/import_fra_Service_xls
===================================================================
--- 
people/sigurdne/modules/property/trunk/inc/import/default/import_fra_Service_xls
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/inc/import/default/import_fra_Service_xls
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,275 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: import_fra_Service_xls 18358 2007-11-27 04:43:37Z 
skwashd $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
+               var $id = -1;
+               var $kildeid=1;
+               var $splitt=0;
+               var $type = 'csv';
+               var $header_count = 18;
+               var $soXport;
+               var $invoice;
+
+               var $import = array(
+                       'Bestilling' => 'pmwrkord_code', 
+                       'Fakt. Nr' => 'fakturanr',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima',
+                       'Fag/Timer/Matr' => 'dimd',
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Belop [kr]' => 'belop'
+                       );
+
+               var $header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Belop [kr]');
+
+               function import_conv()
+               {
+       //              $this->db               = $GLOBALS['phpgw']->db;
+                       $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->soXport                  = 
CreateObject('property.soXport');     
+                       $this->invoice                  = 
CreateObject('property.boinvoice');
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db               = $this->bocommon->new_db();
+                       $this->dateformat               = 
$this->bocommon->dateformat;
+                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
+               }
+
+               function import($invoice_common,$download)
+               {
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $conv_type      = $invoice_common['conv_type'];
+                       $valid_data= False;
+                       $buffer = array();
+                       $data = CreateObject('phpgwapi.excelreader');
+                       
+                       $data->setOutputEncoding('CP1251');
+                       $data->read($tsvfile);
+
+                       $this->id = 0;
+                       $num = count($this->header)+1;
+                       $rows = $data->sheets[0]['numRows']+1;
+                       for ($i=18; $i<$rows; $i++ ) //First data entry on row 
18
+                       {
+                               $this->currentrecord = array();
+                               
+                               $valid_data=0;
+                               for ($c=1; $c<$num; $c++ )
+                               {
+                                       //Send name/value pairs along with the 
buffer
+                                       if ($data->sheets[0]['cells'][$i][$c] 
!= '')
+                                       {
+                                               
$this->import_new_attrib($this->import[$this->header[$c-1]],$data->sheets[0]['cells'][$i][$c],$invoice_common);
+                                               
if($data->sheets[0]['cells'][$i][$c])
+                                               {
+                                                       $valid_data++;
+                                               }
+                                       }
+                               }
+                               if ($valid_data > 0)
+                               {
+                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
+                                       $valid_data= False;
+                                       $this->id++;
+                               }
+                       }
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+                       $this->header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Belop [kr]');
+                       return $buffer;
+               }
+
+               function import_new_attrib($name,$value,$invoice_common)
+               {
+                       $value = $this->bocommon->ascii2utf(trim($value));
+                       $value = str_replace('\n','<BR>',$value);
+                       $value = str_replace('\r','',$value);
+
+                       $this->currentrecord += array($name => $value);
+               }
+
+               function import_end_record($buffer,$invoice_common)
+               {
+                       $buffer[$this->id]=array();
+                       while ( list($name, $value) = 
each($this->currentrecord))
+                       {
+                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
+
+                               if($invoice_common['num_days'])
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
+                               }
+                               else
+                               {
+                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
+                               }
+
+                               if($name=='belop')
+                               {
+                                       $value = str_replace('kr','',$value);
+                                       $value = str_replace(' ','',$value);
+                                       $value = str_replace(',','.',$value);
+
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $value = -1 * abs($value);
+                                       }
+
+                                       $godkjentbelop=$value;
+                               }
+                               if($name=='pmwrkord_code')
+                               {
+                                       
if(!$this->soXport->check_order(intval($value)))
+                                       {
+                                               $value='';
+                                       }
+                                       else
+                                       {
+                                               
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value)); 
+                                       }
+                               }
+                               if($name=='spbudact_code')
+                               {
+                                       $value = 
$this->check_spbudact_code($value);
+                               }
+
+                               if($name=='fakturanr')
+                               {
+                                       if($invoice_common['invoice_num'])
+                                       {
+                                               
$value=$invoice_common['invoice_num'];
+                                       }
+                               }
+
+                               if($name=='mvakode' && 
$invoice_common['auto_tax'])
+                               {
+                                       $value = 
$this->soXport->auto_tax($buffer[$this->id]['dima']);
+                               }
+
+                               if($name=='dima')
+                               {
+                                       $value = $this->check_dima($value);
+                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
+                               }
+
+                               $buffer[$this->id][$name] = $value;
+                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
+                               $buffer[$this->id]['splitt'] = $this->splitt;
+                               $buffer[$this->id]['kildeid'] = $this->kildeid;
+                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
+                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
+                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
+                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
+                               $buffer[$this->id]['periode'] = 
$invoice_common['smonth'];
+                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
+                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
+                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
+                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
+                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
+                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+
+                               if($invoice_common['auto_tax'])
+                               {
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
+                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
+                               }
+                               $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+                       }
+                       return $buffer;
+               }
+               
+               function check_spbudact_code($id)
+               {
+                       $b_account='';
+                       $this->db->query("select id from fm_b_account where 
id='$id'");
+                       $this->db->next_record();
+                       if ($this->db->f('id'))
+                       { 
+                               $b_account = $this->db->f('id');
+                       }
+                       else
+                       {
+                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
+                               $this->db->next_record();
+                               $b_account = $this->db->f('id');
+                       }
+                       
+                       return $b_account;
+               }
+
+               function check_dima($id)
+               {
+                       $loc1=substr($id,0,4);
+                       $loc2=substr($id,4,2);
+                       
+                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS 
NULL))");
+                       $this->db->next_record();
+                       if ($this->db->f('loc1'))
+                       { 
+                               $dima = $this->db->f('loc1');
+                               
+                               if ($loc2)
+                               {
+                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'  AND 
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
+                                       $this->db->next_record();
+                                       if ($this->db->f('location_code'))
+                                       { 
+                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
+                                       }
+                                       else
+                                       {
+                                               unset($dima);
+                                       }
+                               }
+                       }
+                       return $dima;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }
+?>

Added: people/sigurdne/modules/property/trunk/js/newdesign/CRUDTable.php
===================================================================
--- people/sigurdne/modules/property/trunk/js/newdesign/CRUDTable.php           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/newdesign/CRUDTable.php   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,50 @@
+<?php
+
+$task=$_POST['task'] ;
+switch($task) {
+case 'deleteitem':
+       DeleteItem();
+       break;
+case 'find':
+       Find();
+       break;
+
+}
+
+function DeleteItem()
+{
+       $Id=$_POST['id'] ;
+       echo $Id;
+}
+
+function Find()
+{
+       $payments=$_POST['payments'] ;
+       $address=$_POST['address'] ;
+       $prodid=$_POST['prodid'] ;
+       $gaardsnr=$_POST['gaardsnr'] ;
+       $bruksnr=$_POST['bruksnr'] ;
+       $festenr=$_POST['festenr'] ;
+       $seksjonsnr=$_POST['seksjonsnr'] ;
+
+       $filterfields =  array 
($payments,$address,$prodid,$gaardsnr,$bruksnr,$festenr,$seksjonsnr);
+
+       $text = "";
+       foreach($filterfields as $filter)
+       {
+               if ($filter != "") $text .=$filter ;
+
+       }
+       echo $text;
+
+
+}
+
+
+
+
+
+
+?>
+
+


Property changes on: 
people/sigurdne/modules/property/trunk/js/newdesign/CRUDTable.php
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/js/yahoo/account.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/account.index.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/account.index.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,71 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       // define buttons
+       var oNormalButton_0;
+       var selectsButtons = [];
+
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/actor.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/actor.index.js              
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/actor.index.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,82 @@
+//--------------------------------------------------------
+// Declaration of actor.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [
+       {order:0, 
var_URL:'member_id',name:'btn_member_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+
+        var linktoolTips =[
+               {name:'btn_columns', title:'columns', description:'Choose 
columns'}
+        ]
+/****************************************************************************************/
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //focus initial
+                       if(path_values.role == 'vendor')
+                       {
+                               oMenuButton_0.focus();
+                       }
+                       else
+                       {
+                               oMenuButton_1.focus();
+                       }
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       // nothing
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+/****************************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute.js   
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,142 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "property.uiadmin_entity.category"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+                       create_table_info_invoice_sub();
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+
+/********************************************************************************
+       *
+       */
+       this.create_table_info_invoice_sub = function()
+       {
+               div_message= 
YAHOO.util.Dom.getElementsByClassName('field','div')[0];
+               newTable = document.createElement('table');
+               //fix IE error
+               newTbody = document.createElement("TBODY");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.current_consult)
+                {
+                       for(i=0; i<values_ds.current_consult.length; i++)
+                       {
+                               newTR = document.createElement('tr');
+                               for(j=0; j<2; j++)
+                               {
+                                       newTD = document.createElement('td');
+                                       
newTD.appendChild(document.createTextNode(values_ds.current_consult[i][j]));
+                                       newTR.appendChild(newTD);
+                                       //add : after title
+                                       if(j==0)
+                                       {
+                                               newTD = 
document.createElement('td');
+                                               
newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+                                               newTR.appendChild(newTD);
+                                       }
+                               }
+                               newTbody.appendChild(newTR);
+                        }
+                }
+                newTable.appendChild(newTbody);
+                div_message.appendChild(newTable);
+       }
+
+
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+
+       }
+
+       
/********************************************************************************
+ *
+ */
+       this.move_record = function(sUrl)
+       {
+               var callback =  {       success: function(o){execute_ds()},
+                                                       failure: 
function(o){window.alert('Server or your connection is death.')},
+                                                       timeout: 10000
+                                               };
+               sUrl = sUrl + "&confirm=yes&phpgw_return_as=json";
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: 
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute_group.js
===================================================================
--- 
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute_group.js 
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.attribute_group.js 
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,103 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "property.uiadmin_entity.category"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+
+       }
+
+       
/********************************************************************************
+ *
+ */
+       this.move_record = function(sUrl)
+       {
+               var callback =  {       success: function(o){execute_ds()},
+                                                       failure: 
function(o){window.alert('Server or your connection is death.')},
+                                                       timeout: 10000
+                                               };
+               sUrl = sUrl + "&confirm=yes&phpgw_return_as=json";
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.category.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.category.js    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.category.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,87 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "property.uiadmin_entity.index"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: 
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.function_group.js
===================================================================
--- 
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.function_group.js  
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.function_group.js  
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,103 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "property.uiadmin_entity.category"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+
+       }
+
+       
/********************************************************************************
+ *
+ */
+       this.move_record = function(sUrl)
+       {
+               var callback =  {       success: function(o){execute_ds()},
+                                                       failure: 
function(o){window.alert('Server or your connection is death.')},
+                                                       timeout: 10000
+                                               };
+               sUrl = sUrl + "&confirm=yes&phpgw_return_as=json";
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.index.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/admin_entity.index.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,87 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "admin.uimainscreen.mainscreen"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: 
people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute.js 
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute.js 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,103 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "property.uiadmin_entity.category"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+
+       }
+
+       
/********************************************************************************
+ *
+ */
+       this.move_record = function(sUrl,allrows)
+       {
+               var callback =  {       success: 
function(o){execute_ds(allrows)},
+                                                       failure: 
function(o){window.alert('Server or your connection is death.')},
+                                                       timeout: 10000
+                                               };
+               sUrl = sUrl + "&confirm=yes&phpgw_return_as=json";
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: 
people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute_group.js
===================================================================
--- 
people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute_group.js
                           (rev 0)
+++ 
people/sigurdne/modules/property/trunk/js/yahoo/admin_location.attribute_group.js
   2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,103 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "property.uiadmin_entity.category"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+
+       }
+
+       
/********************************************************************************
+ *
+ */
+       this.move_record = function(sUrl)
+       {
+               var callback =  {       success: function(o){execute_ds()},
+                                                       failure: 
function(o){window.alert('Server or your connection is death.')},
+                                                       timeout: 10000
+                                               };
+               sUrl = sUrl + "&confirm=yes&phpgw_return_as=json";
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/admin_location.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/admin_location.index.js     
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/admin_location.index.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,87 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ]
+
+    var toolTips = [
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "admin.uimainscreen.mainscreen"
+       }
+
+       var linktoolTips =[
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+                       //delete oMenuButton_0.getMenu().itemData[0];
+
+                       //for this particular module, the Category's combo box 
has sets his own category.
+                       //oMenuButton_0.set("label", ("<em>" + 
array_options[0][path_values.cat_id][1] + "</em>"));
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,283 @@
+var  myPaginator_1, myDataTable_1;
+var Button_2_0;
+
+var FormatterCheckItems = function(elCell, oRecord, oColumn, oData)
+{
+       elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks_update\"  value=\""+oRecord.getData('activity_id')+"\" 
name=\"values[select][]\"/></center>" +
+                       "<input type=\"hidden\" 
value=\""+oRecord.getData('index_count')+"\" 
name=\"values[id]["+oRecord.getData('activity_id')+"]\"/>" +
+                       "<input type=\"hidden\" 
value=\""+oRecord.getData('m_cost')+"\" 
name=\"values[m_cost]["+oRecord.getData('activity_id')+"]\"/>" +
+                       "<input type=\"hidden\" 
value=\""+oRecord.getData('w_cost')+"\" 
name=\"values[w_cost]["+oRecord.getData('activity_id')+"]\"/>" +
+                       "<input type=\"hidden\" 
value=\""+oRecord.getData('total_cost')+"\" 
name=\"values[total_cost]["+oRecord.getData('activity_id')+"]\"/>";
+}
+/********************************************************************************/
+       this.onUpdateClick=function()
+       {
+               flag = false;
+               //clean hidden buttons actions
+               //cleanValuesHiddenActionsButtons();
+
+               //validate ckecks true
+               array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks_update');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }
+               //validate textbox (newIndex and date)
+               array_txtboxs_buttons = 
YAHOO.util.Dom.getElementsByClassName('mybottonsUpdates');
+               for ( var i in array_txtboxs_buttons )
+               {
+                       if(array_txtboxs_buttons[i].value =="")
+                       {
+                               return;
+                       }
+               }
+
+               if(flag)
+               {
+                       //asign value to hidden
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[2]);
+                       execute_async(myDataTable_1);
+               }
+
+       }
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+               if(num==1)
+               {
+                       //tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[1].parentNode;
+                       tableObject = 
document.body.getElementsByTagName('table');
+                       for (x=0; x<tableObject.length; x++)
+                       {
+                               if (tableObject[x].parentNode.id == 
'datatable-container_1')
+                                       { tableYUI = tableObject[x]; }
+                       }
+                       tableYUI.setAttribute("id","tableYUI");
+                       tableYUI.deleteTFoot();
+                       YAHOO.util.Dom.get("values_date").value = "";
+                       YAHOO.util.Dom.get("values[new_index]").value = "";
+                       addFooterDatatable();
+               }
+       }
+
+/********************************************************************************
+*
+*/
+       this.addFooterDatatable = function()
+       {
+               //Create ROW
+               newTR = document.createElement('tr');
+               //RowChecked
+               td_empty(10);
+               CreateRowChecked("mychecks_update");
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR.cloneNode(true));
+       }
+
+/********************************************************************************
+*
+*/
+       check_all = function(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                               //for class=transfer_idClass, they have to be 
interchanged
+                               if(myclass=="mychecks_update")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+
+/********************************************************************************/
+/********************************************************************************/
+var  myPaginator_0, myDataTable_0;
+var Button_0_0, Button_0_1, Button_0_2;
+var Button_1_0,Button_1_1,Button_1_2,Button_1_3,Button_1_4;
+
+/********************************************************************************/
+       this.cleanValuesHiddenActionsButtons=function()
+       {
+               /*var array_buttons = 
YAHOO.util.Dom.getElementsByClassName('actionButton','input');
+               for ( var i in array_buttons )
+               {
+                       array_buttons[i].setAttribute("value","");
+               }
+               for(var y=0;y<array_buttons.length;y++)
+               {
+                       array_buttons[y].value = "";
+               }*/
+               YAHOO.util.Dom.get('hd_values[enable_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_values[disable_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_values[delete_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_values[add_alarm]').value = '';
+       }
+/********************************************************************************/
+       this.onActionsClick=function()
+       {
+               flag = false;
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+
+               //validate ckecks true
+               array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }
+
+               if(flag)
+               {
+                       //asign value to hidden
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[1]);//second form
+                       execute_async(myDataTable_0);
+               }
+       }
+/********************************************************************************/
+       this.onAddClick=function()
+       {
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+
+               //validate date drop-down in hidden buttons
+               validateValuesHiddenFilterButtons();
+               
+               //asign value to hidden
+               YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+               formObject = document.body.getElementsByTagName('form');
+               YAHOO.util.Connect.setForm(formObject[1]);//second form
+               execute_async(myDataTable_0);
+
+               //come back initial labels to bottons_1_*
+               Button_1_0.set("label", myButtons[1][0].label);
+               Button_1_1.set("label",myButtons[1][1].label);
+               Button_1_2.set("label", myButtons[1][2].label);
+               Button_1_3.set("label", myButtons[1][3].label);
+
+               //set up initial values to hidden filter buttons
+               cleanValuesHiddenFilterButtons();
+       }
+
+/********************************************************************************/
             
+       this.validateValuesHiddenFilterButtons=function()
+       {
+
+               //validate date drop-down in hidden buttons
+               /*array_buttons = 
YAHOO.util.Dom.getElementsByClassName('actionsFilter');
+               for ( var i in array_buttons )
+               {
+                       if(array_buttons[i].value ==0 || array_buttons[i].value 
=="" )
+                       {
+                               return;
+                       }
+               }*/
+               
+               if( (YAHOO.util.Dom.get('hd_values[time][days]').value == 0) || 
(YAHOO.util.Dom.get('hd_values[time][hours]').value == 0) || 
(YAHOO.util.Dom.get('hd_values[time][mins]').value == 0) )
+               {
+                       exit;
+               }
+       }       
+       
+/********************************************************************************/
     
+       this.cleanValuesHiddenFilterButtons=function()
+       {
+               /*var array_buttons = 
YAHOO.util.Dom.getElementsByClassName('actionButton','input');
+               for ( var i in array_buttons )
+               {
+                       array_buttons[i].value = myButtons[1][i].value_hidden;
+               }*/
+               
+               YAHOO.util.Dom.get('hd_values[time][days]').value = 
myButtons[1][0].value_hidden;
+               YAHOO.util.Dom.get('hd_values[time][hours]').value = 
myButtons[1][1].value_hidden;
+               YAHOO.util.Dom.get('hd_values[time][mins]').value = 
myButtons[1][2].value_hidden;
+               YAHOO.util.Dom.get('hd_values[user_id]').value = 
myButtons[1][3].value_hidden;
+       }
+       
+/********************************************************************************/
+       this.onDateClick=function(p_sType, p_aArgs, p_oItem)
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.opt+"");
+               control.set("value", p_oItem.opt);
+
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.opt;
+
+       }
+/********************************************************************************/
+       this.onUserClick=function(p_sType, p_aArgs, p_oItem)
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.name+"");
+               control.set("value", p_oItem.id);
+
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.id;
+       }
+
+
+/********************************************************************************/
+       var myFormatterCheck = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks\"  value=\"\" 
name=\"values[alarm]["+oRecord.getData('alarm_id')+"]\"/></center>";
+       }
+/********************************************************************************/
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+/********************************************************************************/
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
+       }
+ 
/********************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone",
+                       type: "js",
+                   fullpath: property_js
+                   });
+
+               loader.require("anyone");
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit_item.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit_item.js      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/agreement.edit_item.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,65 @@
+
+
+//*************************
+var  myPaginator_0,myDataTable_0;
+var Button_0_0, Button_0_1;
+
+
+/********************************************************************************/
+       this.onUpdateClick=function()
+       {
+
+               YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+               formObject = document.body.getElementsByTagName('form');
+               YAHOO.util.Connect.setForm(formObject[1]);
+               execute_async(myDataTable_0);
+
+       }
+
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+               //if(num==1)
+               //{
+                       YAHOO.util.Dom.get("values_date").value = "";
+                       YAHOO.util.Dom.get("values[new_index]").value = "";
+               //}
+       }
+/********************************************************************************/
+       this.onDeleteClick=function()
+       {
+               var path_update = new Array();
+               path_update["menuaction"] = base_java_url.menuaction;
+               path_update["agreement_id"] = base_java_url.agreement_id;
+               path_update["id"] = base_java_url.id;
+               path_update["delete_last"] = 1;
+               
+               var sUrl = phpGWLink('index.php',path_update);
+               
+               var callback =  {       success: function(o){
+                       
+                       execute_async(myDataTable_0);
+                       },
+                       failure: function(o){window.alert('Server or your 
connection is death.')},
+                       timeout: 10000
+               };
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+       
+
+/********************************************************************************/
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       var loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/agreement.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/agreement.index.js          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/agreement.index.js  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,76 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2;
+       var selectsButtons = [
+       {order:0, 
var_URL:'member_id',name:'btn_member_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''},
+       {order:2, 
var_URL:'vendor_id',name:'btn_vendor_id',style:'partOFTownbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+       ]
+
+       var linktoolTips =
+       [
+               {name:'btn_columns', title:'Columns', description:'Choose 
columns'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //focus initial
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+       }
+
+
+//----------------------------------------------------------
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/agreement.view.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/agreement.view.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/agreement.view.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,30 @@
+var  myPaginator_0, myDataTable_0;
+
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+       }
+/********************************************************************************/
     
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+/********************************************************************************/
     
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
+       }
+ 
/********************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone",
+                       type: "js",
+                   fullpath: property_js
+                   });
+       
+               loader.require("anyone");
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/agreement.view_item.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/agreement.view_item.js      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/agreement.view_item.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,30 @@
+var  myPaginator_0, myDataTable_0;
+
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+       }
+/********************************************************************************/
     
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+/********************************************************************************/
     
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
+       }
+ 
/********************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone",
+                       type: "js",
+                   fullpath: property_js
+                   });
+       
+               loader.require("anyone");
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/alarm.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/alarm.index.js              
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/alarm.index.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,143 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var selectsButtons = [
+               ]
+
+               // define buttons
+               var 
oNormalButton_0,oNormalButton_1,oNormalButton_2,oNormalButton_3,oNormalButton_4,oNormalButton_5;
+               var normalButtons = [
+                   {order:0, name:'btn_test_cron',     
funct:"onTestCronClick"},
+                   {order:1, name:'btn_enable',        funct:"onEnableClick"},
+                   {order:2, name:'btn_disable',       funct:"onDisableClick"},
+                   {order:3, name:'btn_delete',        funct:"onDeleteClick"},
+                       {order:4, name:'btn_search',    funct:"onSearchClick"},
+                       {order:5, name:'btn_new',               
funct:"onNewClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+                ]
+
+           // define Text buttons
+           var textImput = [
+           {order:0, name:'query',     id:'txt_query'}
+           ]
+
+               var toolTips = [
+               ]
+
+               var config_values = {
+                       date_search     : 0,
+                       PanelLoading: 0
+               }
+
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                               oNormalButton_0.focus();
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                       }
+               }
+               
+       /* 
****************************************************************************** 
*/
+               this.myParticularRenderEvent = function()
+               {
+               }
+       /* 
****************************************************************************** 
*/
+               this.onTestCronClick = function()
+               {
+                       actionToPHP("test_cron");
+               }
+       /* 
****************************************************************************** 
*/
+               this.onEnableClick = function()
+               {
+                       actionToPHP("enable_alarm");
+               }
+       
+       /* 
****************************************************************************** 
*/
+               this.onDisableClick = function()
+               {
+                       actionToPHP("disable_alarm");
+               }       
+       /* 
****************************************************************************** 
*/
+               this.onDeleteClick = function()
+               {
+                       actionToPHP("delete_alarm");
+               }
+               
+       /* 
****************************************************************************** 
*/
+               this.actionToPHP = function( action_button )
+               {               
+                       //look up "values[action_button]" hidden button AND 
change news values
+                       my_hdn_action = 
YAHOO.util.Dom.get("values[action_button]");
+                       new_name = "values["+action_button+"]";
+                       my_hdn_action.setAttribute("id",new_name);
+                       my_hdn_action.setAttribute("name",new_name);
+                       my_hdn_action.setAttribute("value",true);
+                       
+                       //get the last div in th form
+                       var divs= 
YAHOO.util.Dom.getElementsByClassName('field');
+                       // choose div (id = controlsForm_container) 
+                       var mydiv = divs[divs.length-1];
+                       //remove all child of mydiv
+                       if ( mydiv.hasChildNodes() )
+                       {
+                           while ( mydiv.childNodes.length >= 1 )
+                           {
+                               mydiv.removeChild( mydiv.firstChild );
+                           }
+                       }
+                        
+                       // styles for dont show
+                       mydiv.style.display = 'none';
+
+                       //get all controls of datatable
+                       valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+                       var myclone = null;
+                       //add all control to form.
+                       for(i=0;i<valuesForPHP.length;i++)
+                       {
+                               //checkBoxs don't have children.. for that 
reason the argument is FALSE
+                               myclone = valuesForPHP[i].cloneNode(true);
+                               mydiv.appendChild(myclone);
+                       }
+
+                       // find out the unique form
+                       formObject = document.getElementsByTagName('form');
+                       // modify the 'form' for send it as POST using 
asyncronize call
+                       YAHOO.util.Connect.setForm(formObject[0]);
+                       
+                       //get back olds values for values[action_button]
+                       old_name = "values[action_button]";
+                       my_hdn_action.setAttribute("id",old_name);
+                       my_hdn_action.setAttribute("name",old_name);
+                       my_hdn_action.setAttribute("value",false);
+
+                       maintain_pagination_order();
+                       execute_ds();                    
+               }               
+               
+       /* 
****************************************************************************** 
*/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+                   loader.insert();
+               });
\ No newline at end of file

Added: people/sigurdne/modules/property/trunk/js/yahoo/alarm.list_alarm.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/alarm.list_alarm.js         
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/alarm.list_alarm.js 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,65 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var selectsButtons = [
+               ]
+
+               // define buttons
+               var oNormalButton_0;
+               var normalButtons = [
+                       {order:0, name:'btn_search',funct:"onSearchClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+                ]
+
+           // define Text buttons
+           var textImput = [
+           {order:0, name:'query',     id:'txt_query'}
+           ]
+
+               var toolTips = [
+               ]
+
+               var config_values = {
+                       date_search     : 0,
+                       PanelLoading: 0
+               }
+
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                       }
+               }
+       
/********************************************************************************/
+               this.myParticularRenderEvent = function()
+               {
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+               }
+
+       
/********************************************************************************/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+
+                   loader.insert();
+               });
\ No newline at end of file

Added: people/sigurdne/modules/property/trunk/js/yahoo/budget.basis.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/budget.basis.js             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/budget.basis.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,116 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+               var selectsButtons = [
+               {order:0, var_URL:'year',                       
name:'btn_year',                        style:'',dependiente:[1,3]},
+               {order:1, var_URL:'revision',           name:'btn_revision',    
        style:'',dependiente:[]},
+               {order:2, var_URL:'district_id',        name:'btn_district_id', 
        style:'',dependiente:[]},
+               {order:3, var_URL:'grouping',           name:'btn_grouping',    
        style:'',dependiente:[]}
+               ]
+
+               // define buttons
+               var oNormalButton_0,oNormalButton_1;
+               var normalButtons = [
+                       {order:0, name:'btn_search',funct:"onSearchClick"},
+                   {order:1, name:'btn_new',   funct:"onNewClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+                ]
+
+
+           var textImput = [
+           {order:0, name:'query',id:'txt_query'}
+           ]
+
+               var toolTips = [
+               ]
+
+               // define the hidden column in datatable
+               var config_values = {
+                       date_search : 0, //if search has link "Data search"
+                       PanelLoading : 0
+               }
+
+               var tableYUI;
+       
/********************************************************************************/
+               var myFormatDate = function(elCell, oRecord, oColumn, oData)
+               {
+                       elCell.innerHTML = YAHOO.util.Number.format(oData, 
{decimalPlaces:0, decimalSeparator:",", thousandsSeparator:" "});
+               }
+
+       
/********************************************************************************/
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                               //locate (asign ID) to datatable
+                               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                               tableYUI.setAttribute("id","tableYUI");
+                               //Focus
+                               oMenuButton_0.focus();                  
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                               //"oMenuButton_1._menu.itemData"   shows new 
data dependiente
+                               new_values = oMenuButton_1._menu.itemData
+                               for(p=0;p<new_values.length;p++)
+                               {
+                                       //"revision" value is passed for 
"values_ds", because newYear click send 2 values: year & revision
+                                       if (new_values[p].value == 
values_ds.revision)
+                                       {
+                                               oMenuButton_1.set("label", 
("<em>" + values_ds.revision + "</em>"));
+                                               path_values.revision = 
values_ds.revision;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+       
/********************************************************************************/
+               this.myParticularRenderEvent = function()
+               {
+                       tableYUI.deleteTFoot();
+                       addFooterDatatable();
+               }
+               
+       
/********************************************************************************/
+
+               this.addFooterDatatable = function()
+               {
+               
+                       //call getSumPerPage(name of column) in property.js
+                       tmp_sum = getSumPerPage('budget_cost',0);
+
+                       //Create ROW
+                       newTR = document.createElement('tr');
+                       td_empty(7);
+                       td_sum(tmp_sum);
+
+                       //Add to Table
+                       myfoot = tableYUI.createTFoot();
+                       myfoot.setAttribute("id","myfoot");
+                       myfoot.appendChild(newTR);
+               }
+       
/********************************************************************************/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+
+                   loader.insert();
+               });

Added: people/sigurdne/modules/property/trunk/js/yahoo/budget.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/budget.index.js             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/budget.index.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,121 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3, 
oMenuButton_4, oMenuButton_5;
+               var selectsButtons = [
+               {order:0, var_URL:'year',                       
name:'btn_year',                        style:'',dependiente:[1,3]},
+               {order:1, var_URL:'revision',           name:'btn_revision',    
        style:'',dependiente:[]},
+               {order:2, var_URL:'district_id',        name:'btn_district_id', 
        style:'',dependiente:[]},
+               {order:3, var_URL:'grouping',           name:'btn_grouping',    
        style:'',dependiente:[]},
+               {order:4, var_URL:'cat_id',                     
name:'btn_cat_id',                      style:'',dependiente:[]},
+               {order:5, var_URL:'dimb_id',            name:'btn_dimb_id',     
                style:'',dependiente:[]}
+               ]
+
+               // define buttons
+               var oNormalButton_0,oNormalButton_1;
+               var normalButtons = [
+                       {order:0, name:'btn_search',funct:"onSearchClick"},
+                   {order:1, name:'btn_new',   funct:"onNewClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+                ]
+
+
+           var textImput = [
+           {order:0, name:'query',id:'txt_query'}
+           ]
+
+               var toolTips = [
+               ]
+
+               // define the hidden column in datatable
+               var config_values = {
+                       date_search : 0, //if search has link "Data search"
+                       PanelLoading : 0
+               }
+
+               var tableYUI;
+       
/********************************************************************************/
+               var myFormatDate = function(elCell, oRecord, oColumn, oData)
+               {
+                       elCell.innerHTML = YAHOO.util.Number.format(oData, 
{decimalPlaces:0, decimalSeparator:",", thousandsSeparator:" "});
+               }
+
+       
/********************************************************************************/
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                               //locate (asign ID) to datatable
+                               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                               tableYUI.setAttribute("id","tableYUI");
+                               //Focus
+                               oMenuButton_0.focus();                  
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                               //"oMenuButton_1._menu.itemData"   shows new 
data dependiente
+                               new_values = oMenuButton_1._menu.itemData
+                               for(p=0;p<new_values.length;p++)
+                               {
+                                       //"revision" value is passed for 
"values_ds", because newYear click send 2 values: year & revision
+                                       if (new_values[p].value == 
values_ds.revision)
+                                       {
+                                               oMenuButton_1.set("label", 
("<em>" + values_ds.revision + "</em>"));
+                                               path_values.revision = 
values_ds.revision;
+                                               break;
+                                       }
+                               }
+
+                               
+                               
+                       }
+               }
+       
/********************************************************************************/
+               this.myParticularRenderEvent = function()
+               {
+                       tableYUI.deleteTFoot();
+                       addFooterDatatable();
+               }
+               
+       
/********************************************************************************/
+
+               this.addFooterDatatable = function()
+               {
+               
+                       //call getSumPerPage(name of column) in property.js
+                       tmp_sum = getSumPerPage('budget_cost',0);
+
+                       //Create ROW
+                       newTR = document.createElement('tr');
+                       td_empty(9);
+                       td_sum(tmp_sum);
+
+                       //Add to Table
+                       myfoot = tableYUI.createTFoot();
+                       myfoot.setAttribute("id","myfoot");
+                       myfoot.appendChild(newTR);
+               }
+       
/********************************************************************************/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+
+                   loader.insert();
+               });

Added: people/sigurdne/modules/property/trunk/js/yahoo/budget.obligations.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/budget.obligations.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/budget.obligations.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,157 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+               var selectsButtons = [
+               {order:0, var_URL:'year',               name:'btn_year',        
        style:'',dependiente:[]},
+               {order:1, var_URL:'district_id',name:'btn_district_id', 
style:'',dependiente:[]},
+               {order:2, var_URL:'cat_id',             name:'btn_cat_id',      
        style:'',dependiente:[]},
+               {order:3, var_URL:'grouping',   name:'btn_grouping',    
style:'',dependiente:[]}
+               ]
+
+               // define buttons
+               var oNormalButton_0;
+               var normalButtons = [
+                       {order:0, name:'btn_search',funct:"onSearchClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+                ]
+
+
+           var textImput = [
+           {order:0, name:'query',id:'txt_query'}
+           ]
+
+               var toolTips = [
+               ]
+
+               // define the hidden column in datatable
+               var config_values = {
+                       date_search : 0, //if search has link "Data search"
+                       PanelLoading : 0
+               }
+
+               var tableYUI;
+       
/********************************************************************************/
              
+               this.filter_grouping = function(year,district_id,param,details)
+               {
+                       if(details)
+                       {
+                               //look for  "grouping" column
+                               oMenuButton_3.set("label", ("<em>" + param + 
"</em>"));
+                               oMenuButton_3.set("value", param);
+                               path_values.grouping = param;
+                       }
+                       else
+                       {
+                               //reset GROUPING filter
+                               oMenuButton_3.set("label", ("<em>" + 
array_options[3][0][1] + "</em>"));
+                               path_values.grouping =  array_options[3][0][0];
+                               path_values.b_account = param;
+                       }
+
+                       oMenuButton_0.set("label", ("<em>" + year + "</em>"));
+                       path_values.year= year;
+               
+                       //look for REVISION filter 's text using COD
+                       index = locate_in_array_options(1,"value",district_id);
+                       oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       oMenuButton_1.set("value", array_options[1][index][0]);
+                       path_values.district_id = district_id;
+                       
+                       path_values.details = details;
+                       execute_ds();
+               }
+
+       
/********************************************************************************/
+               var myformatLinkPGW = function(elCell, oRecord, oColumn, oData)
+               {
+                       var details;
+                       if(oRecord._oData.grouping != "")
+                               details = 1;
+                       else
+                               details = 0;
+                       
+                       elCell.innerHTML = "<a 
onclick=\"javascript:filter_grouping("+path_values.year+","+oRecord._oData.district_id+","+
 oData +","+details+");\" href=\"#\">" + oData + "</a>";
+               }       
+       
/********************************************************************************/
+               var myFormatLink_Count = function(elCell, oRecord, oColumn, 
oData)
+               {
+                       link = "";
+                       switch (oColumn.key)
+                       {
+                               case "obligation" :  link = 
oRecord._oData.link_obligation; break;
+                               case "actual_cost" :  link = 
oRecord._oData.link_actual_cost; break;
+                       }
+                       elCell.innerHTML = "<a href=\"" + link + "\">" + oData 
+ "</a>";
+               }               
+       
/********************************************************************************/
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                               //locate (asign ID) to datatable
+                               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                               tableYUI.setAttribute("id","tableYUI");
+                               //Focus
+                               oMenuButton_0.focus();  
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+
+                       }
+               }
+       
/********************************************************************************/
+               this.myParticularRenderEvent = function()
+               {
+                       tableYUI.deleteTFoot();
+                       addFooterDatatable();
+               }
+               
+       
/********************************************************************************/
+
+               this.addFooterDatatable = function()
+               {
+               
+                       //Create ROW
+                       newTR = document.createElement('tr');
+                       
+                       td_empty(4);
+                       td_sum(getSumPerPage("hits_ex",0));
+                       td_empty(1);
+                       td_sum(getSumPerPage("budget_cost_ex",0));
+                       td_empty(1);
+                       td_sum(getSumPerPage("obligation_ex",0));
+                       td_empty(2);
+                       td_sum(getSumPerPage("actual_cost_ex",0));
+                       td_empty(2);                    
+                       td_sum(getSumPerPage("diff_ex",0));
+                       
+                       //Add to Table
+                       myfoot = tableYUI.createTFoot();
+                       myfoot.setAttribute("id","myfoot");
+                       myfoot.appendChild(newTR);
+               }
+       
/********************************************************************************/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+
+                   loader.insert();
+               });
\ No newline at end of file

Added: people/sigurdne/modules/property/trunk/js/yahoo/category.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/category.index.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/category.index.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,63 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       // define buttons
+       var selectsButtons = [];
+
+       var oNormalButton_0,oNormalButton_1,oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "admin.uimainscreen.mainscreen"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+               document.getElementById('txt_query').focus();
+       }
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/custom.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/custom.index.js             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/custom.index.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,72 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       // define buttons
+       var oNormalButton_0;
+       var selectsButtons = [];
+
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+               document.getElementById('txt_query').focus();
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/custom.view.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/custom.view.js              
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/custom.view.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,70 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [];
+
+       // define buttons
+       var oNormalButton_0;
+       var normalButtons = [
+       {order:0, name:'btn_export', funct:"onDownloadClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/document.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/document.index.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/document.index.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,76 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [
+       {order:0, 
var_URL:'doc_type',name:'btn_type_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'filter',name:'btn_user_id',style:'districtbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/document.list_doc.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/document.list_doc.js        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/document.list_doc.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,157 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [
+       {order:0, 
var_URL:'doc_type',name:'btn_type_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'filter',name:'btn_user_id',style:'districtbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       oMenuButton_0.focus();
+                       create_table_info_invoice_sub();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+
+/********************************************************************************
+       *
+       */
+       this.create_table_info_invoice_sub = function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.height = 
values_ds.toolbar_height + 'px';//"60px";
+               div_message = 
YAHOO.util.Dom.getElementsByClassName('field','div')[0];
+               newTable = document.createElement('table');
+               newDiv = document.createElement("div");
+
+               //fix IE error
+               newTbody = document.createElement("TBODY");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.current_consult)
+                {
+                       for(i=0; i<values_ds.current_consult.length; i++)
+                       {
+                               if(values_ds.current_consult[i]['extra'])
+                               {
+                                       newTR = document.createElement('tr');
+                                       newTD = document.createElement('td');
+                                       newTD.setAttribute("width","20");
+
+                                       
newTD.appendChild(document.createTextNode(values_ds.current_consult[i]['name']));
+                                       newTR.appendChild(newTD);
+                                       newTD = document.createElement('td');
+                                       newTD.setAttribute("width","5");
+
+                                       
newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+                                       newTR.appendChild(newTD);
+
+                                       newTbody.appendChild(newTR);
+                                       newTD = document.createElement('td');
+
+                                       if(i<values_ds.current_consult.length-2)
+                                       {
+                                               var newLink = 
document.createElement('a');
+                                               newLink.setAttribute("href", 
html_entity_decode(values_ds.current_consult[i]['query_link']));
+                                               
newLink.appendChild(document.createTextNode(values_ds.current_consult[i]['value']));
+                                               newTD.appendChild(newLink);
+                                               
newTD.setAttribute("width","20");
+                                       }
+                                       else
+                                       {
+                                               //Suppress the street_id from 
the address
+                                               
if(!values_ds.current_consult[i]['extra'][1])
+                                               {
+                                                       
newTD.appendChild(document.createTextNode(values_ds.current_consult[i]['value']));
+                                                       
newTD.setAttribute("width","20");
+                                               }
+                                       }
+
+                                       newTR.appendChild(newTD);
+
+                                       newTD = document.createElement('td');
+                                       var adress = 
values_ds.current_consult[i]['extra'][0]['value'];
+
+                                       //The street number
+                                       
if(values_ds.current_consult[i]['extra'][1])
+                                       {
+                                               adress = adress + 
values_ds.current_consult[i]['extra'][1]['value'];
+                                       }
+
+                                       
newTD.appendChild(document.createTextNode(adress));
+                                       newTR.appendChild(newTD);
+                                       newTbody.appendChild(newTR);
+                               }
+                        }
+                }
+                newTable.appendChild(newTbody);
+                newTable.setAttribute("style","clear:both; width:400px;");
+                newDiv.appendChild(newTable);
+                newDiv.setAttribute("style","clear:both; width:450px;");
+                div_message.appendChild(newDiv);
+       }
+
+
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
//YAHOO.util.Dom.getElementsByClassName('toolbar-first','div')[0].style.display 
= 'none';
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/document.view.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/document.view.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/document.view.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,22 @@
+var  myPaginator_0, myDataTable_0
+
+/********************************************************************************/
+this.myParticularRenderEvent = function()
+{
+}
+ 
/********************************************************************************/
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/entity.attrib_history.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/entity.attrib_history.js    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/entity.attrib_history.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,22 @@
+var  myPaginator_0, myDataTable_0
+
+/********************************************************************************/
+this.myParticularRenderEvent = function()
+{
+}
+ 
/********************************************************************************/
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/entity.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/entity.edit.js              
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/entity.edit.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,24 @@
+var  myDataSource, myDataTable, myContextMenu;
+var  myPaginator_0, myDataTable_0
+var  myPaginator_1, myDataTable_1;
+
+/********************************************************************************/
+var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+{
+       elCell.innerHTML = "<center>"+oData+"</center>";
+}
+
+/********************************************************************************/
+
+YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone",
+                               type: "js",
+                           fullpath: property_js
+                           });
+
+                       loader.require("anyone");
+                   loader.insert();
+               });
\ No newline at end of file

Added: people/sigurdne/modules/property/trunk/js/yahoo/entity.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/entity.index.js             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/entity.index.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,93 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+       {order:0, var_URL:'cat_id',             name:'btn_cat_id',              
style:'categorybutton', dependiente:''},
+       {order:1, var_URL:'district_id',name:'btn_district_id', 
style:'districtbutton', dependiente:''},
+       {order:2, var_URL:'status',             name:'btn_status_id',   
style:'statusbutton',   dependiente:''},
+       {order:3, var_URL:'filter',             name:'btn_user_id',             
style:'userIdbutton',   dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_export',funct:"onDownloadClick"}
+       ]
+
+    var toolTips = [
+    {name:'btn_export', title:'download', description:'Download table to your 
browser',ColumnDescription:''}
+    ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values = {
+       date_search : 1 //if search has link "Data search"
+       }
+
+       var linktoolTips =[
+       {name:'btn_columns', title:'columns', description:'Choose columns'},
+       {name:'btn_data_search', title:'Data search', description:'Narrow the 
search by dates'}
+       ]
+
+
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //eliminate "no category" option because is necesary 
have a category in the  PHP query
+       //              delete oMenuButton_0.getMenu().itemData[0];
+                       //correcting it. now look for value 
+       //              index = 
locate_in_array_options(0,"value",path_values.cat_id);
+                       //only change LABEL, because value (cat_id) is include 
un URL (PHP use redirect)
+       //              oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+       //              oMenuButton_0.focus();
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+       YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/event.schedule.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/event.schedule.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/event.schedule.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,138 @@
+var  myPaginator_0, myDataTable_0;
+var Button_0_0, Button_0_1;
+var tableYUI;
+
+/********************************************************************************/
+       this.cleanValuesHiddenActionsButtons=function()
+       {
+               YAHOO.util.Dom.get('hd_values[enable_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_values[disable_alarm]').value = '';
+       }
+/********************************************************************************/
     
+
+       this.onActionsClick=function()
+       {
+               flag = false;
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+
+               //validate ckecks true
+               array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }
+
+               if(flag)
+               {
+                       //asign value to hidden
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[0]);//First form
+                       execute_async(myDataTable_0);
+               }
+       }
+/********************************************************************************/
+       var myFormatterCheck = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks\"  value=\"\" 
name=\"values[alarm]["+oRecord.getData('alarm_id')+"]\"/></center>";
+       }
+/********************************************************************************/
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+//*************************
+//var  myPaginator_1,myDataTable_1;
+//var Button_2_0;
+
+
+
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+               if(num==0)
+               {
+                       //tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[1].parentNode;
+                       tableObject = 
document.body.getElementsByTagName('table');
+                       for (x=0; x<tableObject.length; x++)
+                       {
+                               if (tableObject[x].parentNode.id == 
'datatable-container_0')
+                               {
+                                       tableYUI = tableObject[x];
+                               }
+                       }
+                       tableYUI.setAttribute("id","tableYUI");
+                       tableYUI.deleteTFoot();
+                       addFooterDatatable();
+               }
+       }
+
+/********************************************************************************
+*
+*/
+       this.addFooterDatatable = function()
+       {
+               //Create ROW
+               newTR = document.createElement('tr');
+               //RowChecked
+               td_empty(td_count);
+               CreateRowChecked("mychecks");
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR.cloneNode(true));
+       }
+
+/********************************************************************************
+*
+*/
+       check_all = function(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                               //for class=transfer_idClass, they have to be 
interchanged
+                               if(myclass=="mychecks")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+
+/********************************************************************************/
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       var loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/gab.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/gab.index.js                
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/gab.index.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,160 @@
+//--------------------------------------------------------
+// Declaration of gab.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var selectsButtons = '';
+
+       // define checkbox
+       var oCheckButton_0;
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2, oNormalButton_3;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_export', funct:"onDownloadClick"},
+       {order:3, name:'btn_reset', funct:"onResetClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'address',       id:'txt_address'},
+       {order:1, name:'location_code', id:'txt_location_code'},
+       {order:2, name:'gaards_nr',     id:'txt_gaards_nr'},
+       {order:3, name:'bruksnr',       id:'txt_bruksnr'},
+       {order:4, name:'feste_nr',      id:'txt_feste_nr'},
+       {order:5, name:'seksjons_nr',   id:'txt_seksjons_nr'},
+       {order:6, name:'check_payments',        id:'txt_check_payments'}
+       ]
+
+       var toolTips =
+       [
+               {name:'map',title:'Map', description:'View 
map',ColumnDescription:''},
+               {name:'gab',title:'Gab', description:'View 
gab-info',ColumnDescription:''},
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values = {
+        date_search : 0 //if search has link "Data search"
+       };
+
+       var fields_add = new Array();
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //nothing
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       if (oCheckButton_0.get("checked"))
+                       {
+                               if (fields_add == '' || fields_add == null)
+                               {
+                                       for(var x=0; 
x<values_ds.headers.length; x++)
+                                       {
+                                               
myDataTable.insertColumn({key:values_ds.headers[x], 
label:values_ds.headers[x].replace(/\_/g,"/")});
+                                               fields_add[x] = 
values_ds.headers[x];
+                                       }
+                                       var oColumn = 
myDataTable.getColumn('hits');
+                                       // Show Column
+                                       myDataTable.showColumn(oColumn);
+                               }
+                       }
+                       else if (YAHOO.lang.isArray(fields_add))
+                       {
+                               for(var x=0; x<fields_add.length; x++)
+                               {
+                                        var oColumn = 
myDataTable.getColumn(fields_add[x]);
+                                        myDataTable.removeColumn(oColumn);
+                               }
+                               var oColumn = myDataTable.getColumn('hits');
+                               // Hide Column
+                               myDataTable.hideColumn(oColumn);
+                               fields_add = new Array();
+                       }
+                       myDataTable.render();
+               }
+
+               //--focus for txt_query---
+               YAHOO.util.Dom.get(textImput[0].id).value = path_values.address;
+               YAHOO.util.Dom.get(textImput[0].id).focus();
+       }
+/****************************************************************************************/
+         this.onPaymentsClick = function()
+          {
+                       if (oCheckButton_0.get("checked")) {
+                               YAHOO.util.Dom.get("txt_check_payments").value 
= 1;
+                       } else {
+                               YAHOO.util.Dom.get("txt_check_payments").value 
= 0;
+                       }
+          }
+/****************************************************************************************/
+         this.onResetClick = function()
+          {
+                       oCheckButton_0.set("checked", false);
+                       YAHOO.util.Dom.get("txt_check_payments").value = 0;
+          }
+/****************************************************************************************/
+         this.myParticularRenderEvent = function()
+         {
+
+                       for(var i=0; i < myColumnDefs.length;i++)
+                       {
+                               if( myColumnDefs[i].sortable )
+                               {
+                                       YAHOO.util.Dom.getElementsByClassName( 
'yui-dt-resizerliner' , 'div' )[i].style.background  = '#D8D8DA 
url(phpgwapi/js/yahoo/assets/skins/sam/sprite.png) repeat-x scroll 0 -100px';
+                               }
+
+                               if( !myColumnDefs[i].visible && 
myColumnDefs[i].key != "hits")
+                               {
+                                       var sKey = myColumnDefs[i].key;
+                                       myDataTable.hideColumn(sKey);
+                               }
+                               //title columns alwyas center
+                               YAHOO.util.Dom.getElementsByClassName( 
'yui-dt-resizerliner', 'div' )[0].style.textAlign = 'center';
+                       }
+
+                   var fields = new Array();
+                       for(var x= 0; x<values_ds.headers_all.length; x++)
+                       {
+                               fields[x] = values_ds.headers_all[x];
+                   }
+
+                   myDataSource.responseSchema =
+                   {
+                               resultsList: "records",
+                               fields: fields,
+                               metaFields : {
+                                         totalRecords: 'totalRecords' // The 
totalRecords meta field is a "magic" meta, and will be passed to the Paginator.
+                                                }
+                   };
+
+         }
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+                       {
+                               //avoid render buttons html
+                               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+                               var loader = new YAHOO.util.YUILoader();
+                               loader.addModule({
+                                       name: "anyone", //module name; must be 
unique
+                                       type: "js", //can be "js" or "css"
+                                   fullpath: property_js //'property_js' have 
the path for property.js, is render in HTML
+                                   });
+
+                               loader.require("anyone");
+
+                               //Insert JSON utility on the page
+
+                           loader.insert();
+
+                               oCheckButton_0 = new 
YAHOO.widget.Button('txt_check', {label:"", value:"0",checked:false});
+                               oCheckButton_0.on("click", 
eval('onPaymentsClick'));
+                       });
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/gab.list_detail.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/gab.list_detail.js          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/gab.list_detail.js  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,125 @@
+//--------------------------------------------------------
+// Declaration of gab.list_detail vars
+//--------------------------------------------------------
+       //define SelectButton
+       var selectsButtons = '';
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+               {order:0, name:'btn_new', funct:"onNewClick"},
+               {order:1, name:'btn_done',      funct:"onNewDoneClick"}
+       ]
+
+       // define Text buttons
+       var textImput = []
+
+       var config_values = {
+               date_search : 0 //if search has link "Data search"
+       };
+
+       
+/****************************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       var div_toolbar = 
YAHOO.util.Dom.getElementsByClassName("toolbar","div")[0];
+                       div_toolbar.setAttribute("style", "height:90px;");
+                       create_table_info();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+               oNormalButton_0.focus();
+       }
+       
+       
+       this.create_table_info = function()
+       {
+
+               div_message= 
YAHOO.util.Dom.getElementsByClassName("field","div")[0];
+
+               if ( div_message.hasChildNodes() )
+               {
+                       while ( div_message.childNodes.length >= 1 )
+                   {
+                       div_message.removeChild( div_message.firstChild );
+                   }
+               }
+
+               newTable = document.createElement('table');
+               mewBody = document.createElement('tbody');
+
+               for (i=0; i<values_ds.info.length; i++)
+               {
+                       newTR = document.createElement('tr');
+                       newTD = document.createElement('td');
+                       
newTD.appendChild(document.createTextNode(values_ds.info[i].name));
+                       newTR.appendChild(newTD);
+                       
+                       newTD = document.createElement('td');
+                       
newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+                       newTR.appendChild(newTD);
+                       
+                       newTD = document.createElement('td');
+                       
newTD.appendChild(document.createTextNode(values_ds.info[i].value));
+                       newTR.appendChild(newTD);
+                       mewBody.appendChild(newTR);
+               }
+                               
+               newTable.appendChild(mewBody);
+               
+               div_message.appendChild(newTable);
+       }
+
+
+       this.myParticularRenderEvent = function()
+       {
+               YAHOO.util.Dom.get("paging").innerHTML = '';
+       }
+         
+         
+       this.onNewDoneClick = function()
+       {
+               var path_values_action_original = path_values.menuaction;
+
+               tmp_array = path_values.menuaction.split(".")
+               tmp_array[2] = "index"; //set function INDEX
+               path_values.menuaction = tmp_array.join('.');
+               
+               var path_update = new Array();
+               path_update["menuaction"] = path_values.menuaction;
+               
+               window.open(phpGWLink('index.php',path_update),'_self');
+               //come back to initial values
+               path_values.menuaction = path_values_action_original;
+
+       }
+               
+/****************************************************************************************/
+         
+       YAHOO.util.Event.addListener(window, "load", function()
+                       {
+                               //avoid render buttons html
+                               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+                               var loader = new YAHOO.util.YUILoader();
+                               loader.addModule({
+                                       name: "anyone", //module name; must be 
unique
+                                       type: "js", //can be "js" or "css"
+                                   fullpath: property_js //'property_js' have 
the path for property.js, is render in HTML
+                                   });
+
+                               loader.require("anyone");
+
+                               //Insert JSON utility on the page
+
+                           loader.insert();
+
+                       });
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/investment.history.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/investment.history.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/investment.history.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,214 @@
+//--------------------------------------------------------
+// Declaration of investment.history vars
+//--------------------------------------------------------
+       //define SelectButton
+       var selectsButtons = '';
+
+       // define buttons
+       var oNormalButton_0,oNormalButton_1;
+       var normalButtons = [
+               {order:0, name:'btn_done',      funct:"onNewDoneClick"},
+               {order:1, name:'btn_update',funct:"onUpdateClick"}
+       ]
+
+       // define Link Buttons
+       var linktoolTips =
+        [
+         {name:'lnk_index', title:'Voucher', description:'Enter a new index'}
+        ]
+        
+       // define Text buttons
+       var textImput = []
+
+       var config_values = {
+               date_search : 0 //if search has link "Data search"
+       };
+
+/****************************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       var div_toolbar = 
YAHOO.util.Dom.getElementsByClassName("toolbar","div")[0];
+                       div_toolbar.setAttribute("style", "height:60px;");
+                       create_table_info();
+
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+
+               oNormalButton_0.focus();
+       }
+
+/****************************************************************************************/
+
+       this.create_message = function()
+       {
+               var div_message = YAHOO.util.Dom.get("message");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                        for(i=0; i<values_ds.message.length; i++)
+                        {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[i].msgbox_text);
+                                       oDiv.appendChild(txtNode);
+                                       
+                                       
if(window.values_ds.message[i].lang_msgbox_statustext=="Error")
+                                       {
+                                               oDiv.style.color = '#FF0000'; 
+                                       }
+                                       else
+                                       {
+                                               oDiv.style.color = '#009900'; 
+                                       }
+                                       oDiv.style.fontWeight = 'bold';
+                                       div_message.appendChild(oDiv);
+                        }
+                }
+                values_ds.message = null;
+       }
+/****************************************************************************************/
+
+       this.create_table_info = function()
+       {
+
+               var div_info = 
YAHOO.util.Dom.getElementsByClassName("field","div")[0];
+
+               if ( div_info.hasChildNodes() )
+               {
+                       while ( div_info.childNodes.length >= 1 )
+                   {
+                               div_info.removeChild( div_info.firstChild );
+                   }
+               }
+
+               newTable = document.createElement('table');
+               mewBody = document.createElement('tbody');
+
+               for (i=0; i<values_ds.info.length; i++)
+               {
+                       newTR = document.createElement('tr');
+                       newTD = document.createElement('td');
+                       
newTD.appendChild(document.createTextNode(values_ds.info[i].name));
+                       newTR.appendChild(newTD);
+                       
+                       newTD = document.createElement('td');
+                       
newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+                       newTR.appendChild(newTD);
+                       
+                       newTD = document.createElement('td');
+                       
newTD.appendChild(document.createTextNode(values_ds.info[i].value));
+                       newTR.appendChild(newTD);
+                       mewBody.appendChild(newTR);
+               }
+                               
+               newTable.appendChild(mewBody);
+               
+               div_info.appendChild(newTable);
+       }
+/********************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               YAHOO.util.Dom.get("paging").innerHTML = '';
+               //unnecessary delete_content_div("message",2) here. wiht 
delete_content_div in property is sufficient.
+               create_message();
+
+               //clean values for down-toolbar_button class (buttons in  
down-toolbar menu)
+               down_toolbar_button = 
YAHOO.util.Dom.getElementsByClassName('down-toolbar_button');
+               for(i=0;i<down_toolbar_button.length;i++)
+               {
+                       down_toolbar_button[i].value = "";
+               }
+               
+       }
+/********************************************************************************/
       
+         
+       this.onNewDoneClick = function()
+       {
+               var path_values_action_original = path_values.menuaction;
+
+               tmp_array = path_values.menuaction.split(".")
+               tmp_array[2] = "index"; //set function INDEX
+               path_values.menuaction = tmp_array.join('.');
+               
+               var path_update = new Array();
+               path_update["menuaction"] = path_values.menuaction;
+               
+               window.open(phpGWLink('index.php',path_update),'_self');
+               //come back to initial values
+               path_values.menuaction = path_values_action_original;
+
+       }
+/********************************************************************************/
+       
+       this.onUpdateClick = function()
+               {
+       
+               //get the last div in th form
+               var divs = YAHOO.util.Dom.getElementsByClassName('field');
+               var mydiv = divs[1];
+               //remove all child of mydiv
+               if ( mydiv.hasChildNodes() )
+               {
+                       while ( mydiv.childNodes.length >= 1 )
+                   {
+                       mydiv.removeChild( mydiv.firstChild );
+                   }
+               }
+
+               // styles for dont show
+               mydiv.style.display = 'none';
+               
+               //get all controls of datatable
+               valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+               var myclone = null;
+               //add all control to form.
+               for(i=0;i<valuesForPHP.length;i++)
+               {
+                       if(valuesForPHP[i].value != "")
+                       {
+                               //Important true for Select Controls
+                               myclone = valuesForPHP[i].cloneNode(true);
+                               mydiv.appendChild(myclone);
+                       }
+               } 
+
+               // find out the first form
+               formObject = document.getElementsByTagName('form');
+               // modify the 'form' for send it as POST using asyncronize call
+               YAHOO.util.Connect.setForm(formObject[0]);
+               
+               execute_ds();
+               
+               }
+       
+/****************************************************************************************/
+         
+       YAHOO.util.Event.addListener(window, "load", function()
+                       {
+                               //avoid render buttons html
+                               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+                               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[1].style.display = 
'none';
+                               var loader = new YAHOO.util.YUILoader();
+                               loader.addModule({
+                                       name: "anyone", //module name; must be 
unique
+                                       type: "js", //can be "js" or "css"
+                                   fullpath: property_js //'property_js' have 
the path for property.js, is render in HTML
+                                   });
+
+                               loader.require("anyone");
+
+                               //Insert JSON utility on the page
+
+                           loader.insert();
+
+                       });
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/investment.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/investment.index.js         
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/investment.index.js 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,272 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1,oMenuButton_2;
+       var selectsButtons = [
+       {order:0, var_URL:'cat_id',                     name:'btn_cat_id',      
                style:'',dependiente:''},
+       {order:1, var_URL:'part_of_town_id',name:'btn_part_of_town_id', 
style:'',dependiente:''},
+       {order:2, var_URL:'filter',                     name:'btn_filter',      
                style:'',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0,oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_new',       funct:"onNewClick"},
+       {order:1, name:'btn_update',funct:"onUpdateClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       ]
+
+       var toolTips = [
+       ]
+       
+       // define Link Buttons
+       var linktoolTips =
+        [
+         {name:'lnk_index', title:'Voucher', description:'Enter a new index'}
+        ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+
+       var tableYUI;
+       
+/********************************************************************************/
+       this.onUpdateClick = function()
+               {
+       
+               //get the last div in th form
+               var divs= YAHOO.util.Dom.getElementsByClassName('field');
+               var mydiv = divs[0];
+               //remove all child of mydiv
+               if ( mydiv.hasChildNodes() )
+               {
+                       while ( mydiv.childNodes.length >= 1 )
+                   {
+                       mydiv.removeChild( mydiv.firstChild );
+                   }
+               }
+
+               // styles for dont show
+               mydiv.style.display = 'none';
+
+               //asign values for check buttons 'close_order'
+               checks_close_order = 
YAHOO.util.Dom.getElementsByClassName('select_check');
+               hiddens_close_order = 
YAHOO.util.Dom.getElementsByClassName('select_hidden');
+               for(i=0;i<checks_close_order.length;i++)
+               {
+                       if(checks_close_order[i].checked)
+                       {
+                               hiddens_close_order[i].value = 
checks_close_order[i].value;
+                       }
+               }
+               
+               //get all controls of datatable
+               valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+               var myclone = null;
+               //add all control to form.
+               for(i=0;i<valuesForPHP.length;i++)
+               {
+                       //avoid error in $values[update][x]
+                       if(valuesForPHP[i].value != "")
+                       {
+                               //Important true for Select Controls
+                               myclone = valuesForPHP[i].cloneNode(true);
+                               mydiv.appendChild(myclone);
+                       }
+               }
+
+               // find out the first form
+               formObject = document.getElementsByTagName('form');
+               // modify the 'form' for send it as POST using asyncronize call
+               YAHOO.util.Connect.setForm(formObject[0]);
+               
+               maintain_pagination_order();
+               
+                execute_ds();
+               }
+       
+       
/********************************************************************************/
+       this.myFormatNum2 = function(Data)
+       {
+               return  YAHOO.util.Number.format(Data, {decimalPlaces:0, 
decimalSeparator:"", thousandsSeparator:" "});
+       }                               
+       
/********************************************************************************/
+       var myFormatCount2 = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = myFormatNum2(oData);
+       }       
+       
/********************************************************************************
+       *
+       */
+       this.myParticularRenderEvent = function()
+       {
+               //unnecessary delete_content_div("message",2) here. wiht 
delete_content_div in property is sufficient.
+               create_message();
+               tableYUI.deleteTFoot();
+               addFooterDatatable();
+
+               //clean values for down-toolbar_button class (buttons in  
down-toolbar menu)
+               down_toolbar_button = 
YAHOO.util.Dom.getElementsByClassName('down-toolbar_button');
+               for(i=0;i<down_toolbar_button.length;i++)
+               {
+                       down_toolbar_button[i].value = "";
+               }
+
+       }
+       
/********************************************************************************
+       * Delete all message un DIV 'message'
+       */
+       this.create_message = function()
+       {
+               div_message= YAHOO.util.Dom.get("message");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                        for(i=0; i<values_ds.message.length; i++)
+                        {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[i].msgbox_text);
+                                       oDiv.appendChild(txtNode);
+                                       
+                                       
if(window.values_ds.message[i].lang_msgbox_statustext=="Error")
+                                       {
+                                               oDiv.style.color = '#FF0000'; 
+                                       }
+                                       else
+                                       {
+                                               oDiv.style.color = '#009900'; 
+                                       }
+                                       oDiv.style.fontWeight = 'bold';
+                                       div_message.appendChild(oDiv);
+                        }
+                }
+                values_ds.message = null;
+       }
+
+       
/********************************************************************************
+       * reset empty values for update PERIOD
+       * Delete children od div MESSAGE
+       * Show Message
+       */
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //locate (asign ID) to datatable
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+                       //focus initial
+                       oMenuButton_0.focus();
+                       //setting in part of town button
+                       index = locate_in_array_options(1,"value","0");
+                       oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       oMenuButton_1.set("value", array_options[1][index][0]);
+                       path_values.part_of_town_id = 
array_options[1][index][0];
+                       
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //setting
+                       if(path_values.part_of_town_id=="")
+                       {
+                               oMenuButton_1.set("label", ("<em>" + 
array_options[1][32][1] + "</em>"));
+                               oMenuButton_1.set("value", 
array_options[1][32][0]);
+                               path_values.part_of_town_id = 
array_options[1][32][0]
+                       }
+
+               }
+       }
+
+       
/********************************************************************************
+        *
+        */
+
+       this.addFooterDatatable = function()
+       {
+               //Create ROW
+               newTR = document.createElement('tr');
+               td_empty(8);
+               tmp_sum = getSumPerPage('initial_value_ex',0);
+               td_sum(tmp_sum);
+               td_empty(1);
+               tmp_sum = getSumPerPage('value_ex',0);
+               td_sum(tmp_sum);
+               td_empty(2);
+               tmp_sum = getSumPerPage('this_write_off_ex',0);
+               td_sum(tmp_sum);
+               td_empty(3);
+               //RowChecked
+               CreateRowChecked("select_check");
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+
+       }
+
+       
/********************************************************************************
+        *
+        */
+       check_all = function(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                               //for class=select_check, they have to be 
interchanged
+                               if(myclass=="select_check")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+//----------------------------------------------------------
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
"none";
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[1].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/invoice.consume.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/invoice.consume.js          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/invoice.consume.js  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,159 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var oMenuButton_0, oMenuButton_1, oMenuButton_2;
+               var selectsButtons = [
+               {order:0, var_URL:'cat_id',                     
name:'btn_cat_id',                      style:'',dependiente:''},
+               {order:1, var_URL:'district_id',        name:'btn_district_id', 
        style:'',dependiente:''},
+               {order:2, var_URL:'b_account_class',name:'btn_b_account_class', 
style:'',dependiente:''}
+               ]
+
+               // define buttons
+               var oNormalButton_0;
+               var normalButtons = [
+                       {order:0, name:'btn_search', funct:"onSearchClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+                 {name:'lnk_workorder', title:'Workorder ID', 
description:'enter the Workorder ID to search by workorder - at any Date'},
+                 {name:'lnk_vendor', title:'Vendor', description:'Select the 
vendor by clicking this link'},
+                 {name:'lnk_property', title:'Facilities Managements', 
description:'Select the property by clicking this link'}
+                ]
+
+
+               var textImput = [
+                       {order:0, name:'workorder_id',  id:'txt_workorder'},
+                       {order:1, name:'vendor_id',             
id:'txt_vendor'},
+                       {order:1, name:'loc1',                  id:'txt_loc1'}
+               ]
+
+               var toolTips = [
+               ]
+
+               // define the hidden column in datatable
+               var config_values = {
+                       date_search : 1, //if search has link "Data search"
+                       PanelLoading : 1
+               }
+
+               var tableYUI;
+
+       
/********************************************************************************/
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                               //category
+                               index = 
locate_in_array_options(0,"value",path_values.cat_id);
+                               if(index)
+                               {
+                                       oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+                               }
+                               //district
+                               index = 
locate_in_array_options(1,"value",path_values.district_id);
+                               if(index)
+                               {
+                                       oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                               }
+                               //account_class
+                               index = 
locate_in_array_options(2,"value",path_values.b_account_class);
+                               if(index)
+                               {
+                                       oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
+                               }
+
+                               //locate (asign ID) to datatable
+                               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                               tableYUI.setAttribute("id","tableYUI");
+
+                               
YAHOO.util.Dom.get("start_date-trigger").focus();
+               // really needed?
+                               onSearchClick();
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                               //nothing
+                       }
+               }
+       
/********************************************************************************/
+               this.myParticularRenderEvent = function()
+               {
+                       //not SHOW paginator
+                       YAHOO.util.Dom.get("paging").innerHTML = '';
+
+                       //unnecessary delete_content_div("message",2) here. 
wiht delete_content_div in property is sufficient.
+                       create_message();
+                       tableYUI.deleteTFoot();
+                       addFooterDatatable();
+               }
+
+       
/********************************************************************************
+       * Delete all message un DIV 'message'
+       */
+       this.create_message = function()
+       {
+
+               div_message= YAHOO.util.Dom.get("message");
+               newTable = document.createElement('table');
+               //fix IE error
+               newTbody = document.createElement("TBODY");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.current_consult)
+                {
+                       for(i=0; i<values_ds.current_consult.length; i++)
+                       {
+                               newTR = document.createElement('tr');
+                               for(j=0; j<2; j++)
+                               {
+                                       newTD = document.createElement('td');
+                                       
newTD.appendChild(document.createTextNode(values_ds.current_consult[i][j]));
+                                       newTR.appendChild(newTD);
+                                       //add : after title
+                                       if(j==0)
+                                       {
+                                               newTD = 
document.createElement('td');
+                                               
newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+                                               newTR.appendChild(newTD);
+                                       }
+                               }
+                               newTbody.appendChild(newTR);
+                        }
+                }
+                newTable.appendChild(newTbody);
+                div_message.appendChild(newTable);
+       }
+       
/********************************************************************************/
+               this.addFooterDatatable = function()
+               {
+                       //Create ROW
+                       newTR = document.createElement('tr');
+                       td_empty(3);
+                       td_sum(values_ds.sum);
+                       //Add to Table
+                       myfoot = tableYUI.createTFoot();
+                       myfoot.setAttribute("id","myfoot");
+                       myfoot.appendChild(newTR);
+               }
+       
/********************************************************************************/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+
+                   loader.insert();
+               });

Added: people/sigurdne/modules/property/trunk/js/yahoo/invoice.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/invoice.index.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/invoice.index.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,352 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [
+       {order:0, var_URL:'cat_id',      name:'btn_cat_id',      
style:'',dependiente:''},
+       {order:1, 
var_URL:'user_lid',name:'btn_user_lid',style:'',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2, oNormalButton_3;
+       var normalButtons = [
+       {order:0, name:'btn_search',funct:"onSearchClick"},
+       {order:1, name:'btn_new',       funct:"onNewClick"},
+       {order:2, name:'btn_save',      funct:"onSave"},
+       {order:3, name:'btn_export',funct:"onDownloadClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query', id:'txt_query'}
+       ]
+
+       var toolTips = [
+               {name:'voucher_id_lnk',title:'Voucher ID', description:'click 
this link to enter the list of sub-invoices',ColumnDescription:''},
+               {name:'vendor_id_lnk', title:'', 
description:'',ColumnDescription: 'vendor_name'},
+               {name:'voucher_date_lnk', title:'Payment Date', 
description:'',ColumnDescription:'payment_date'},
+               //{name:'period', title:'Period', description:'click this 
button to edit the period',ColumnDescription:''},
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+
+       var tableYUI;
+       
/********************************************************************************
+       *
+       */
+       this.myParticularRenderEvent = function()
+       {
+               delete_content_div("message",2); //find it in property.js
+               create_message();
+               tableYUI.deleteTFoot();
+               addFooterDatatable();
+       }
+       
/********************************************************************************
+       * Delete all message un DIV 'message'
+       */
+       this.create_message = function()
+       {
+               div_message= YAHOO.util.Dom.get("message");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                       // succesfull
+                       if(window.values_ds.message[0].message)
+                       {
+                               for(i=0; i<values_ds.message[0].message.length; 
i++)
+                               {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].message[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#009900';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+
+                       // error
+                       if(window.values_ds.message[0].error)
+                       {
+                               for(i=0; i<values_ds.message[0].error.length; 
i++)
+                               {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].error[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#FF0000';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+                }
+                window.values_ds.message = null;
+       }
+
+       
/********************************************************************************
+       * reset empty values for update PERIOD
+       * Delete children od div MESSAGE
+       * Show Message
+       */
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //locate (asign ID) to datatable
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+                       //focus initial
+                       index = 
locate_in_array_options(1,"value",path_values.user_lid);
+                       oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //reset empty values for update PERIOD
+                       path_values.voucher_id_for_period = '';
+                       path_values.period = '';
+                       path_values.currentPage = '';
+                       path_values.start = '';
+                       path_values.allrows = 0;
+               }
+       }
+       
/********************************************************************************
+       * Format for column SUM
+       */
+    var myFormatDate = function(elCell, oRecord, oColumn, oData)
+       {
+       elCell.innerHTML = YAHOO.util.Number.format(oData, {decimalPlaces:2, 
decimalSeparator:",", thousandsSeparator:" "});
+    }
+
+       
/********************************************************************************
+       * Format column PERIOD
+       */
+    var myPeriodDropDown = function(elCell, oRecord, oColumn, oData)
+       {
+               tmp_count = oRecord._oData.counter_num;
+               voucher_id = oRecord._oData.voucher_id_num
+           elCell.innerHTML = "<div 
id=\"divPeriodDropDown"+tmp_count+"\"></div>";
+
+               var tmp_button = new YAHOO.widget.Button({
+                          type:"menu",
+                          id:"oPeriodDropDown"+tmp_count,
+                          label: "<en>" +oData+"</en>",
+                          value: oData,
+                          container: "divPeriodDropDown"+tmp_count,
+                          menu: [      { text: "1", value: 1, onclick: { fn: 
onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "2", value: 
2, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "3", value: 
3, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "4", value: 
4, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "5", value: 
5, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "6", value: 
6, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "7", value: 
7, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "8", value: 
8, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "9", value: 
9, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "10", 
value: 10, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "11", 
value: 11, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} },
+                                                           { text: "12", 
value: 12, onclick: { fn: onPeriodDropDownItemClick, idvoucher: voucher_id} } 
]});
+           //Define this variable in the window scope (GLOBAL)
+           eval("window.oPeriodDropDown"+tmp_count+" = tmp_button");
+
+    }
+
+       
/********************************************************************************
+        * CLick option combobox PERIOD
+        */
+    this.onPeriodDropDownItemClick = function(p_sType, p_aArgs, p_oItem)
+       {
+                //Use a diferente id for voucher. This variables wil be empty 
in PARTICULAR_SETTING
+                path_values.voucher_id_for_period = 
p_oItem.cfg.getProperty("onclick").idvoucher;
+                //'text' is the option selected
+                path_values.period = p_oItem.cfg.getProperty('text');
+                
+                maintain_pagination_order();
+                //call INDEX. Update PERIOD Method is inside of INDEX
+                execute_ds();
+
+       }
+
+       
/********************************************************************************
+        *
+        */
+       this.onSave = function()
+       {
+               //get the last div in th form
+               var divs= YAHOO.util.Dom.getElementsByClassName('field');
+               var mydiv = divs[divs.length-1];
+               //remove all child of mydiv
+               if (mydiv.hasChildNodes())
+               {
+                       while ( mydiv.childNodes.length >= 1 )
+                   {
+                       mydiv.removeChild( mydiv.firstChild );
+                   }
+               }
+               // styles for dont show
+               mydiv.style.display = "none";
+               
+               //Asign values for None/Janitor/Supervisor/Budgat
+               values_orig = 
YAHOO.util.Dom.getElementsByClassName('sign_origClass');
+               values_tophp = 
YAHOO.util.Dom.getElementsByClassName('sign_tophp');
+               
+               for(j=0;j<4;j++)
+               {
+                       if(j==0)
+                       {
+                               values_news = 
YAHOO.util.Dom.getElementsByClassName('signClass');
+                       }
+                       else if(j==1)
+                       {
+                               values_news = 
YAHOO.util.Dom.getElementsByClassName('janitorClass');
+                       }
+                       else if(j==2)
+                       {
+                               values_news = 
YAHOO.util.Dom.getElementsByClassName('supervisorClass');
+                       }                       
+                       else if(j==3)
+                       {
+                               values_news = 
YAHOO.util.Dom.getElementsByClassName('budget_responsibleClass');
+                       }
+                       
+                       for(i=0;i<values_news.length;i++)
+                       {
+                               if( (values_news[i].name != "") && 
(values_news[i].value != values_orig[i].value) && (values_news[i].checked) )
+                               {
+                                       values_tophp[i].value = 
values_news[i].value;
+                               }
+                       }
+               }
+               
+               //Asign values for Kreditnota
+               values_news = 
YAHOO.util.Dom.getElementsByClassName('kreditnota_tmp');
+               values_tophp = 
YAHOO.util.Dom.getElementsByClassName('kreditnota_tophp');
+
+               for(i=0;i<values_news.length;i++)
+               {
+                       if(values_news[i].checked)
+                       {
+                               values_tophp[i].value = true;
+                       }
+               }
+       
+               //Asign values for Transfer
+               values_news = 
YAHOO.util.Dom.getElementsByClassName('transfer_idClass');
+               values_tophp = 
YAHOO.util.Dom.getElementsByClassName('transfer_tophp');
+
+               for(i=0;i<values_news.length;i++)
+               {
+                       if(values_news[i].checked)
+                       {
+                               values_tophp[i].value = true;
+                       }
+               }               
+
+               //get all controls of datatable
+               valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+               var myclone = null;
+               //add all control to form
+               for(i=0;i<valuesForPHP.length;i++)
+               {
+                       myclone = valuesForPHP[i].cloneNode(true);
+                       mydiv.appendChild(myclone);
+               }
+               // find out the unique form
+               formObject = document.body.getElementsByTagName('form');
+               // modify the 'form' for send it as POST using asyncronize call
+               YAHOO.util.Connect.setForm(formObject[0]);
+
+                maintain_pagination_order();
+                execute_ds();
+       }
+
+       
/********************************************************************************
+        *
+        */
+       this.addFooterDatatable = function()
+       {
+               //call getSumPerPage(name of column) in property.js
+               tmp_sum = getSumPerPage('amount_lnk',2);
+
+               //Create ROW
+               newTR = document.createElement('tr');
+               td_empty(15);
+               td_sum(tmp_sum);
+               td_empty(6);
+               //RowChecked
+               CreateRowChecked("signClass");
+               CreateRowChecked("janitorClass");
+               CreateRowChecked("supervisorClass");
+               CreateRowChecked("budget_responsibleClass");
+               CreateRowChecked("transfer_idClass");
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR.cloneNode(true));
+               //clean value for values_ds.message
+               values_ds.message = null;
+       }
+       
/********************************************************************************
+        *
+        */
+       check_all = function(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                               //for class=transfer_idClass, they have to be 
interchanged
+                               if(myclass=="transfer_idClass")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+
+//----------------------------------------------------------
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
"none";
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/invoice.list_sub.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/invoice.list_sub.js         
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/invoice.list_sub.js 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,263 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var selectsButtons = [
+               ]
+
+               // define buttons
+               var oNormalButton_0,oNormalButton_1,oNormalButton_2;
+               var normalButtons = [
+                       {order:0, name:'btn_save',      funct:"onSave"},
+                       {order:1, name:'btn_done',      funct:"onDoneClick"},
+                       {order:2, name:'btn_export',funct:"onDownloadClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+        ]
+
+               var textImput = [
+               ]
+
+               var toolTips = [
+                       {name:'btn_export', title:'download', 
description:'Download table to your browser',ColumnDescription:''}
+               ]
+
+               var config_values = {
+                       PanelLoading : 1,
+                       particular_download : "property.uiinvoice.download_sub"
+               }
+
+               var tableYUI;
+
+       
/********************************************************************************/
+               this.onSave = function()
+               {
+                       //get the last div in th form
+                       var divs= 
YAHOO.util.Dom.getElementsByClassName('field');
+                       var mydiv = divs[divs.length-1];
+                       //remove all child of mydiv
+                       if ( mydiv.hasChildNodes() )
+                       {
+                               while ( mydiv.childNodes.length >= 1 )
+                           {
+                               mydiv.removeChild( mydiv.firstChild );
+                           }
+                       }
+
+                       // styles for dont show
+                       mydiv.style.display = 'none';
+
+                       //asign values for check buttons 'close_order'
+                       checks_close_order = 
YAHOO.util.Dom.getElementsByClassName('close_order_tmp');
+                       hiddens_close_order = 
YAHOO.util.Dom.getElementsByClassName('close_order');
+                       for(i=0;i<checks_close_order.length;i++)
+                       {
+                               if(checks_close_order[i].checked)
+                               {
+                                       hiddens_close_order[i].value = true;
+                               }
+                       }
+                       
+                       //asign values for select buttons 'tax_code'
+                       selects_tax_code = 
YAHOO.util.Dom.getElementsByClassName('tax_code_tmp');
+                       hiddens_tax_code = 
YAHOO.util.Dom.getElementsByClassName('tax_code');
+                       for(i=0;i<selects_tax_code.length;i++)
+                       {
+                               hiddens_tax_code[i].value = 
selects_tax_code[i].value
+                       }
+                       
+                       //asign values for select buttons 'dimb'
+                       selects_dimb = 
YAHOO.util.Dom.getElementsByClassName('dimb_tmp');
+                       hiddens_dimb = 
YAHOO.util.Dom.getElementsByClassName('dimb');
+                       for(i=0;i<selects_dimb.length;i++)
+                       {
+                               hiddens_dimb[i].value = selects_dimb[i].value
+                       }
+
+                       //get all controls of datatable
+                       valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+                       var myclone = null;
+                       //add all control to form.
+                       for(i=0;i<valuesForPHP.length;i++)
+                       {
+                               //Important true for Select Controls
+                               myclone = valuesForPHP[i].cloneNode(true);
+                               mydiv.appendChild(myclone);
+                       }
+
+                       // find out the unique form
+                       formObject = document.getElementsByTagName('form');
+                       // modify the 'form' for send it as POST using 
asyncronize call
+                       YAHOO.util.Connect.setForm(formObject[0]);
+
+                        execute_ds();
+               }
+
+       
/********************************************************************************/
+               check_all = function(myclass)
+               {
+                       controls = 
YAHOO.util.Dom.getElementsByClassName(myclass);
+                       for(i=0;i<controls.length;i++)
+                       {
+                               if(!controls[i].disabled)
+                               {
+                                       //for class=transfer_idClass, they have 
to be interchanged
+                                       if(myclass=="transfer_idClass")
+                                       {
+                                               if(controls[i].checked)
+                                               {
+                                                       controls[i].checked = 
false;
+                                               }
+                                               else
+                                               {
+                                                       controls[i].checked = 
true;
+                                               }
+                                       }
+                                       //for the rest, always id checked
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                       }
+               }
+
+       
/********************************************************************************/
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                               //locate (asign ID) to datatable
+                               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                               tableYUI.setAttribute("id","tableYUI");
+
+                               oNormalButton_0.focus();
+                               create_table_info_invoice_sub();
+                               delete_paginator();
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                               //nothing
+                       }
+               }
+       
/********************************************************************************/
+               this.myParticularRenderEvent = function()
+               {
+                       
+                       delete_paginator();
+                       //unnecessary delete_content_div("message",2) here. 
wiht delete_content_div in property is sufficient.
+                       create_message();
+                       tableYUI.deleteTFoot();
+                       addFooterDatatable();
+               }
+       
/********************************************************************************/
+               delete_paginator = function()
+               {
+                       //not SHOW paginator
+                       YAHOO.util.Dom.get("paging").innerHTML = '';
+               }
+
+       
/********************************************************************************
+       *
+       */
+       this.create_table_info_invoice_sub = function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.height = "40px";
+               div_message= 
YAHOO.util.Dom.getElementsByClassName('field','div')[0];
+               newTable = document.createElement('table');
+               //fix IE error
+               newTbody = document.createElement("TBODY");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.current_consult)
+                {
+                       for(i=0; i<values_ds.current_consult.length; i++)
+                       {
+                               newTR = document.createElement('tr');
+                               for(j=0; j<2; j++)
+                               {
+                                       newTD = document.createElement('td');
+                                       
newTD.appendChild(document.createTextNode(values_ds.current_consult[i][j]));
+                                       newTR.appendChild(newTD);
+                                       //add : after title
+                                       if(j==0)
+                                       {
+                                               newTD = 
document.createElement('td');
+                                               
newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+                                               newTR.appendChild(newTD);
+                                       }
+                               }
+                               newTbody.appendChild(newTR);
+                        }
+                }
+                newTable.appendChild(newTbody);
+                div_message.appendChild(newTable);
+       }
+
+       
/********************************************************************************
+       * Delete all message un DIV 'message'
+       */
+       this.create_message = function()
+       {
+               //div_message= YAHOO.util.Dom.get("message");
+               div_message= document.getElementById("message");
+               
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                       for(i=0; i<values_ds.message.length; i++)
+                       {
+                               oDiv=document.createElement("DIV");
+                               txtNode = 
document.createTextNode(values_ds.message[i].msgbox_text);
+                               oDiv.appendChild(txtNode);
+                               oDiv.style.fontWeight = 'bold';
+                               if(values_ds.message[i].lang_msgbox_statustext 
== "OK") //succesfull
+                               {
+                                       oDiv.style.color = '#009900';
+                               }
+                               else //error
+                               {
+                                       oDiv.style.color = '#FF0000';
+                               }
+                               div_message.appendChild(oDiv);
+                       }
+                }
+       }
+
+       
/********************************************************************************/
+               this.addFooterDatatable = function()
+               {
+                       //Create ROW
+                       newTR = document.createElement('tr');
+                       td_empty(2);
+                       CreateRowChecked("transfer_idClass");
+                       td_empty(4);
+                       td_sum(values_ds.sum);
+                       td_empty(5);
+                       //Add to Table
+                       myfoot = tableYUI.createTFoot();
+                       myfoot.setAttribute("id","myfoot");
+                       myfoot.appendChild(newTR);
+               }
+       
/********************************************************************************/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
"none";
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+
+                   loader.insert();
+               });

Added: people/sigurdne/modules/property/trunk/js/yahoo/invoice.paid.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/invoice.paid.index.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/invoice.paid.index.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,107 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+               var selectsButtons = [
+               {order:0, var_URL:'cat_id',                     
name:'btn_cat_id',                      style:'',dependiente:''},
+               {order:1, var_URL:'user_lid',           name:'btn_user_lid',    
        style:'',dependiente:''},
+               {order:2, var_URL:'b_account_class',name:'btn_b_account_class', 
style:'',dependiente:''}
+               ]
+
+               // define buttons
+               var oNormalButton_0, oNormalButton_1;
+               var normalButtons = [
+                       {order:0, name:'btn_search', funct:"onSearchClick"},
+                       {order:1, name:'btn_export',funct:"onDownloadClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips =
+                [
+                 {name:'lnk_workorder', title:'Workorder ID', 
description:'enter the Workorder ID to search by workorder - at any Date'},
+                 {name:'lnk_vendor', title:'Vendor', description:'Select the 
vendor by clicking this link'},
+                 {name:'lnk_property', title:'Facilities Managements', 
description:'Select the property by clicking this link'},
+                 {name:'lnk_voucher', title:'Voucher', description:'enter the 
voucher ID to search by vouvher - at any Date'}
+                ]
+
+
+               var textImput = [
+                       {order:0, name:'workorder_id',  id:'txt_workorder'},
+                       {order:1, name:'vendor_id',             
id:'txt_vendor'},
+                       {order:1, name:'loc1',                  id:'txt_loc1'},
+                       {order:3, name:'voucher_id',    id:'txt_voucher'}
+               ]
+
+               var toolTips = [
+                       {name:'voucher_id_lnk',title:'Voucher ID', 
description:'click this link to enter the list of 
sub-invoices',ColumnDescription:''},
+                       {name:'vendor_id_lnk', title:'', 
description:'',ColumnDescription: 'vendor_name'},
+                       {name:'voucher_date_lnk', title:'Payment Date', 
description:'',ColumnDescription:'voucher_date_lnk'}
+               ]
+
+               // define the hidden column in datatable
+               var config_values = {
+                       date_search : 1 //if search has link "Data search"
+               }
+
+               var myFormatDate = function(elCell, oRecord, oColumn, oData)
+               {
+               elCell.innerHTML = YAHOO.util.Number.format(oData, 
{decimalPlaces:2, decimalSeparator:",", thousandsSeparator:" "});
+           }
+       
/********************************************************************************
+       * Delete all message un DIV 'message'
+       */
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                               //necesary for don't show any records in 
datatable
+                               oMenuButton_1.set("label", ("<em>All</em>"));
+                               oMenuButton_1.set("value", 'all');
+                               path_values.user_lid='all';
+
+                               //oMenuButton_0.focus();
+                               
YAHOO.util.Dom.get("start_date-trigger").focus();
+
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                               //nothing
+                       }
+
+               }
+       
/********************************************************************************
+       * Delete all message un DIV 'message'
+       */
+               this.myParticularRenderEvent = function()
+               {
+                       //nothing don't delete
+               }
+
+
+       //----------------------------------------------------------
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+
+                   loader.insert();
+               });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/location.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/location.edit.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/location.edit.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,61 @@
+//an anonymous function wraps our code to keep our variables
+//in function scope rather than in the global namespace:
+(function() {
+       var tree;
+       
+       function treeInit()
+       {
+               buildTextNodeTree();
+               
+               //handler for expanding all nodes
+               YAHOO.util.Event.on("expand", "click", function(e) {
+                       tree.expandAll();
+                       YAHOO.util.Event.preventDefault(e);
+               });
+               
+               //handler for collapsing all nodes
+               YAHOO.util.Event.on("collapse", "click", function(e) {
+                       tree.collapseAll();
+                       YAHOO.util.Event.preventDefault(e);
+               });
+
+               tree.subscribe('clickEvent',function(oArgs) {
+                       window.open(oArgs.node.href,oArgs.node.target);
+               });
+       }
+       
+       function buildTextNodeTree()
+       {
+               //instantiate the tree:
+               tree = new YAHOO.widget.TreeView("treeDiv1");
+               for (var i = 0; i < documents.length; i++)
+               {
+                       var root = tree.getRoot();
+                       var myobj = { label: documents[i]['text'], 
href:documents[i]['link'],target:"_self" };
+                       var tmpNode = new YAHOO.widget.TextNode(myobj, root);
+
+                       if(documents[i]['children'].length)
+                       {
+                               buildBranch(tmpNode, documents[i]['children']);
+                       }
+               }
+
+               tree.draw();
+       }
+
+       function buildBranch(node, parent)
+       {
+               for (var i = 0; i < parent.length; i++)
+               {
+                       var tmpNode = new 
YAHOO.widget.TextNode({label:parent[i]['text'], href:parent[i]['link']}, node, 
false);
+                       if(parent[i]['children'])
+                       {
+                               buildBranch(tmpNode, parent[i]['children']);
+                       }
+               }
+       }
+
+       //When the DOM is done loading, initialize TreeView instance:
+       YAHOO.util.Event.onDOMReady(treeInit);
+       
+})();

Added: people/sigurdne/modules/property/trunk/js/yahoo/location.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/location.index.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/location.index.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,82 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+  //define SelectButton
+     var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+     var selectsButtons = [
+    {order:0, var_URL:'cat_id',                        name:'btn_cat_id',      
        style:'categorybutton',         dependiente:[]},
+    {order:1, var_URL:'district_id',   name:'btn_district_id', 
style:'districtbutton',         dependiente:[2]},
+    {order:2, 
var_URL:'part_of_town_id',name:'btn_part_of_town_id',style:'partOFTownbutton',dependiente:[]},
+    {order:3, var_URL:'filter',                        name:'btn_owner_id',    
style:'ownerIdbutton',          dependiente:[]}
+    ]
+
+    // define buttons
+    var oNormalButton_0, oNormalButton_1, oNormalButton_2;
+    var normalButtons = [
+    {order:0, name:'btn_search',funct:"onSearchClick"},
+    {order:1, name:'btn_new',  funct:"onNewClick"},
+    {order:2, name:'btn_export',funct:"onDownloadClick"}
+    ]
+
+    // define Text buttons
+    var textImput = [
+    {order:0, name:'query',    id:'txt_query'}
+    ]
+
+    var toolTips = [
+      {name:'btn_export', title:'download', description:'Download table to 
your browser',ColumnDescription:''}
+    ]
+
+       var linktoolTips =[
+               {name:'btn_columns', title:'columns', description:'Choose 
columns'}
+        ]
+
+
+    var config_values = {
+      date_search : 0 //if search has link "Data search"
+    }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+           if(flag_particular_setting=='init')
+           {
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+//                     oMenuButton_0.focus();
+           }
+           else if(flag_particular_setting=='update')
+           {
+                       //nothing
+           }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+/****************************************************************************************/
+
+    YAHOO.util.Event.addListener(window, "load", function()
+    {
+      //avoid render buttons html
+      YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+      var loader = new YAHOO.util.YUILoader();
+      loader.addModule({
+        name: "anyone", //module name; must be unique
+        type: "js", //can be "js" or "css"
+          fullpath: property_js //'property_js' have the path for property.js, 
is render in HTML
+          });
+
+      loader.require("anyone");
+
+      //Insert JSON utility on the page
+
+        loader.insert();
+    });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/location.summary.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/location.summary.js         
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/location.summary.js 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,83 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+  //define SelectButton
+     var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+     var selectsButtons = [
+    {order:0, var_URL:'district_id',   name:'btn_district_id',         
style:'categorybutton', dependiente:[1]},
+    {order:1, var_URL:'part_of_town_id',name:'btn_part_of_town_id',    
style:'districtbutton', dependiente:[]},
+    {order:2, var_URL:'filter',                        name:'btn_owner_id',    
        style:'partOFTownbutton',dependiente:[]}
+    ]
+
+    // define buttons
+    var oNormalButton_0, oNormalButton_1, oNormalButton_2;
+    var normalButtons = [
+    {order:2, name:'btn_export',funct:"onDownloadClick"}
+    ]
+
+    // define Text buttons
+    var textImput = [
+    ]
+
+    var toolTips = [
+      {name:'btn_export', title:'download', description:'Download table to 
your browser',ColumnDescription:''}
+    ]
+
+       var linktoolTips =[
+        ]
+
+
+    var config_values = {
+      date_search : 0, //if search has link "Data search"
+      PanelLoading : 1
+    }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+           if(flag_particular_setting=='init')
+           {
+               oMenuButton_0.focus();
+                       //setting in part of town button
+                       index = locate_in_array_options(1,"value","0");
+                       oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       oMenuButton_1.set("value", array_options[1][index][0]);
+                       path_values.part_of_town_id = 
array_options[1][index][0];
+           }
+           else if(flag_particular_setting=='update')
+           {
+                       //nothing
+           }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //not SHOW paginator
+               YAHOO.util.Dom.get("paging").innerHTML = '';
+       }
+
+/****************************************************************************************/
+
+    YAHOO.util.Event.addListener(window, "load", function()
+    {
+      //avoid render buttons html
+      YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display 
= 'none';
+      var loader = new YAHOO.util.YUILoader();
+      loader.addModule({
+        name: "anyone", //module name; must be unique
+        type: "js", //can be "js" or "css"
+          fullpath: property_js //'property_js' have the path for property.js, 
is render in HTML
+          });
+
+      loader.require("anyone");
+
+      //Insert JSON utility on the page
+
+        loader.insert();
+    });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/lookup.entity.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/lookup.entity.index.js      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/lookup.entity.index.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,82 @@
+//--------------------------------------------------------
+// Declaration of lookup.entity.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [
+       {order:0, 
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''},
+       {order:1, var_URL:'district_id',name:'btn_district_id', 
style:'districtbutton', dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+       
+       
/****************************************************************************************/
+               
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+
+                       myColumnDefs = [];
+                       for(var k=0 ; k<values_ds.headers.name.length; k++)
+                   {
+                       if (values_ds.headers.input_type[k] == 'hidden')
+                       {
+                               var obj_temp = {key: values_ds.headers.name[k], 
label: values_ds.headers.descr[k], visible: false, resizeable:true,     
sortable: false, source: ""};
+                       }else{
+                               if (values_ds.headers.name[k] == 'num') {
+                                       var obj_temp = {key: 
values_ds.headers.name[k], label: values_ds.headers.descr[k], visible: true, 
resizeable:true, sortable: true, source: "num"};
+                               }else{
+                                       var obj_temp = {key: 
values_ds.headers.name[k], label: values_ds.headers.descr[k], visible: true, 
resizeable:true, sortable: false, source: ""};        
+                               }
+                       }
+                       myColumnDefs.push(obj_temp);
+                   }
+
+                       init_datatable();
+               }
+       }
+
+/****************************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/lookup.tenant.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/lookup.tenant.index.js      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/lookup.tenant.index.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,61 @@
+//--------------------------------------------------------
+// Declaration of lookup.tenant.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var selectsButtons = [
+       ]
+
+       // define buttons
+       var oNormalButton_0;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //--focus for txt_query---
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       // nothing
+               }
+       }
+/****************************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/lookup.vendor.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/lookup.vendor.index.js      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/lookup.vendor.index.js      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,71 @@
+//--------------------------------------------------------
+// Declaration of lookup.vendor.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var oMenuButton_0;
+       var selectsButtons = [
+       {order:0, 
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //category
+                       eval("var path_values = "+base_java_url+"");
+                       index = 
locate_in_array_options(0,"value",path_values.cat_id);
+                       if(index)
+                       {
+                               oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+                       }
+
+                       //focus initial
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       // nothing
+               }
+       }
+/****************************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/pricebook.activity.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/pricebook.activity.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/pricebook.activity.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,106 @@
+//--------------------------------------------------------
+// Declaration of pricebook.activity vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var oMenuButton_0;
+       var selectsButtons = [
+       {order:0, 
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0,oNormalButton_1,oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+        {order:2, name:'btn_export',funct:"onDownload2Click"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //focus initial
+                       oMenuButton_0.focus();
+
+                       if (path_values.cat_id != '') 
+                       {
+                               for (i=0;i<array_options[0].length;i++)
+                               {
+                                       if(array_options[0][i][0] == 
path_values.cat_id)
+                                       {
+                                               oMenuButton_0.set("label", 
("<em>" + array_options[0][i][1] + "</em>"));
+                                               break;
+                                       }
+                               }
+                       }
+                       
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       // nothing
+               }
+       }
+       
+       this.onDownload2Click = function()
+       {
+               //store actual values
+               var actuall_funct = path_values.menuaction;
+
+               if(config_values.particular_download)
+               {
+                       path_values.menuaction = 
config_values.particular_download;
+               }
+               else
+               {
+                       donwload_func = path_values.menuaction;
+                       // modify actual function for "download" in path_values
+                       tmp_array= donwload_func.split(".")
+                       tmp_array[2]="download_2"; //set function DOWNLOAD
+                       donwload_func = tmp_array.join('.');
+                       path_values.menuaction=donwload_func;
+               }
+
+               ds_download = phpGWLink('index.php',path_values);
+               //show all records since the first
+               ds_download+="&allrows=1&start=0";
+               //return to "function index"
+               path_values.menuaction=actuall_funct;
+               window.open(ds_download,'window');
+   }
+       
+/****************************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: 
people/sigurdne/modules/property/trunk/js/yahoo/pricebook.agreement_group.js
===================================================================
--- 
people/sigurdne/modules/property/trunk/js/yahoo/pricebook.agreement_group.js    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/js/yahoo/pricebook.agreement_group.js    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,64 @@
+//--------------------------------------------------------
+// Declaration of pricebook.agreement_group vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var oMenuButton_0;
+       var selectsButtons = [
+       {order:0, 
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //focus initial
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       // nothing
+               }
+       }
+/****************************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/project.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/project.edit.js             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/project.edit.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,69 @@
+var  myPaginator_0, myDataTable_0
+var  myPaginator_1, myDataTable_1;
+
+/********************************************************************************/
+       YAHOO.widget.DataTable.formatLink = function(elCell, oRecord, oColumn, 
oData)
+       {
+               elCell.innerHTML = "<a 
href="+datatable[0][0]["edit_action"]+"&id="+oData+">" + oData + "</a>";
+       };
+/********************************************************************************/
     
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+       }       
+       
+/********************************************************************************/
     
+       this.myParticularRenderEvent = function()
+       {
+               this.addFooterDatatable(myPaginator_0,myDataTable_0);
+       }
+
+/********************************************************************************/
+       this.addFooterDatatable = function(paginator,datatable)
+       {
+               //call getSumPerPage(name of column) in property.js
+               tmp_sum1 = getSumPerPage('budget',2,paginator,datatable);
+               tmp_sum2 = getSumPerPage('calculation',2,paginator,datatable);
+               tmp_sum3 = getSumPerPage('actual_cost',2,paginator,datatable);
+
+               if(typeof(tableYUI)=='undefined')
+               {
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+               }
+               else
+               {
+                       tableYUI.deleteTFoot();
+               }
+
+               //Create ROW
+               newTR = document.createElement('tr');
+
+               td_sum('Sum');
+               td_sum(tmp_sum1);
+               td_sum(tmp_sum2);
+               td_sum(tmp_sum3);
+               td_empty(3);
+
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+       }
+
+ 
/********************************************************************************/
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/project.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/project.index.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/project.index.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,139 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3, 
oMenuButton_4, oMenuButton_5;
+       var selectsButtons = [
+       {order:0, 
var_URL:'district_id',name:'btn_district_id',style:'districtbutton',dependiente:''},
+       {order:1, 
var_URL:'cat_id',name:'btn_cat_id',style:'categorybutton',dependiente:''},
+       {order:2, 
var_URL:'status_id',name:'btn_status_id',style:'districtbutton',dependiente:''},
+       {order:3, 
var_URL:'wo_hour_cat_id',name:'btn_hour_category_id',style:'partOFTownbutton',dependiente:''},
+       {order:4, var_URL:'filter', 
name:'btn_user_id',style:'ownerIdbutton',dependiente:''},
+       {order:5, var_URL:'criteria_id', 
name:'btn_criteria_id',style:'criteriabutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2, oNormalButton_3;
+       var normalButtons = [
+       {order:0, name:'btn_date_search', funct:"onDateSearchClick"},
+       {order:1, name:'btn_search', funct:"onSearchClick"},
+       {order:2, name:'btn_new', funct:"onNewClick"},
+       {order:3, name:'btn_export', funct:"onDownloadClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'loc1', title:'', 
description:'',ColumnDescription:'loc1_name'},
+               {name:'btn_export', title:'download', description:'Download 
table to your browser', ColumnDescription:''}
+       ]
+
+       var linktoolTips =
+       [
+               {name:'btn_data_search', title:'Date search', 
description:'Narrow the search by dates'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 1 //if search has link "Data search"
+       }
+
+       
/********************************************************************************/
+       this.myFormatNum2 = function(Data)
+       {
+               return  YAHOO.util.Number.format(Data, {decimalPlaces:0, 
decimalSeparator:"", thousandsSeparator:" "});
+       }                               
+       
/********************************************************************************/
+       var myFormatCount2 = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = myFormatNum2(oData);
+       }       
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //district
+                       index = 
locate_in_array_options(0,"value",path_values.district_id);
+                       if(index)
+                       {
+                               oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+                       }
+
+                       //category
+                       index = 
locate_in_array_options(1,"value",path_values.cat_id);
+                       if(index)
+                       {
+                               oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       }
+
+                       //status
+                       index = 
locate_in_array_options(2,"value",path_values.status_id);
+                       if(index)
+                       {
+                               oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
+                       }
+
+                       //wo_hour_cat_id
+                       index = 
locate_in_array_options(3,"value",path_values.wo_hour_cat_id);
+                       if(index)
+                       {
+                               oMenuButton_3.set("label", ("<em>" + 
array_options[3][index][1] + "</em>"));
+                       }
+
+                       //user
+                       index = 
locate_in_array_options(4,"value",path_values.user_id);
+                       if(index)
+                       {
+                               oMenuButton_4.set("label", ("<em>" + 
array_options[4][index][1] + "</em>"));
+                       }
+
+                       //criteria
+                       index = 
locate_in_array_options(5,"value",path_values.criteria_id);
+                       if(index)
+                       {
+                               oMenuButton_5.set("label", ("<em>" + 
array_options[5][index][1] + "</em>"));
+                       }
+
+                       //focus initial
+                       //--focus for txt_query---
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //nothing
+       }
+
+/****************************************************************************************/
+
+//----------------------------------------------------------
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/property.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/property.js                 
        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/property.js 2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1,1374 @@
+       var oSelectedTR;
+       var menuCB,optionsCB, options_combo_box;
+       var array_options = new Array();
+       var flag = 0;
+       var flag_update_filter = new Array();
+       var myDataSource,myDataTable, myContextMenu, myPaginator ;
+       var ds, values_ds;
+       var myrowsPerPage,mytotalRows,ActualValueRowsPerPageDropdown;
+       var showTimer,hideTimer;
+       var tt = new YAHOO.widget.Tooltip("myTooltip");
+       var lightbox;
+       var maxRowsPerPage = 1000;
+       var myLoading;
+       var message_delete = "";
+
+/********************************************************************************
+* This functions is used for initial settings in filter buttons
+*
+* order_button = index of oMenuButton_
+* type = value or text
+* value = value to find
+*/
+       this.locate_in_array_options = function(order_button,type,value)
+       {
+               if(type=="value")
+               {
+                       index = 0;
+               }
+               else if(type=="text")
+               {
+                       index = 1;
+               }
+               for(i=0;i<array_options[order_button].length;i++)
+               {
+                       if(array_options[order_button][i][index]==value)
+                       {
+                               return i;
+                       }
+               }
+       }
+ 
/********************************************************************************
+ *
+ */
+       this.td_empty = function(colspan)
+       {
+               newTD = document.createElement('td');
+               newTD.colSpan = colspan;
+               newTD.style.borderTop="1px solid #000000";
+               newTD.appendChild(document.createTextNode(''));
+               newTR.appendChild(newTD);
+       }
+ 
/********************************************************************************
+ *
+ */
+       this.td_sum = function(sum)
+       {
+               newTD = document.createElement('td');
+               newTD.colSpan = 1;
+               newTD.style.borderTop="1px solid #000000";
+               newTD.style.fontWeight = 'bolder';
+               newTD.style.textAlign = 'right';
+               newTD.style.paddingRight = '0.8em';
+               newTD.appendChild(document.createTextNode(sum));
+               newTR.appendChild(newTD);
+       }
+ 
/********************************************************************************
+ *
+ */
+       CreateRowChecked = function(Class)
+       {
+               newTD = document.createElement('td');
+               newTD.colSpan = 1;
+               newTD.style.borderTop="1px solid #000000";
+               //create the anchor node
+               myA=document.createElement("A");
+               url = "javascript:check_all(\""+Class+"\")";  //particular 
function in each JS
+               myA.setAttribute("href",url);
+               //create the image node
+               url = "property/templates/portico/images/check.png";
+               myImg=document.createElement("IMG");
+               myImg.setAttribute("src",url);
+               myImg.setAttribute("width","16");
+               myImg.setAttribute("height","16");
+               myImg.setAttribute("border","0");
+               myImg.setAttribute("alt","Select All");
+               // Appends the image node to the anchor
+               myA.appendChild(myImg);
+               // Appends myA to mydiv
+               mydiv=document.createElement("div");
+               mydiv.setAttribute("align","center");
+               mydiv.appendChild(myA);
+               // Appends mydiv to newTD
+               newTD.appendChild(mydiv);
+               //Add TD to TR
+               newTR.appendChild(newTD);
+       }
+
+ 
/********************************************************************************
+ * Delete all message un DIV 'message'
+ * type == 1   always delete div content
+ * type == 2   depende of if exists  "values_ds.message" values
+ */
+       this.delete_content_div = function(mydiv,type)
+       {
+               div_message= YAHOO.util.Dom.get(mydiv);
+               //flag borrar
+               borrar = false;
+               //depende of values_ds.message
+               if(type == 2)
+               {
+                       if(window.values_ds.message && 
window.values_ds.message.length)
+                       {
+                               //delete content
+                               borrar = true;
+                       }
+               }
+
+               //always delete div content
+               if(type == 1 || borrar)
+               {
+                       if ( div_message.hasChildNodes() )
+                       {
+                               while ( div_message.childNodes.length >= 1 )
+                           {
+                               div_message.removeChild( div_message.firstChild 
);
+                           }
+                       }
+               }
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.getSumPerPage = function(name_column,round)
+       {
+               //range actual of rows in datatable
+               begin = end = 0;
+               if( (myPaginator.getPageRecords()[1] - 
myPaginator.getPageRecords()[0] + 1 ) == myDataTable.getRecordSet().getLength() 
)
+               //click en Period or ComboBox. (RecordSet start in 0)
+               {
+                       begin   = 0;
+                       end             = myPaginator.getPageRecords()[1] - 
myPaginator.getPageRecords()[0];
+               }
+               else
+               //click en Paginator
+               {
+                       begin   = myPaginator.getPageRecords()[0];
+                       end             = myPaginator.getPageRecords()[1];
+               }
+
+               //get sumatory of column AMOUNT
+               tmp_sum = 0;
+               for(i = begin; i <= end; i++)
+               {
+                       tmp_sum = tmp_sum + 
parseFloat(myDataTable.getRecordSet().getRecords(0)[i].getData(name_column));
+               }
+
+               return tmp_sum = YAHOO.util.Number.format(tmp_sum, 
{decimalPlaces:round, decimalSeparator:",", thousandsSeparator:" "});
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.maintain_pagination_order = function()
+       {
+               //Maintein actual page in paginator
+               path_values.currentPage = myPaginator.getCurrentPage();
+
+               //for mantein paginator
+               path_values.start = myPaginator.getPageRecords()[0];
+
+               //for mantein paginator and fill out combo box show all rows
+               path_values.recordsReturned = values_ds.recordsReturned;
+
+               array_sort_order = getSortingANDColumn()
+               path_values.order = array_sort_order[1];
+               path_values.sort = array_sort_order[0];
+
+               // if actually the datatable show all records, the class PHP 
has to send all records too.
+               if(myPaginator.get("rowsPerPage")== values_ds.totalRecords)
+               {
+                       path_values.allrows = 1;
+               }
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.CreateLoading = function()
+       {
+               if(config_values.PanelLoading)
+               {
+                       myLoading = new YAHOO.widget.Panel("wait",
+                                       {       width:"240px",
+                                               fixedcenter:true,
+                                               close:false,
+                                               draggable:false,
+                                               zindex:4,
+                                               modal:true,
+                                               visible:false
+                                       }
+                               );
+
+                       myLoading.setHeader("Loading, please wait...");
+                       myLoading.setBody('<img 
src="phpgwapi/templates/base/images/loading.gif" />');
+                       myLoading.render(document.body);
+               }
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.pulsar = function(e)
+       {
+               tecla = (document.all) ? e.keyCode :e.which;
+               if(tecla==13)
+               {
+                       if (YAHOO.util.Dom.inDocument('btn_search-button'))
+                       {
+                               
document.getElementById('btn_search-button').click();
+                       }
+               }
+               return (tecla!=13);
+       }
+
+ 
/********************************************************************************
+ * this is used, in respective PHP file.
+ * ...onclick='javascript:filter_data(this.id...)
+ */
+       this.filter_data = function(query)
+       {
+               YAHOO.util.Dom.get("txt_query").value = query;
+               path_values.query = query;
+               execute_ds();
+               myPaginator.setPage(1,true);
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.onDoneClick = function()
+       {
+               //save initial value
+               path_values_menuaction_original = path_values.menuaction;
+
+               // if exist "particular_done" in particular.js
+               if(config_values.particular_done)
+               {
+                       path_values.menuaction = config_values.particular_done;
+               }
+               else
+               {
+                       tmp_array = path_values.menuaction.split(".")
+                       tmp_array[2] = "index"; //set function INDEX
+                       path_values.menuaction = tmp_array.join('.');
+               }
+               window.open(phpGWLink('index.php',path_values),'_self');
+               //come back to initial values
+               path_values.menuaction = path_values_menuaction_original;
+       }
+
+
+ 
/********************************************************************************
+ *
+ */
+       this.onNewClick = function()
+       {
+               for(i=0;i<values_ds.rights.length;i++)
+               {
+                       if(values_ds.rights[i].my_name == 'add')
+                       {
+                               //NEW is always the last options in arrays 
RIGHTS
+                               sUrl = values_ds.rights[i].action;
+                               //Convert all HTML entities to their applicable 
characters
+                               sUrl=html_entity_decode(sUrl);
+                               window.open(sUrl,'_self');
+                       }
+               }
+       }
+
+
+ 
/********************************************************************************
+ *
+ */
+       // Test for date search in lightbox
+       this.onDateSearchClick = function()
+       {
+               var oArgs = {menuaction:'property.uiproject.date_search'};
+               var sUrl = phpGWLink('index.php', oArgs);
+
+               var onDialogShow = function(e, args, o)
+               {
+                       var frame = document.createElement('iframe');
+                       frame.src = sUrl;
+                       frame.width = "100%";
+                       frame.height = "300";
+                       o.setBody(frame);
+               };
+               lightbox.showEvent.subscribe(onDialogShow, lightbox);
+               lightbox.show();
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.onSearchClick = function()
+       {
+               //no es necesario actualizar los valores actuales de 
path_value. Este es global y siempre esta actualizado
+               for(i=0;i<textImput.length;i++)
+               {
+                       var busq = 
encodeURIComponent(YAHOO.util.Dom.get(textImput[i].id).value);
+                       eval("path_values."+textImput[i].name+"='"+busq+"'")
+               }
+
+               //si esta configurado que la busqueda sea por fechas
+               if(config_values.date_search != undefined && 
config_values.date_search != 0)
+               {
+                       path_values.start_date = 
YAHOO.util.Dom.get('start_date').value;
+                       path_values.end_date = 
YAHOO.util.Dom.get('end_date').value;
+               }
+               execute_ds();
+       }
+ 
/********************************************************************************
+ *
+ */
+       this.onDownloadClick = function()
+       {
+               //store actual values
+               actuall_funct = path_values.menuaction;
+
+               if(config_values.particular_download)
+               {
+                       path_values.menuaction = 
config_values.particular_download;
+               }
+               else
+               {
+                       donwload_func = path_values.menuaction;
+                       // modify actual function for "download" in path_values
+                       // for example: property.uilocation.index --> 
property.uilocation.download
+                       tmp_array= donwload_func.split(".")
+                       tmp_array[2]="download"; //set function DOWNLOAD
+                       donwload_func = tmp_array.join('.');
+                       path_values.menuaction=donwload_func;
+               }
+
+               ds_download = phpGWLink('index.php',path_values);
+               //show all records since the first
+               ds_download+="&allrows=1&start=0";
+               //return to "function index"
+               path_values.menuaction=actuall_funct;
+               window.open(ds_download,'window');
+   }
+
+ 
/********************************************************************************
+ * create a array whith values strValues (address@hidden). Necesary for 
selected nested
+ */
+
+       this.create_array_values_list = function(stValues)
+       {
+               var temp1,temp2,temp3 = new Array();
+
+               temp1 = stValues.split('@');
+               for(var n=0 ; n < temp1.length -1 ; n++ ) // -1 because la 
string has a '@' at last
+               {
+                       temp2 = temp1[n].split('#');
+                       temp3[n] = new Array();
+                       for(var j=0 ; j < temp2.length ; j++ )
+                       {
+                        temp3[n][j]=temp2[j];
+                       }
+               }
+               return temp3;
+       }
+
+ 
/********************************************************************************
+ * p_oItem: values passed
+ * p_oItem[0]: id of opcion-select in database
+ * p_oItem[1]: texto of opcion-select in database
+ * p_oItem[2]:order option of the select
+ */
+       this.onMenuItemClick = function(p_sType, p_aArgs, p_oItem)
+       {
+
+               var control = eval("oMenuButton_"+p_oItem[2]);
+               control.set("label", ("<em>" + p_oItem[1] + "</em>"));
+               control.set("value", p_oItem[0]);
+               
eval("path_values."+selectsButtons[p_oItem[2]].var_URL+"='"+p_oItem[0]+"'")
+
+               // tiene dependiente asociado?
+               if(selectsButtons[p_oItem[2]].dependiente.length)
+               {
+                       
for(i=0;i<selectsButtons[p_oItem[2]].dependiente.length;i++)
+                       {
+                               control = 
eval("oMenuButton_"+selectsButtons[p_oItem[2]].dependiente[i]);
+                               control.set("label", ("<em>" + 
array_options[selectsButtons[p_oItem[2]].dependiente[i]][0][1] + "</em>"));
+                               control.set("value", 
array_options[selectsButtons[p_oItem[2]].dependiente[i]][0][0]);
+                               
eval("path_values."+selectsButtons[selectsButtons[p_oItem[2]].dependiente[i]].var_URL+"=''");
  //empty
+                               flag_update_filter[i] = 
selectsButtons[p_oItem[2]].dependiente[i];
+                       }
+               }
+
+               //los valores de 'path_values' ya estan actualizados no es 
necesario verificar
+               execute_ds();
+       }
+
+
+
+ 
/********************************************************************************
+ * stValues:  values of select control, separate whit @ and #
+ * order: indicate the id of Combo box
+ */
+    this.create_menu_list = function(stValues,order)
+        {
+               var temp1, temp2, MenuButtonMenu = new Array();
+               temp1 = stValues.split('@');
+               for(var k=0 ; k < temp1.length -1 ; k++ ) // -1 because the 
string has a '@' at last
+               {
+                       temp2 = temp1[k].split('#');
+                       temp2.push(order);
+                       var obj_temp = {id: '', text: temp2[1], value: 
temp2[0], onclick: { fn: onMenuItemClick , obj: temp2} };
+                       MenuButtonMenu.push(obj_temp);
+               }
+               return MenuButtonMenu;
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.mantainFocusItenMenu = function ()
+       {
+               for(p=0;p<this.get("menu").length;p++)
+               {
+                       if(this.get("menu")[p].value == this.get("value"))
+                       {
+                               this.set("selectedMenuItem",p);
+                               break;
+                       }
+               }
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.init_filter = function()
+       {
+               //flag to show Add button
+               var flag_add = 0;
+               //create button
+               for(var p=0; p<normalButtons.length; p++)
+               {
+                       if (YAHOO.util.Dom.inDocument(normalButtons[p].name))
+                       {
+                               var botton_tmp = new 
YAHOO.widget.Button(normalButtons[p].name);
+                               botton_tmp.on("click", 
eval(normalButtons[p].funct));
+
+                               if(typeof toolTips == 'object')
+                               {
+                                       for(var d=0;d<toolTips.length;d++)
+                                       {
+                                               if(normalButtons[p].name == 
toolTips[d].name)
+                                               {
+                                                       var description = 
toolTips[d].description;
+                                                       var title = 
toolTips[d].title;
+
+                                                       
botton_tmp.on("mouseover", function (oArgs)
+                                                       {
+                                                               if (showTimer)
+                                                               {
+                                                                       
window.clearTimeout(showTimer);
+                                                                       
showTimer = 0;
+                                                               }
+
+                                                               var target = 
oArgs.target;
+                                                               var xy = 
[parseInt(oArgs.clientX,10) + 10 ,parseInt(oArgs.clientY,10) + 10 ];
+
+                                                               showTimer = 
window.setTimeout(function()
+                                                               {
+                                                                       
tt.setBody("<table class='tooltip-table'><tr 
class='tooltip'><td>"+title+"</td></tr><tr><td>"+description+"</td></tr></table>");
+                                                                       
tt.cfg.setProperty('xy',xy);
+                                                                       
tt.show();
+                                                                       
hideTimer = window.setTimeout(function()
+                                                                       {
+                                                                               
tt.hide();
+                                                                       }
+                                                                       ,2000);
+                                                               },500);
+                                                       });
+                                               }
+                                       }
+                               }
+                       eval("oNormalButton_"+p+" = botton_tmp");
+                       }
+               }
+
+               //create filters
+               for(var i=0; i<selectsButtons.length; i++)
+               {
+                       options_combo_box = 
values_combo_box[selectsButtons[i].order];
+                       optionsCB = 
create_menu_list(options_combo_box.value,selectsButtons[i].order);
+                       array_options[selectsButtons[i].order] = 
create_array_values_list(options_combo_box.value);
+
+                       //cramirez: avoid assigning an object to hidden filter.
+                       if(array_options[selectsButtons[i].order].length > 0)
+                       {
+                               menuCB = { type: "menu", label:"<em>"+ 
array_options[selectsButtons[i].order][0][1]+"</em>", id: 
selectsButtons[i].style, value:"", menuminscrollheight : 40, menumaxheight : 
300 ,menu: optionsCB, onclick: {fn: mantainFocusItenMenu}};
+                               var tmp = new 
YAHOO.widget.Button(selectsButtons[i].name, menuCB)
+                               eval("oMenuButton_"+selectsButtons[i].order+" = 
tmp");
+                       }
+
+               }
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.delete_record = function(sUrl)
+       {
+               var callback =  {       success: function(o){
+                                                                       
message_delete = o.responseText.toString().replace("\"","").replace("\"","");
+                                                                       
execute_ds()
+                                                                       },
+                                                       failure: 
function(o){window.alert('Server or your connection is dead.')},
+                                                       timeout: 10000
+                                               };
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+
+       }
+
+ 
/********************************************************************************
+ *
+ */
+       this.onContextMenuBeforeShow = function(p_sType, p_aArgs)
+       {
+               var oTarget = this.contextEventTarget;
+               if (this.getRoot() == this)
+               {
+                       if(oTarget.tagName != "TD")
+                       {
+                               oTarget = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
+                       }
+                       oSelectedTR = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
+                       oSelectedTR.style.backgroundColor  = '#AAC1D8' ;
+                       oSelectedTR.style.color = "black";
+                       YAHOO.util.Dom.addClass(oSelectedTR, prefixSelected);
+               }
+       }
+ 
/********************************************************************************
+ *
+ */
+       this.onContextMenuHide = function(p_sType, p_aArgs)
+       {
+               if (this.getRoot() == this && oSelectedTR)
+               {
+                       oSelectedTR.style.backgroundColor  = "" ;
+                       oSelectedTR.style.color = "";
+                       YAHOO.util.Dom.removeClass(oSelectedTR, prefixSelected);
+               }
+       }
+ 
/********************************************************************************
+ *
+ */
+       this.onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable)
+       {
+               var task = p_aArgs[1];
+                       if(task)
+                       {
+                               // Extract which TR element triggered the 
context menu
+                               var elRow = 
p_myDataTable.getTrEl(this.contextEventTarget);
+                               if(elRow)
+                               {
+                                       var oRecord = 
p_myDataTable.getRecord(elRow);
+                                       var url = 
values_ds.rights[task.groupIndex].action;
+                                       var sUrl = "";
+                                       var vars2 = "";
+
+                                       
if(values_ds.rights[task.groupIndex].parameters!=null)
+                                       {
+                                               for(f=0; 
f<values_ds.rights[task.groupIndex].parameters.parameter.length; f++)
+                                               {
+                                                       param_name = 
values_ds.rights[task.groupIndex].parameters.parameter[f].name;
+                                                       param_source = 
values_ds.rights[task.groupIndex].parameters.parameter[f].source;
+                                                       vars2 = vars2 + 
"&"+param_name+"=" + oRecord.getData(param_source);
+                                               }
+                                               sUrl = url + vars2;
+                                       }
+                                       
if(values_ds.rights[task.groupIndex].parameters.parameter.length > 0)
+                                       {
+                                               //nothing
+                                       }
+                                       else //for New
+                                       {
+                                               sUrl = url;
+                                       }
+                                       //Convert all HTML entities to their 
applicable characters
+                                       sUrl=html_entity_decode(sUrl);
+
+                                       // look for the word "DELETE" in URL
+                                       if(substr_count(sUrl,'delete')>0)
+                                       {
+                                               confirm_msg = 
values_ds.rights[task.groupIndex].confirm_msg;
+                                               if(confirm(confirm_msg))
+                                               {
+                                                       sUrl = sUrl + 
"&confirm=yes&phpgw_return_as=json";
+                                                       delete_record(sUrl);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               
if(substr_count(sUrl,'target=_blank')>0)
+                                               {
+                                                       
window.open(sUrl,'_blank');
+                                               }
+                                               else
+                                               {
+                                                       
window.open(sUrl,'_self');
+                                               }
+                                       }
+                               }
+                       }
+       };
+ 
/********************************************************************************
+ *
+ */
+       this.GetMenuContext = function()
+       {
+               var opts = new Array();
+               var p=0;
+               for(var k =0; k < values_ds.rights.length; k ++)
+               {
+                       if(values_ds.rights[k].my_name != 'add')
+                       {       opts[p]=[{text: values_ds.rights[k].text}];
+                               p++;
+                       }
+               }
+               return opts;
+   }
+
+ 
/********************************************************************************
+ *
+ */
+       this.buildQuery = function(strQuery)
+       {
+               path_values.query = YAHOO.util.Dom.get(textImput[0].name).value;
+               execute_ds();
+       }
+/******************************************************************************
+*
+*/
+       var buildQueryString = function (state,dt)
+       {
+               //this values can be update for combo box
+               ActualValueRowsPerPageDropdown = state.pagination.rowsPerPage;
+
+               //particular variables for Datasource
+               var url="&start=" + state.pagination.recordOffset;
+
+               //for mantein paginator and fill out combo box show all rows
+               url+="&recordsReturned=" + values_ds.recordsReturned;
+
+               //Get actually order Columns 
//url+="&order="+oColumn.source+"&sort="+sDir;
+               for(i=0;i<myColumnDefs.length;i++)
+               {
+                       if (myColumnDefs[i].key == 
state.sortedBy.key.toString())
+                       {
+                               url+="&order=" + myColumnDefs[i].source;
+                               break;
+                       }
+               }
+
+               //Get actually sort (asc/desc)
+               url+="&sort=" + 
state.sortedBy.dir.toString().replace("yui-dt-", "");
+               // actually page num
+               url+="&currentPage="+state.pagination.page;
+
+               // when user do click in combo box (for show all rows)
+               if(state.pagination.rowsPerPage == values_ds.totalRecords)
+               {
+                       url=url+"&allrows=1";
+               }
+               else
+               {
+                       url=url+"&allrows=0";
+               }
+
+               //delete previous records in datatable
+               myDataTable.getRecordSet().reset();
+
+               //sea actualiza el liveDAta del Datasource con los actuales 
valores de los combos y txtboxs
+               myDataTable.getDataSource().liveData=ds;
+
+               return url;
+       }
+/********************************************************************************
+ *
+ */
+       this.execute_ds = function(allrows)
+       {
+               if(allrows == true)
+               {
+                       path_values.allrows = true;
+               }
+               if(config_values.PanelLoading)
+               {
+                       myLoading.show();
+               }
+               try     {
+                       ds = phpGWLink('index.php',path_values,true);
+                       }
+               catch(e)
+                       {
+                               alert(e);
+                       }
+
+               var callback2 =
+               {
+                       success: function(o)
+                       {
+                               if(config_values.PanelLoading)
+                               {
+                                       myLoading.hide();
+                               }
+                               eval('values_ds ='+o.responseText);
+                               flag_particular_setting='';
+
+                               if(flag==0)
+                               {
+                                       init_datatable();
+                                       init_filter();
+                                       flag_particular_setting='init';
+                               }
+                               else
+                               {
+                                       
myPaginator.setRowsPerPage(values_ds.recordsReturned,true);
+                                       update_datatable();
+                                       update_filter();
+                                       flag_particular_setting='update';
+
+                               }
+                               particular_setting();
+
+                       },
+                       failure: function(o) {window.alert('Server or your 
connection is dead.')},
+                       timeout: 10000,
+                       cache: false
+               }
+               try
+               {
+                       //First call JSON (POST)
+                       YAHOO.util.Connect.asyncRequest('POST',ds,callback2);
+               }
+               catch(e_async)
+               {
+                  alert(e_async.message);
+               }
+       }
+
+/********************************************************************************
+ *
+ */
+       this.init_datatable = function()
+       {
+               if(typeof(linktoolTips)=='object')
+               {
+                       show_link_tooltips();
+                       create_lightbox();
+               }
+
+               toolbars = 
YAHOO.util.Dom.getElementsByClassName('toolbar','div');
+               for(i=0;i<toolbars.length;i++)
+               {
+                       toolbars[i].style.display = 'block';
+               }
+
+               myDataSource = new YAHOO.util.DataSource(ds);
+               myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
+
+               // Compute fields from column definitions
+               var fields = new Array();
+               for(var i=0; i < myColumnDefs.length;i++)
+               {
+                       fields[i] = myColumnDefs[i].key;
+               }
+
+               // When responseSchema.totalRecords is not indicated, the 
records returned from the DataSource are assumed to represent the entire set
+               myDataSource.responseSchema =
+               {
+                       resultsList     : "records",
+                       fields          : fields,
+                       metaFields      :{totalRecords: 'totalRecords'} // The 
totalRecords meta field is a "magic" meta, and will be passed to the Paginator.
+               };
+               var container = YAHOO.util.Dom.getElementsByClassName( 
'datatable-container' , 'div' );
+
+               //variables iniciales para la configuracion del "paginador", 
solo la primera vez se ejecuta
+               if(flag==0)
+               {
+                       myrowsPerPage = values_ds.recordsReturned;
+                       ActualValueRowsPerPageDropdown = 
values_ds.recordsReturned;
+                       mytotalRows = values_ds.totalRecords;
+               }
+               flag++;
+
+               myPaginatorConfig = {
+                                                               containers      
                : ['paging'],
+                                                               totalRecords    
        : mytotalRows,
+                                                               pageLinks       
                : 10,
+                                                               rowsPerPage     
                : values_ds.recordsReturned, //MAXIMO el PHPGW me devuelve 15 
valor configurado por preferencias
+                                                               
rowsPerPageOptions      : [myrowsPerPage, mytotalRows],
+                                                               template        
                : "{RowsPerPageDropdown}poster pr side. 
{CurrentPageReport}<br>{FirstPageLink} {PreviousPageLink} {PageLinks} 
{NextPageLink} {LastPageLink}",
+                                                               
pageReportTemplate      : "Viser {startRecord} - {endRecord} av {totalRecords}"
+                                                       }
+               myPaginator = new YAHOO.widget.Paginator(myPaginatorConfig);
+
+               var myTableConfig = {
+                                                       initialRequest          
: '',//la primera vez ya viene ordenado, por la columna respectiva y solo 15 
registros
+                                                       generateRequest         
: buildQueryString,
+                                                       dynamicData             
        : true,
+                                                       sortedBy                
        : {key:values_ds.sort, 
dir:values_ds.dir/*dir:YAHOO.widget.DataTable.CLASS_DESC*/},
+                                                       paginator               
        : myPaginator
+               };
+               //Create DataTable ; Second call JSON (GET)
+               myDataTable = new YAHOO.widget.DataTable(container[0], 
myColumnDefs, myDataSource, myTableConfig);
+
+               myDataTable.on('cellMouseoverEvent', function (oArgs)
+               {
+                       {
+                       if (showTimer)
+                       {
+                               window.clearTimeout(showTimer);
+                               showTimer = 0;
+                       }
+
+                       var target = oArgs.target;
+                       var column = myDataTable.getColumn(target);
+                       var title;
+                       var description;
+                       var num=0;
+
+                       var pages=0;
+                       var rowspepage=0;
+                       var param1=0;
+
+                       for(var p=0;p<toolTips.length;p++)
+                       {
+                               if (column.key == toolTips[p].name)
+                               {
+                                       var record = this.getRecord(target);
+                                       if(myPaginator.getCurrentPage() > 2 && 
myDataTable.getRecordSet().getRecords()[0]==null )
+                                       {
+                                               title = toolTips[p].title || 
myDataTable.getRecordSet().getRecords()[this.getRecordIndex(target)].getData(toolTips[p].name);
+                                               description = 
toolTips[p].description || 
myDataTable.getRecordSet().getRecords()[this.getRecordIndex(target)].getData(toolTips[p].ColumnDescription);
+                                       }
+
+                                       if(myPaginator.getCurrentPage() == 2 && 
myDataTable.getRecordSet().getRecords()[0]==null)
+                                       {
+                                               title = toolTips[p].title || 
myDataTable.getRecordSet().getRecords()[this.getRecordIndex(target)].getData(toolTips[p].name);
+                                               description = 
toolTips[p].description || 
myDataTable.getRecordSet().getRecords()[this.getRecordIndex(target)].getData(toolTips[p].ColumnDescription);
+                                       }
+                                       if(myPaginator.getCurrentPage() == 2 && 
myDataTable.getRecordSet().getRecords()[0]!=null)
+                                       {
+                                               rowspepage = 
myPaginator.getRowsPerPage();
+                                               num = 
this.getRecordIndex(target)-rowspepage;
+                                               title = toolTips[p].title || 
myDataTable.getRecordSet().getRecords()[num].getData(toolTips[p].name);
+                                               description = 
toolTips[p].description || 
myDataTable.getRecordSet().getRecords()[num].getData(toolTips[p].ColumnDescription);
+                                       }
+                                       if(myPaginator.getCurrentPage() == 1 && 
myDataTable.getRecordSet().getRecords()[0]!=null)
+                                       {
+                                               title = toolTips[p].title || 
myDataTable.getRecordSet().getRecords()[this.getRecordIndex(target)].getData(toolTips[p].name);
+                                               description = 
toolTips[p].description || 
myDataTable.getRecordSet().getRecords()[this.getRecordIndex(target)].getData(toolTips[p].ColumnDescription);
+                                       }
+                                       if(myPaginator.getCurrentPage() > 2 && 
myDataTable.getRecordSet().getRecords()[0]!=null)
+                                       {
+                                               pages = 
parseInt(myPaginator.getCurrentPage()-1);
+                                               rowspepage = 
myPaginator.getRowsPerPage();
+                                               param1 = parseInt(pages * 
rowspepage);
+                                               num = 
parseInt(this.getRecordIndex(target) - param1);
+                                               title = toolTips[p].title || 
myDataTable.getRecordSet().getRecords()[num].getData(toolTips[p].name);
+                                               description = 
toolTips[p].description || 
myDataTable.getRecordSet().getRecords()[num].getData(toolTips[p].ColumnDescription);
+                                       }
+
+                                       var xy = 
[parseInt(oArgs.event.clientX,10) + 10 ,parseInt(oArgs.event.clientY,10) + 10 ];
+
+                                       showTimer = window.setTimeout(function()
+                                       {
+                                               tt.setBody("<table 
class='tooltip-table'><tr class='tooltip'><td 
class='nolink'>"+title+"</td></tr><tr><td>"+description+"</td></tr></table>");
+                                               tt.cfg.setProperty('xy',xy);
+                                               tt.show();
+                                               hideTimer = 
window.setTimeout(function()
+                                               {
+                                                       tt.hide();
+                                               },5000);
+                                       },100);
+                               }
+                       }
+                       }
+               });
+
+                myDataTable.on('cellMouseoutEvent', function (oArgs)
+                {
+                       if (showTimer)
+                       {
+                               window.clearTimeout(showTimer);
+                               showTimer = 0;
+                       }
+
+                       if (hideTimer)
+                       {
+                               window.clearTimeout(hideTimer);
+                               hideTimer = 0;
+                       }
+                       tt.hide();
+               });
+
+               myDataTable.handleDataReturnPayload = function(oRequest, 
oResponse, oPayload)
+               {
+                       oPayload.totalRecords = oResponse.meta.totalRecords;
+                       return oPayload;
+               }
+
+               // Override function for custom server-side sorting
+               myDataTable.sortColumn = function(oColumn)
+               {
+                       var sDir = "asc"
+                       if(oColumn.key === this.get("sortedBy").key)
+                       {
+                               sDir = (this.get("sortedBy").dir === 
YAHOO.widget.DataTable.CLASS_ASC) ? "desc" : "asc";
+                       }
+                       //URL-vars adicionales que se agregaran al actual ds
+                       var addToRequest = 
"&start=0&order="+oColumn.source+"&sort="+sDir+"&recordsReturned="+values_ds.recordsReturned+"&currentPage="+values_ds.currentPage;
+
+                       if(mytotalRows == ActualValueRowsPerPageDropdown)
+                       {
+                               addToRequest = addToRequest+"&allrows=1";
+                       }
+
+                       //sea actualiza el liveDAta del Datasource con los 
actuales valores de los combos y txtboxs
+                       myDataTable.getDataSource().liveData=ds;
+
+                       // Create callback for data request
+                       var oCallback3 =
+                       {
+                               success: function(sRequest, oResponse, oPayload)
+                               {
+                                       var hh= myPaginator;
+                                       var paginator = this.get('paginator');
+                                       var total_records = 
paginator._configs.totalRecords.value;
+                                       
this.onDataReturnInitializeTable(sRequest, oResponse, oPayload);
+                                       paginator.set('totalRecords', 
total_records);
+                               },
+                               failure: function(sRequest, oResponse, oPayload)
+                               {
+                                       
this.onDataReturnInitializeTable(sRequest, oResponse, oPayload);
+                               },
+                               scope: this,
+                               argument:
+                               {
+                                       sorting:{
+                                                               key: 
oColumn.key,
+                                                               dir: (sDir === 
"asc") ? YAHOO.widget.DataTable.CLASS_ASC : YAHOO.widget.DataTable.CLASS_DESC
+                                                       }
+                               }
+                       }
+                       try
+                       {
+                               
myDataTable.getDataSource().sendRequest(addToRequest, oCallback3, myDataTable, 
true);
+                       }
+                       catch(e)
+                       {
+                               alert(e);
+                       }
+                       myPaginator.setPage(1,true);
+               };
+
+               myContextMenu = new YAHOO.widget.ContextMenu("mycontextmenu", 
{trigger:myDataTable.getTbodyEl()});
+               myContextMenu.addItems(GetMenuContext());
+
+               myDataTable.subscribe("rowMouseoverEvent", 
myDataTable.onEventHighlightRow);
+               myDataTable.subscribe("rowMouseoutEvent", 
myDataTable.onEventUnhighlightRow);
+
+               myDataTable.subscribe("renderEvent", myRenderEvent);
+
+               myDataTable.subscribe("rowClickEvent",function (oArgs)
+                                                                               
           {
+                                                                               
                        var elTarget = oArgs.target;
+                                                                               
                        var oRecord = this.getRecord(elTarget);
+                                                                               
                        Exchange_values(oRecord);
+                                                                               
           }
+          );
+
+               myContextMenu.subscribe("beforeShow", onContextMenuBeforeShow);
+               myContextMenu.subscribe("hide", onContextMenuHide);
+               //Render the ContextMenu instance to the parent container of 
the DataTable
+               myContextMenu.subscribe("click", onContextMenuClick, 
myDataTable);
+               myContextMenu.render(container[0]);
+
+               for(var i=0; i < myColumnDefs.length;i++)
+               {
+                       if( myColumnDefs[i].sortable )
+                       {
+                               YAHOO.util.Dom.getElementsByClassName( 
'yui-dt-resizerliner' , 'div' )[i].style.background  = '#D8D8DA 
url(phpgwapi/js/yahoo/assets/skins/sam/sprite.png) repeat-x scroll 0 -100px';
+                       }
+
+                       if( !myColumnDefs[i].visible )
+                       {
+                               var sKey = myColumnDefs[i].key;
+                               myDataTable.hideColumn(sKey);
+                       }
+                       //title columns alwyas center
+                       YAHOO.util.Dom.getElementsByClassName( 
'yui-dt-resizerliner', 'div' )[0].style.textAlign = 'center';
+               }
+
+               return {
+                       ds: myDataSource,
+                       dt: myDataTable
+                       };
+       }
+/****************************************************************************************
+*
+*/
+
+       this.update_datatable = function()
+       {
+               //delete values of datatable
+               myDataTable.getRecordSet().reset();
+
+               //reset total records always to zero
+               myPaginator.setTotalRecords(0,true);
+
+               //change Paginator\xB4s configuration.
+               if(path_values.allrows == 1 )
+               {
+                       myPaginator.set("rowsPerPage",values_ds.totalRecords)
+               }
+
+               //obtain records of the last DS and add to datatable
+               var record = values_ds.records;
+               var newTotalRecords = values_ds.totalRecords;
+
+               if(record.length)
+               {
+                       myDataTable.addRows(record);
+               }
+               else
+               {
+                       myDataTable.render();
+               }
+
+               //update paginator with news values
+               myPaginator.setTotalRecords(newTotalRecords,true);
+
+               //update globals variables for pagination
+               myrowsPerPage = values_ds.recordsReturned;
+               mytotalRows = values_ds.totalRecords;
+
+               //update combo box pagination
+               
myPaginator.set('rowsPerPageOptions',[myrowsPerPage,mytotalRows]);
+
+               myPaginator.setPage(parseInt(values_ds.currentPage),true); 
//true no fuerza un recarge solo cambia el paginator
+
+               //update "sortedBy" values
+               (values_ds.dir == "asc")? dir_ds = 
YAHOO.widget.DataTable.CLASS_ASC : dir_ds = YAHOO.widget.DataTable.CLASS_DESC;
+               myDataTable.set("sortedBy",{key:values_ds.sort,dir:dir_ds});
+
+       }
+
+/****************************************************************************************
+*
+*/
+
+       this.update_filter = function()
+       {
+        if (flag_update_filter.length)
+               {
+                       for(i=0;i<flag_update_filter.length;i++)
+                       {
+                               filter_tmp = 
eval("oMenuButton_"+flag_update_filter[i]);
+
+                               filter_tmp.getMenu().clearContent();
+                               filter_tmp.getMenu().itemData = 
create_menu_list 
(values_ds.hidden.dependent[i].value,selectsButtons[flag_update_filter[i]].order);
+                               
filter_tmp.set("value",values_ds.hidden.dependent[i].id);
+                               flag_update_filter[i] = '';
+                       }
+                       //avoid update_filter again
+                       flag_update_filter.splice(0,flag_update_filter.length)
+               }
+       }
+
+/****************************************************************************************
+*
+*/
+       this.myRenderEvent = function()
+       {
+               //Desable DropRows of Paginator and Download button.
+               if(myPaginator.getTotalRecords() > maxRowsPerPage)
+               {
+                       if(YAHOO.util.Dom.inDocument("btn_export-button"))
+                       {
+                               for(i=0;i<normalButtons.length;i++)
+                               {
+                                       if(normalButtons[i].name == 
"btn_export")
+                                       {
+                                               
eval("oNormalButton_"+i+"._setDisabled(true)");
+                                       }
+                               }
+                       }
+                       
YAHOO.util.Dom.getElementsByClassName('yui-pg-rpp-options','select')[0].disabled
 = true;
+
+               }
+               else
+               {
+                       if(YAHOO.util.Dom.inDocument("btn_export-button"))
+                       {
+                               for(i=0;i<normalButtons.length;i++)
+                               {
+                                       if(normalButtons[i].name == 
"btn_export")
+                                       {
+                                               
eval("oNormalButton_"+i+"._setDisabled(false)");
+                                       }
+                               }
+                       }
+                       //avoid error when div "paging" is delete (innerHTML="")
+                       if(YAHOO.util.Dom.inDocument("yui-pg0-0-rpp"))
+                       {
+                               //see in datatable.xsl
+                               if(allow_allrows == 1)
+                               {
+                                       
YAHOO.util.Dom.getElementsByClassName('yui-pg-rpp-options','select')[0].disabled
 = false;
+                               }
+                               else
+                               {
+                                       
YAHOO.util.Dom.getElementsByClassName('yui-pg-rpp-options','select')[0].disabled
 = true;
+                               }
+                       }
+               }
+               //validate right ADD.
+               if(YAHOO.util.Dom.inDocument("btn_new-button"))
+               {
+                       disabled_button_add = true;
+                       for(i=0;i<values_ds.rights.length;i++)
+                       {
+                               if(values_ds.rights[i].my_name == "add")
+                               {
+                                       disabled_button_add = false;
+                               }
+                       }
+                       if(disabled_button_add)
+                       {
+                               // button ADD should be the lastest in array 
normalButtons.
+                               order_new = normalButtons.length - 1;
+                               
eval("oNormalButton_"+order_new+"._setDisabled(true)");
+                       }
+               }
+
+               //shown message if delete records
+               delete_content_div("message",1);
+               if(message_delete != "")
+               {
+                       oDiv=document.createElement("DIV");
+                       txtNode = document.createTextNode(message_delete);
+                       oDiv.appendChild(txtNode);
+                       oDiv.style.color = '#009900';
+                       oDiv.style.fontWeight = 'bold';
+                       div_message.appendChild(oDiv);
+                       message_delete = "";
+               }
+
+               // go to RENDER function in each particular js
+               myParticularRenderEvent();
+       }
+/****************************************************************************************
+* Function to create tooltips for link elements.
+*/
+       this.show_link_tooltips = function(link)
+       {
+               for(var u=0;u<linktoolTips.length;u++)
+               {
+                       new YAHOO.widget.Tooltip("tt"+u, { 
context:linktoolTips[u].name, text: "<table class='tooltip-table'><tr 
class='tooltip'><td 
class='nolink'>"+linktoolTips[u].title+"</td></tr><tr><td>"+linktoolTips[u].description+"</td></tr></table>"});
+               }
+       }
+
+
+/****************************************************************************************
+* Function to create a lightbox object.
+*/
+       this.create_lightbox = function()
+       {
+               lightbox = new YAHOO.widget.Dialog("datatable-detail",
+               {
+                       width : "600px",
+                       fixedcenter : true,
+                       visible : false,
+                       modal : false
+                       //draggable: true,
+                       //constraintoviewport : true
+               });
+
+               lightbox.render();
+               YAHOO.util.Dom.setStyle('datatable-detail', 'display', 'block');
+       }
+
+
+/****************************************************************************************
+*
+*/
+       this.html_entity_decode = function(string)
+       {
+               var histogram = {}, histogram_r = {}, code = 0;
+               var entity = chr = '';
+
+               histogram['34'] = 'quot';
+               histogram['38'] = 'amp';
+               histogram['60'] = 'lt';
+               histogram['62'] = 'gt';
+               histogram['160'] = 'nbsp';
+               histogram['161'] = 'iexcl';
+               histogram['162'] = 'cent';
+               histogram['163'] = 'pound';
+               histogram['164'] = 'curren';
+               histogram['165'] = 'yen';
+               histogram['166'] = 'brvbar';
+               histogram['167'] = 'sect';
+               histogram['168'] = 'uml';
+               histogram['169'] = 'copy';
+               histogram['170'] = 'ordf';
+               histogram['171'] = 'laquo';
+               histogram['172'] = 'not';
+               histogram['173'] = 'shy';
+               histogram['174'] = 'reg';
+               histogram['175'] = 'macr';
+               histogram['176'] = 'deg';
+               histogram['177'] = 'plusmn';
+               histogram['178'] = 'sup2';
+               histogram['179'] = 'sup3';
+               histogram['180'] = 'acute';
+               histogram['181'] = 'micro';
+               histogram['182'] = 'para';
+               histogram['183'] = 'middot';
+               histogram['184'] = 'cedil';
+               histogram['185'] = 'sup1';
+               histogram['186'] = 'ordm';
+               histogram['187'] = 'raquo';
+               histogram['188'] = 'frac14';
+               histogram['189'] = 'frac12';
+               histogram['190'] = 'frac34';
+               histogram['191'] = 'iquest';
+               histogram['192'] = 'Agrave';
+               histogram['193'] = 'Aacute';
+               histogram['194'] = 'Acirc';
+               histogram['195'] = 'Atilde';
+               histogram['196'] = 'Auml';
+               histogram['197'] = 'Aring';
+               histogram['198'] = 'AElig';
+               histogram['199'] = 'Ccedil';
+               histogram['200'] = 'Egrave';
+               histogram['201'] = 'Eacute';
+               histogram['202'] = 'Ecirc';
+               histogram['203'] = 'Euml';
+               histogram['204'] = 'Igrave';
+               histogram['205'] = 'Iacute';
+               histogram['206'] = 'Icirc';
+               histogram['207'] = 'Iuml';
+               histogram['208'] = 'ETH';
+               histogram['209'] = 'Ntilde';
+               histogram['210'] = 'Ograve';
+               histogram['211'] = 'Oacute';
+               histogram['212'] = 'Ocirc';
+               histogram['213'] = 'Otilde';
+               histogram['214'] = 'Ouml';
+               histogram['215'] = 'times';
+               histogram['216'] = 'Oslash';
+               histogram['217'] = 'Ugrave';
+               histogram['218'] = 'Uacute';
+               histogram['219'] = 'Ucirc';
+               histogram['220'] = 'Uuml';
+               histogram['221'] = 'Yacute';
+               histogram['222'] = 'THORN';
+               histogram['223'] = 'szlig';
+               histogram['224'] = 'agrave';
+               histogram['225'] = 'aacute';
+               histogram['226'] = 'acirc';
+               histogram['227'] = 'atilde';
+               histogram['228'] = 'auml';
+               histogram['229'] = 'aring';
+               histogram['230'] = 'aelig';
+               histogram['231'] = 'ccedil';
+               histogram['232'] = 'egrave';
+               histogram['233'] = 'eacute';
+               histogram['234'] = 'ecirc';
+               histogram['235'] = 'euml';
+               histogram['236'] = 'igrave';
+               histogram['237'] = 'iacute';
+               histogram['238'] = 'icirc';
+               histogram['239'] = 'iuml';
+               histogram['240'] = 'eth';
+               histogram['241'] = 'ntilde';
+               histogram['242'] = 'ograve';
+               histogram['243'] = 'oacute';
+               histogram['244'] = 'ocirc';
+               histogram['245'] = 'otilde';
+               histogram['246'] = 'ouml';
+               histogram['247'] = 'divide';
+               histogram['248'] = 'oslash';
+               histogram['249'] = 'ugrave';
+               histogram['250'] = 'uacute';
+               histogram['251'] = 'ucirc';
+               histogram['252'] = 'uuml';
+               histogram['253'] = 'yacute';
+               histogram['254'] = 'thorn';
+               histogram['255'] = 'yuml';
+
+               // Reverse table. Cause for maintainability purposes, the 
histogram is
+               // identical to the one in htmlentities.
+               for (code in histogram) {
+                       entity = histogram[code];
+                       histogram_r[entity] = code;
+               }
+
+               return (string+'').replace(/(\&([a-zA-Z]+)\;)/g, function(full, 
m1, m2){
+                       if (m2 in histogram_r) {
+                               return String.fromCharCode(histogram_r[m2]);
+                       } else {
+                               return m2;
+                       }
+               });
+}
+/****************************************************************************************
+*
+*/
+       function substr_count( haystack, needle, offset, length )
+       {
+               var pos = 0, cnt = 0;
+
+               haystack += '';
+               needle += '';
+               if(isNaN(offset)) offset = 0;
+               if(isNaN(length)) length = 0;
+               offset--;
+
+               while( (offset = haystack.indexOf(needle, offset+1)) != -1 )
+               {
+                       if(length > 0 && (offset+needle.length) > length)
+                       {
+                               return false;
+                       } else
+                       {
+                               cnt++;
+                       }
+               }
+               return cnt;
+       }
+/********************************************************************************
+ *
+ */
+       this.getSortingANDColumn = function()
+       {
+               var array_result = new Array();
+               //look up ORDER
+               array_result[0] = 
myDataTable.get("sortedBy").dir.toString().replace("yui-dt-", "");
+               //look up column
+               for(i=0;i<myColumnDefs.length;i++)
+               {
+                       if (myColumnDefs[i].key == 
myDataTable.get("sortedBy").key.toString())
+                       {
+                               array_result[1] = myColumnDefs[i].source
+                               break;
+                       }
+               }
+               return array_result;
+       }
+//----------------------------------------------------------------------------------------
+
+       CreateLoading();
+       eval("var path_values = "+base_java_url+"");
+
+       this.execute_ds();

Added: people/sigurdne/modules/property/trunk/js/yahoo/property2.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/property2.js                
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/property2.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,627 @@
+       var myDataSource,myDataTable, myContextMenu,tableYUI,values_ds;
+
+/********************************************************************************/
+
+       this.getSumPerPage = function(name_column,round,paginator,datatable)
+       {
+               begin = end = 0;
+               if( (paginator.getPageRecords()[1] - 
paginator.getPageRecords()[0] + 1 ) == datatable.getRecordSet().getLength() )
+               {
+                       begin   = 0;
+                       end             = paginator.getPageRecords()[1] - 
paginator.getPageRecords()[0];
+               }
+               else
+               {
+                       begin   = paginator.getPageRecords()[0];
+                       end             = paginator.getPageRecords()[1];
+               }
+
+               tmp_sum = 0;
+               for(i = begin; i <= end; i++)
+               {
+                       tmp_sum = tmp_sum + 
parseFloat(datatable.getRecordSet().getRecords(0)[i].getData(name_column));
+               }
+
+               return tmp_sum = YAHOO.util.Number.format(tmp_sum, 
{decimalPlaces:round, decimalSeparator:",", thousandsSeparator:" "});
+       }
+
+/********************************************************************************/
+
+       this.td_empty = function(colspan)
+       {
+               newTD = document.createElement('td');
+               newTD.colSpan = colspan;
+               newTD.style.borderTop="1px solid #000000";
+               newTD.appendChild(document.createTextNode(''));
+               newTR.appendChild(newTD);
+       }
+
+/********************************************************************************/
+       this.GetMenuContext = function(data)
+       {
+               var opts = new Array();
+               var p=0;
+               for(var k =0; k < data[0].permission.length; k ++)
+               {
+                       opts[p]=[{text: data[0].permission[k].text}];
+                       p++;
+               }
+               return opts;
+   }
+
+/********************************************************************************/
+       function substr_count( haystack, needle, offset, length )
+       {
+               var pos = 0, cnt = 0;
+
+               haystack += '';
+               needle += '';
+               if(isNaN(offset)) offset = 0;
+               if(isNaN(length)) length = 0;
+               offset--;
+
+               while( (offset = haystack.indexOf(needle, offset+1)) != -1 )
+               {
+                       if(length > 0 && (offset+needle.length) > length)
+                       {
+                               return false;
+                       } else
+                       {
+                               cnt++;
+                       }
+               }
+               return cnt;
+       }
+
+/********************************************************************************/
+       this.html_entity_decode = function(string)
+       {
+               var histogram = {}, histogram_r = {}, code = 0;
+               var entity = chr = '';
+
+               histogram['34'] = 'quot';
+               histogram['38'] = 'amp';
+               histogram['60'] = 'lt';
+               histogram['62'] = 'gt';
+               histogram['160'] = 'nbsp';
+               histogram['161'] = 'iexcl';
+               histogram['162'] = 'cent';
+               histogram['163'] = 'pound';
+               histogram['164'] = 'curren';
+               histogram['165'] = 'yen';
+               histogram['166'] = 'brvbar';
+               histogram['167'] = 'sect';
+               histogram['168'] = 'uml';
+               histogram['169'] = 'copy';
+               histogram['170'] = 'ordf';
+               histogram['171'] = 'laquo';
+               histogram['172'] = 'not';
+               histogram['173'] = 'shy';
+               histogram['174'] = 'reg';
+               histogram['175'] = 'macr';
+               histogram['176'] = 'deg';
+               histogram['177'] = 'plusmn';
+               histogram['178'] = 'sup2';
+               histogram['179'] = 'sup3';
+               histogram['180'] = 'acute';
+               histogram['181'] = 'micro';
+               histogram['182'] = 'para';
+               histogram['183'] = 'middot';
+               histogram['184'] = 'cedil';
+               histogram['185'] = 'sup1';
+               histogram['186'] = 'ordm';
+               histogram['187'] = 'raquo';
+               histogram['188'] = 'frac14';
+               histogram['189'] = 'frac12';
+               histogram['190'] = 'frac34';
+               histogram['191'] = 'iquest';
+               histogram['192'] = 'Agrave';
+               histogram['193'] = 'Aacute';
+               histogram['194'] = 'Acirc';
+               histogram['195'] = 'Atilde';
+               histogram['196'] = 'Auml';
+               histogram['197'] = 'Aring';
+               histogram['198'] = 'AElig';
+               histogram['199'] = 'Ccedil';
+               histogram['200'] = 'Egrave';
+               histogram['201'] = 'Eacute';
+               histogram['202'] = 'Ecirc';
+               histogram['203'] = 'Euml';
+               histogram['204'] = 'Igrave';
+               histogram['205'] = 'Iacute';
+               histogram['206'] = 'Icirc';
+               histogram['207'] = 'Iuml';
+               histogram['208'] = 'ETH';
+               histogram['209'] = 'Ntilde';
+               histogram['210'] = 'Ograve';
+               histogram['211'] = 'Oacute';
+               histogram['212'] = 'Ocirc';
+               histogram['213'] = 'Otilde';
+               histogram['214'] = 'Ouml';
+               histogram['215'] = 'times';
+               histogram['216'] = 'Oslash';
+               histogram['217'] = 'Ugrave';
+               histogram['218'] = 'Uacute';
+               histogram['219'] = 'Ucirc';
+               histogram['220'] = 'Uuml';
+               histogram['221'] = 'Yacute';
+               histogram['222'] = 'THORN';
+               histogram['223'] = 'szlig';
+               histogram['224'] = 'agrave';
+               histogram['225'] = 'aacute';
+               histogram['226'] = 'acirc';
+               histogram['227'] = 'atilde';
+               histogram['228'] = 'auml';
+               histogram['229'] = 'aring';
+               histogram['230'] = 'aelig';
+               histogram['231'] = 'ccedil';
+               histogram['232'] = 'egrave';
+               histogram['233'] = 'eacute';
+               histogram['234'] = 'ecirc';
+               histogram['235'] = 'euml';
+               histogram['236'] = 'igrave';
+               histogram['237'] = 'iacute';
+               histogram['238'] = 'icirc';
+               histogram['239'] = 'iuml';
+               histogram['240'] = 'eth';
+               histogram['241'] = 'ntilde';
+               histogram['242'] = 'ograve';
+               histogram['243'] = 'oacute';
+               histogram['244'] = 'ocirc';
+               histogram['245'] = 'otilde';
+               histogram['246'] = 'ouml';
+               histogram['247'] = 'divide';
+               histogram['248'] = 'oslash';
+               histogram['249'] = 'ugrave';
+               histogram['250'] = 'uacute';
+               histogram['251'] = 'ucirc';
+               histogram['252'] = 'uuml';
+               histogram['253'] = 'yacute';
+               histogram['254'] = 'thorn';
+               histogram['255'] = 'yuml';
+
+               // Reverse table. Cause for maintainability purposes, the 
histogram is
+               // identical to the one in htmlentities.
+               for (code in histogram) {
+                       entity = histogram[code];
+                       histogram_r[entity] = code;
+               }
+
+               return (string+'').replace(/(\&([a-zA-Z]+)\;)/g, function(full, 
m1, m2){
+                       if (m2 in histogram_r) {
+                               return String.fromCharCode(histogram_r[m2]);
+                       } else {
+                               return m2;
+                       }
+               });
+}
+
+
+/********************************************************************************/
+
+       this.onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable)
+       {
+               var task = p_aArgs[1];
+               var num = datatable.length;
+
+
+
+               if(task)
+               {
+                       for(y=0;y<num;y++)
+                       {
+                               var elRow = 
p_myDataTable.getTrEl(this.contextEventTarget);
+
+                               if(elRow)
+                               {
+                                       var oRecord = 
p_myDataTable.getRecord(elRow);
+
+                                       if(datatable[y][0].permission!='')
+                                       {
+                                               var url = 
datatable[y][0].permission[task.groupIndex].action;
+                                               var sUrl = "";
+                                               var vars2 = "";
+
+                                               
if(datatable[y][0].permission[task.groupIndex].parameters!=null)
+                                               {
+                                                       for(f=0; 
f<datatable[y][0].permission[task.groupIndex].parameters.parameter.length; f++)
+                                                       {
+                                                               param_name = 
datatable[y][0].permission[task.groupIndex].parameters.parameter[f].name;
+                                                               param_source = 
datatable[y][0].permission[task.groupIndex].parameters.parameter[f].source;
+                                                               
if(typeof(datatable[y][0].permission[task.groupIndex].parameters.parameter[f].ready)!='undefined')
+                                                               {
+                                                                       vars2 = 
vars2 + "&"+param_name+"=" + param_source;
+                                                               }
+                                                               else
+                                                               {
+                                                                       vars2 = 
vars2 + "&"+param_name+"=" + oRecord.getData(param_source);
+                                                               }
+                                                       }
+                                                       sUrl = url + vars2;
+                                               }
+
+                                               
if(datatable[y][0].permission[task.groupIndex].parameters.parameter.length > 0)
+                                               {
+                                                       //nothing
+                                               }
+                                               else //for New
+                                               {
+                                                       sUrl = url;
+                                               }
+                                               //Convert all HTML entities to 
their applicable characters
+                                               sUrl = html_entity_decode(sUrl);
+
+                                               // look for the word "DELETE" 
in URL
+                                               
if(substr_count(sUrl,'delete')>0)
+                                               {
+                                                       confirm_msg = 
datatable[y][0].permission[task.groupIndex].confirm_msg;
+                                                       if(confirm(confirm_msg))
+                                                       {
+                                                               sUrl = sUrl + 
"&confirm=yes&phpgw_return_as=json";
+                                                               
delete_record(sUrl,p_myDataTable);
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       
if(substr_count(sUrl,'target=_blank')>0)
+                                                       {
+                                                               
window.open(sUrl,'_blank');
+                                                       }
+                                                       else
+                                                       {
+                                                               
window.open(sUrl,'_self');
+                                                       }
+                                               }
+                                       }
+
+                                       }
+
+
+
+                       }
+
+
+               }
+
+       }
+
+/********************************************************************************
+ *
+ */
+       this.delete_record = function(sUrl,datatable)
+       {
+               var callback =  {       success: function(o){
+                                                                       
eval("values_ds ="+o.responseText);
+                                                                       
if(values_ds=="")
+                                                                       {
+                                                                               
update_datatable(datatable);
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
eval("values_ds ="+values_ds);
+                                                                               
update_datatable(datatable);
+                                                                       }
+                                               },
+                                                       failure: 
function(o){window.alert('Server or your connection is dead.')},
+                                                       timeout: 10000
+                                               };
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+
+       }
+
+
+ 
/********************************************************************************/
+
+       this.td_sum = function(sum)
+       {
+               newTD = document.createElement('td');
+               newTD.colSpan = 1;
+               newTD.style.borderTop="1px solid #000000";
+               newTD.style.fontWeight = 'bolder';
+               newTD.style.textAlign = 'right';
+               newTD.style.paddingRight = '0.8em';
+               newTD.appendChild(document.createTextNode(sum));
+               newTR.appendChild(newTD);
+       }
+
+ 
/********************************************************************************/
+
+       this.init_datatable = function(data,container,pager,myColumnDefs,num)
+       {
+               myDataSource = new YAHOO.util.DataSource(data[0]["values"]);
+        myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
+
+        fields = new Array();
+               for(i=0; i < myColumnDefs.length;i++)
+               {
+                       fields[i] = myColumnDefs[i].key;
+               }
+
+               myDataSource.responseSchema =
+               {
+                       fields          : fields
+               };
+
+               if(data[0]["is_paginator"]==1)
+               {
+
+                       myPaginatorConfig = {
+                                                                       
containers                      : pager,
+                                                                       
totalRecords            : data[0]["total_records"],
+                                                                       
pageLinks                       : 10,
+                                                                       
rowsPerPage                     : 10
+                                                               }
+
+                       eval("myPaginator_"+num+" = new 
YAHOO.widget.Paginator(myPaginatorConfig)");
+
+                       myTableConfig = { paginator     : 
eval("myPaginator_"+num)};
+                       eval("myDataTable_" + num + " = new 
YAHOO.widget.DataTable(container, myColumnDefs, myDataSource, myTableConfig)");
+               }
+               else
+               {
+                       eval("myDataTable_" + num + " = new 
YAHOO.widget.DataTable(container, myColumnDefs, myDataSource)");
+               }
+
+               eval("myDataTable_" + num).subscribe("renderEvent", function(){
+                       myParticularRenderEvent(num);
+               });
+
+               eval("myDataTable_" + num).subscribe("rowMouseoverEvent", 
eval("myDataTable_" + num).onEventHighlightRow);
+               eval("myDataTable_" + num).subscribe("rowMouseoutEvent", 
eval("myDataTable_" + num).onEventUnhighlightRow);
+
+               if(data[0]["permission"])
+               {
+                       var myContextMenu = new 
YAHOO.widget.ContextMenu("mycontextmenu", {trigger:eval("myDataTable_" + 
num).getTbodyEl()});
+               myContextMenu.addItems(GetMenuContext(data));
+               // Render the ContextMenu instance to the parent container of 
the DataTable
+               myContextMenu.render("contextmenu_" + num);
+
+               myContextMenu.subscribe("click", onContextMenuClick, 
eval("myDataTable_" + num));
+               }
+       }
+
+
+ 
/********************************************************************************
+ *
+ */
+       CreateRowChecked = function(Class)
+       {
+               newTD = document.createElement('td');
+               newTD.colSpan = 1;
+               newTD.style.borderTop="1px solid #000000";
+               //create the anchor node
+               myA=document.createElement("A");
+               url = "javascript:check_all(\""+Class+"\")";  //particular 
function in each JS
+               myA.setAttribute("href",url);
+               //create the image node
+               url = "property/templates/portico/images/check.png";
+               myImg=document.createElement("IMG");
+               myImg.setAttribute("src",url);
+               myImg.setAttribute("width","16");
+               myImg.setAttribute("height","16");
+               myImg.setAttribute("border","0");
+               myImg.setAttribute("alt","Select All");
+               // Appends the image node to the anchor
+               myA.appendChild(myImg);
+               // Appends myA to mydiv
+               mydiv=document.createElement("div");
+               mydiv.setAttribute("align","center");
+               mydiv.appendChild(myA);
+               // Appends mydiv to newTD
+               newTD.appendChild(mydiv);
+               //Add TD to TR
+               newTR.appendChild(newTD);
+       }
+
+
+/********************************************************************************/
+
+       this.init_buttons = function(div,j)
+       {
+               for(p=0; p<myButtons[j].length; p++)
+               {
+                       //buttons
+                       if(myButtons[j][p].type == "buttons")
+                       {
+                               var config = {id: myButtons[j][p].id, type: 
myButtons[j][p].type, label: myButtons[j][p].label, container: div, value: 
myButtons[j][p].value}
+                               botton_tmp = new YAHOO.widget.Button(config);
+                               botton_tmp.on("click", 
eval(myButtons[j][p].funct));
+                               eval("Button_"+j+"_"+p+" = botton_tmp");
+                       }
+                       //filters
+                       else if(myButtons[j][p].type == "menu")
+                       {
+                               var config = {name: myButtons[j][p].id,  type: 
myButtons[j][p].type, label: myButtons[j][p].label, container: div, menu: 
myButtons[j][p].value, menumaxheight : 300}
+                               botton_tmp = new YAHOO.widget.Button(config);
+                               eval("Button_"+j+"_"+p+" = botton_tmp");
+                       }
+                       //input-text
+                       else if(myButtons[j][p].type == "inputText")
+                       {
+                               txt = document.createElement('input');
+                               txt.setAttribute("type",myButtons[j][p].type);
+                               txt.setAttribute("name",myButtons[j][p].id);
+                               txt.setAttribute("id",myButtons[j][p].id);
+                               txt.setAttribute("size",myButtons[j][p].size);
+                               
txt.setAttribute("class",myButtons[j][p].classname);
+
+                               div.appendChild(txt);
+                       }
+                       // texto
+                       else if(myButtons[j][p].type == "text")
+                       {
+                               
//div.appendChild(document.createTextNode(myButtons[j][p].label));
+
+                               sp = document.createElement("span");
+                               sp.className =myButtons[j][p].classname;
+                               sp.innerHTML = myButtons[j][p].label;
+                               div.appendChild(sp);
+                       }
+
+
+                       if(myButtons[j][p].type == "menu" || 
myButtons[j][p].type == "buttons")
+                       {
+                               //creating respective hidden
+                               hd = document.createElement('input');
+                               hd.setAttribute("type","hidden");
+                               //preposition "HD_"+id
+                               hd.setAttribute("id","hd_"+myButtons[j][p].id);
+                               
hd.setAttribute("class",myButtons[j][p].classname);
+                               hd.setAttribute("name",myButtons[j][p].id);
+                               //initial value for respective hidden
+                               
hd.setAttribute("value",myButtons[j][p].value_hidden);
+                               div.appendChild(hd);
+                       }
+               }
+       }
+
+/********************************************************************************/
+       this.update_datatable = function(datatable)
+       {
+               //delete records
+               var length = datatable.getRecordSet().getLength();
+
+               if(length > 0)
+               {
+                       datatable.deleteRows(0,length);
+               }
+               //add records
+               for(i=0;i<values_ds.length;i++)
+               {
+                       datatable.addRow(values_ds[i]);
+               }
+       }
+ 
/********************************************************************************/
+       this.td_empty = function(colspan)
+       {
+               newTD = document.createElement('td');
+               newTD.colSpan = colspan;
+               newTD.style.borderTop="1px solid #000000";
+               newTD.appendChild(document.createTextNode(''));
+               newTR.appendChild(newTD);
+       }
+/********************************************************************************/
+
+       this.execute_async = function(datatable)
+       {
+               try     {
+                               ds = phpGWLink('index.php',base_java_url,true);
+                               //ds = url;
+                       }
+               catch(e)
+                       {
+                               alert(e);
+                       }
+               var callback =
+               {
+                       success: function(o)
+                       {
+                               eval("values_ds ="+o.responseText);
+                               if(values_ds=="")
+                               {
+                                       update_datatable(datatable);
+                               }
+                               else
+                               {
+                                       eval("values_ds ="+values_ds);
+                                       update_datatable(datatable);
+                               }
+
+                       },
+                       failure: function(o) {window.alert('Server or your 
connection is dead.')},
+                       timeout: 10000,
+                       cache: false
+               }
+               try
+               {
+                       YAHOO.util.Connect.asyncRequest('POST',ds,callback);
+               }
+               catch(e_async)
+               {
+                  alert(e_async.message);
+               }
+       }
+
+/********************************************************************************/
+
+       this.deletes_quotes = function(array,field)
+       {
+               if ((typeof(array)!="undefined") && 
(typeof(array[field])!="undefined") )
+               {
+                       field_quotes = array[field];
+                       array[field] = eval(field_quotes);
+               }
+       }
+
+/********************************************************************************/
+
+       //delete quotes in field inside an array
+       for(i=0;i<myColumnDefs.length;i++)
+       {
+               for(j=0;j<myColumnDefs[i].length;j++)
+               {
+                       this.deletes_quotes(myColumnDefs[i][j],"formatter");
+               }
+       }
+
+       //if exist myButtons
+       if(typeof(myButtons)!="undefined")
+       {
+               //delete quotes in myButtons, field: "fn"
+               for(k=0;k<myButtons.length;k++)
+               {
+                       for(m=0;m<myButtons[k].length;m++)
+                       {
+                               if(myButtons[k][m]['type']=='menu')
+                               {
+                                       
for(p=0;p<myButtons[k][m]['value'].length;p++)
+                                       {
+                                               try
+                                                 {
+                                                       
this.deletes_quotes(myButtons[k][m]['value'][p]['onclick'],"fn");
+                                                 }
+                                               catch(err)
+                                                 {
+                                                       txt="There was an error 
on this page.\n\n";
+                                                       txt+="Error 
description: " + err.description + "\n\n";
+                                                       alert(txt);
+                                                 }
+                                       }
+                               }
+                       }
+               }
+       }
+
+
+
+
+
+
+
+       //for DataTables
+       for(j=0;j<datatable.length;j++)
+       {
+               if(YAHOO.util.Dom.inDocument("datatable-container_"+j))
+               {
+                       pager = YAHOO.util.Dom.get("paging_"+j);
+                       div   = YAHOO.util.Dom.get("datatable-container_"+j);
+                       
this.init_datatable(datatable[j],div,pager,myColumnDefs[j],j);
+               }
+       }
+
+       //if exist myButtons
+       if(typeof(myButtons)!="undefined")
+       {
+               for(j=0;j<myButtons.length;j++)
+               {
+                       if(YAHOO.util.Dom.inDocument("datatable-buttons_"+j))
+                       {
+                               div = 
YAHOO.util.Dom.get("datatable-buttons_"+j);
+                               this.init_buttons(div,j);
+                       }
+               }
+       }
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/request.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/request.edit.js             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/request.edit.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,59 @@
+var myDataSource,myDataTable, myContextMenu;
+var tableYUI;
+var  myPaginator_0,myPaginator_1,myPaginator_2;
+var  myDataTable_0,myDataTable_1,myDataTable_2;
+
+
+/********************************************************************************
+        *
+        */
+       this.addFooterDatatable = function(paginator,datatable)
+       {
+               //call getSumPerPage(name of column) in property.js
+               tmp_sum1 = getSumPerPage('budget',2,paginator,datatable);
+               tmp_sum2 = getSumPerPage('calculation',2,paginator,datatable);
+
+               if(typeof(tableYUI)=='undefined')
+               {
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+               }
+               else
+               {
+                       tableYUI.deleteTFoot();
+               }
+
+               //Create ROW
+               newTR = document.createElement('tr');
+
+               td_sum('Sum');
+               td_sum(tmp_sum1);
+               td_sum(tmp_sum2);
+               td_empty(3);
+
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+       }
+       
+/********************************************************************************/
     
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+       
+/********************************************************************************/
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       var loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/request.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/request.index.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/request.index.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,160 @@
+//--------------------------------------------------------
+// Declaration of request.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2;
+       var selectsButtons = [
+       {order:0, 
var_URL:'cat_id',name:'btn_cat_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'status_id',name:'btn_status_id',style:'districtbutton',dependiente:''},
+       {order:2, var_URL:'filter', 
name:'btn_user_id',style:'ownerIdbutton',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2, oNormalButton_3;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_export', funct:"onDownloadClick"},
+       {order:2, name:'btn_update', funct:"onUpdateProject"},
+       {order:3, name:'btn_new', funct:"onNewClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+           {order:0, name:'query',     id:'txt_query'}
+       ]
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'Download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+       var linktoolTips =
+       [
+           {name:'btn_priority_key', title:'Priority key', description:'To 
alter the Priority key'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values = {
+               date_search : 0 //if search has link "Data search"
+       };
+/****************************************************************************************/
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       path_values.currentPage = '';
+                       path_values.start = '';
+               }
+       }
+/****************************************************************************************/
+
+   this.onUpdateProject = function()
+   {
+               //get the last div in th form
+               var divs= YAHOO.util.Dom.getElementsByClassName('field');
+               var mydiv = divs[divs.length-1];
+
+               //remove all child of mydiv
+               if ( mydiv.hasChildNodes() )
+           while ( mydiv.childNodes.length >= 1 )
+           {
+               mydiv.removeChild( mydiv.firstChild );
+           }
+
+               // styles for dont show
+               mydiv.style.display = 'none';
+
+               var myclone = null;
+
+               //asign values for check buttons
+               checks_close_order = 
YAHOO.util.Dom.getElementsByClassName('close_order_tmp');
+               hiddens_close_order = 
YAHOO.util.Dom.getElementsByClassName('close_order');
+               for(i=0;i<checks_close_order.length;i++)
+               {
+                       if(checks_close_order[i].checked)
+                       {
+                               var b = new YAHOO.widget.Button('btn_update');
+                               b.set("disabled", true);                        
        
+                               hiddens_close_order[i].value = 
checks_close_order[i].value;
+                       }
+               }
+               
+               //get all controls of datatable
+               valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');         
+               //add all control to form
+               for(i=0;i<valuesForPHP.length;i++)
+               {
+                       myclone = valuesForPHP[i].cloneNode(true);
+                       if (myclone.value != '')
+                               mydiv.appendChild(myclone);
+               }
+
+               var path_update = new Array();
+               path_update["menuaction"] = "property.uiproject.edit";
+               path_update["id"] = path_values.project_id;
+
+               var sUrl = phpGWLink('index.php',path_update);
+
+               formObject = document.getElementsByTagName('form');
+               YAHOO.util.Connect.setForm(formObject[0]);
+
+               formObject[0].action = sUrl;
+               formObject[0].method = "post";
+               formObject[0].submit();
+
+   }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+ 
/****************************************************************************************/
+
+       this.myexecuteTEMP = function()
+       {
+                //Maintein actual page in paginator
+                path_values.currentPage = myPaginator.getCurrentPage();
+                path_values.start = myPaginator.getPageRecords()[0];
+                path_values.recordsReturned = values_ds.recordsReturned;
+                array_sort_order = getSortingANDColumn()
+                path_values.order = array_sort_order[1];
+                path_values.sort = array_sort_order[0];
+
+               execute_ds();
+
+       }
+
+
+
+
+/****************************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+       });
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/responsible.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/responsible.index.js        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/responsible.index.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,128 @@
+//--------------------------------------------------------
+// Declaration of responsible.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       //var oMenuButton_0;
+       var selectsButtons = [
+       {order:0, var_URL:'location',                   name:'btn_location',    
                style:'',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //focus initial
+                       oMenuButton_0.focus();
+                       
+                       if (path_values.location != '') 
+                       {
+                               
+                               for (i=0;i<array_options[0].length;i++)
+                               {
+                                       
+                                       if(array_options[0][i][0] == 
path_values.location)
+                                       {
+                                               oMenuButton_0.set("label", 
("<em>" + array_options[0][i][1] + "</em>"));
+                                               break;
+                                       }
+                               }
+                       }                       
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       // nothing
+               }
+       }
+
+/****************************************************************************************/
+       
+       this.delete_message = function()
+       {
+               var div_message = YAHOO.util.Dom.get("message");
+               if ( div_message.hasChildNodes() )
+               {
+                       while ( div_message.childNodes.length >= 1 )
+                   {
+                       div_message.removeChild( div_message.firstChild );
+                   }
+               }
+       }
+/****************************************************************************************/
+
+       this.create_message = function()
+       {
+               var div_message = YAHOO.util.Dom.get("message");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                        for(i=0; i<values_ds.message.length; i++)
+                        {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[i].msgbox_text);
+                                       oDiv.appendChild(txtNode);
+                                       
+                                       
if(window.values_ds.message[i].lang_msgbox_statustext=="Error")
+                                       {
+                                               oDiv.style.color = '#FF0000'; 
+                                       }
+                                       else
+                                       {
+                                               oDiv.style.color = '#009900'; 
+                                       }
+                                       oDiv.style.fontWeight = 'bold';
+                                       div_message.appendChild(oDiv);
+                        }
+                }
+                values_ds.message = null;
+       }
+       
+       this.myParticularRenderEvent = function()
+       {
+               delete_message();
+               create_message();
+               values_ds.message = null;
+       }       
+/****************************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/schedule.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/schedule.js                 
        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/schedule.js 2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1,113 @@
+colors = ['color1', 'color2', 'color3', 'color4', 'color5', 'color6'];
+colorMap = {};
+
+YAHOO.booking.link = function(label, link, max) {
+       if(max && label.length > max)
+               label = label.substr(label, max) + '...';
+       if(link)
+               return '<a href="' + link + '">' + label + '</a>';
+       else
+               return label;
+}
+
+YAHOO.booking.scheduleResourceColFormatter = function(elCell, oRecord, 
oColumn, text) {
+       if(text && oRecord.getData('resource_link')) {
+               elCell.innerHTML = '<a href="' + 
oRecord.getData('resource_link') + '">' + text + '</a>';
+       }
+       else if (text) {
+               elCell.innerHTML = text;
+       }
+}
+
+YAHOO.booking.frontendScheduleColorFormatter = function(elCell, oRecord, 
oColumn, booking) { 
+       if(booking) {
+               if(!colorMap[booking.name]) {
+                       colorMap[booking.name] = colors.length ? colors.shift() 
: 'color6';
+               }
+               var color = colorMap[booking.name];
+               YAHOO.util.Dom.addClass(elCell, color);
+               YAHOO.util.Dom.addClass(elCell, booking.type);
+               if(booking.type == 'booking') {
+                       var link = 
'index.php?menuaction=bookingfrontend.uibooking.edit&id=' + booking.id;
+               }
+               else if(booking.type == 'allocation') {
+                       var from_ = booking.date + ' ' + booking.from_;
+                       var to_ = booking.date + ' ' + booking.to_;
+                       var link = 
'index.php?menuaction=bookingfrontend.uibooking.add&allocation_id=' + 
booking.id + '&from_=' + from_ + '&to_=' + to_;
+               }
+               else
+                       var link = null;
+               elCell.innerHTML = YAHOO.booking.link(booking.name, link, 12);
+       }
+       else {
+               elCell.innerHTML = '...';
+       }
+};
+
+YAHOO.booking.bookingToHtml = function(booking) { 
+       if(booking.type == 'booking') {
+               var link = 'index.php?menuaction=booking.uibooking.edit&id=' + 
booking.id;
+       }
+       else if(booking.type == 'allocation') {
+               var link = 'index.php?menuaction=booking.uiallocation.edit&id=' 
+ booking.id;
+       }
+       else if(booking.type == 'event') {
+//             var link = 'index.php?menuaction=booking.uievent.edit&id=' + 
booking.id;
+               var link = booking.link;
+       }
+       else {
+               var link = null;
+       }
+
+       if(booking.exception == true)
+       {
+               booking.name = booking.lang_exception;
+       }
+       var html = YAHOO.booking.link(booking.name, link, 12);
+       if(booking.type == 'event' && booking.conflicts) {
+               for(var i=0; i<booking.conflicts.length;i++) {
+                       html += '<div class="conflict">conflicts with: ' + 
YAHOO.booking.bookingToHtml(booking.conflicts[i]) + '</div>';
+               }
+       }
+       return html;
+};
+
+YAHOO.booking.backendScheduleColorFormatter = function(elCell, oRecord, 
oColumn, booking) { 
+       if(booking) {
+               if(!colorMap[booking.name]) {
+                       colorMap[booking.name] = colors.length ? colors.shift() 
: 'color6';
+               }
+               var color = colorMap[booking.name];
+               YAHOO.util.Dom.addClass(elCell, color);
+               YAHOO.util.Dom.addClass(elCell, booking.type);
+               elCell.innerHTML = YAHOO.booking.bookingToHtml(booking);
+       }
+       else {
+               elCell.innerHTML = '...';
+       }
+};
+
+YAHOO.booking.scheduleColorFormatter = function(elCell, oRecord, oColumn, 
booking) { 
+       if(booking) {
+               if(!colorMap[booking.name]) {
+                       colorMap[booking.name] = colors.length ? colors.shift() 
: 'color6';
+               }
+               var color = colorMap[booking.name];
+               YAHOO.util.Dom.addClass(elCell, color);
+               elCell.innerHTML = YAHOO.booking.link(booking.name, null, 12);
+       }
+       else {
+               elCell.innerHTML = '...';
+       }
+};
+
+
+YAHOO.booking.scheduleRowFormatter = function(elTr, oRecord) { 
+       if (!oRecord.getData('resource')) {
+               YAHOO.util.Dom.addClass(elTr, 'free'); 
+       } 
+       if (oRecord.getData('time')) { 
+               YAHOO.util.Dom.addClass(elTr, 'time'); 
+       }
+       return true; 
+};

Added: people/sigurdne/modules/property/trunk/js/yahoo/template.hour.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/template.hour.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/template.hour.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,67 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+
+               //define SelectButton
+               var selectsButtons = [
+               ]
+
+               // define buttons
+               var oNormalButton_0,oNormalButton_1,oNormalButton_2;
+               var normalButtons = [
+                   {order:0, name:'btn_search',        funct:"onSearchClick"},
+                   {order:1, name:'btn_new',           funct:"onNewClick"},
+                   {order:2, name:'btn_done',          funct:"onDoneClick"}
+               ]
+
+               // define Link Buttons
+               var linktoolTips = [
+                ]
+
+           // define Text buttons
+           var textImput = [
+           {order:0, name:'query',     id:'txt_query'}
+           ]
+
+               var toolTips = [
+               ]
+
+               var config_values = {
+                       date_search     : 0,
+                       PanelLoading: 0
+               }
+
+               this.particular_setting = function()
+               {
+                       if(flag_particular_setting=='init')
+                       {
+                       }
+                       else if(flag_particular_setting=='update')
+                       {
+                       }
+               }
+               
+       /* 
****************************************************************************** 
*/
+               this.myParticularRenderEvent = function()
+               {
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+
+               }
+       /* 
****************************************************************************** 
*/
+               YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       //avoid render buttons html
+                       
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone", //module name; must be unique
+                               type: "js", //can be "js" or "css"
+                           fullpath: property_js //'property_js' have the path 
for property.js, is render in HTML
+                           });
+
+                       loader.require("anyone");
+
+                       //Insert JSON utility on the page
+                   loader.insert();
+               });
\ No newline at end of file

Added: people/sigurdne/modules/property/trunk/js/yahoo/template.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/template.index.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/template.index.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,126 @@
+//--------------------------------------------------------
+// Declaration of template.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [
+       {order:0, 
var_URL:'chapter_id',name:'btn_chap_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'filter',name:'btn_user_id',style:'districtbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2, oNormalButton_3;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_done',      funct:"onNewDoneClick"},
+       {order:3, name:'btn_select', funct:"onAddTemplate"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query', id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //focus initial
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+       
+ 
/****************************************************************************************/
+ 
+       this.onNewDoneClick = function()
+       {
+               var path_update = new Array();
+               path_update["menuaction"] = "property.uiwo_hour.index";
+               path_update["workorder_id"] = path_values.workorder_id;
+               
+               window.open(phpGWLink('index.php',path_update),'_self');
+       }
+/****************************************************************************************/
+       
+    this.onAddTemplate = function()
+    {
+               //get all controls of datatable
+       
+               var myclone = null;
+               var template_id = "";
+               //add all control to form
+               
+               for(i=0; i<document.getElementsByName('rad_template').length; 
i++)
+               {
+                       myclone = document.getElementsByName('rad_template')[i];
+                       if (myclone.checked == true) {
+                               var b = new YAHOO.widget.Button('btn_select');
+                               b.set("disabled", true);
+                               template_id = myclone.value;
+                               break;
+                       }
+               }
+               
+               var path_update = new Array();
+               path_update["menuaction"] = "property.uiwo_hour.template";
+               document.getElementById("workorder_id").value  = 
path_values.workorder_id;
+               document.getElementById("template_id").value  = template_id;
+
+               var sUrl = phpGWLink('index.php',path_update);
+               formObject = document.getElementsByTagName('form');
+               YAHOO.util.Connect.setForm(formObject[0]);
+
+               if(template_id != "") 
+               {
+                       formObject[0].action = sUrl;
+                       formObject[0].method = "post";
+                       formObject[0].submit();
+               }
+
+    }
+
+/****************************************************************************************/
+    
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/tenant_claim.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/tenant_claim.index.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/tenant_claim.index.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,70 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1;
+       var selectsButtons = [
+       {order:0, 
var_URL:'cat_id',name:'btn_cat_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'status',name:'btn_status_id',style:'districtbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/tts.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/tts.index.js                
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/tts.index.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,112 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3;
+       var selectsButtons = [
+       {order:0, 
var_URL:'cat_id',name:'btn_cat_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'district_id',name:'btn_district_id',style:'districtbutton',dependiente:''},
+       {order:2, 
var_URL:'status_id',name:'btn_status_id',style:'partOFTownbutton',dependiente:''},
+       {order:3, var_URL:'user_id', 
name:'btn_user_id',style:'ownerIdbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_export', funct:"onDownloadClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       var toolTips =
+       [
+               {name:'status', title:'Status', 
description:'',ColumnDescription:'status'},
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+       var linktoolTips =
+       [
+               {name:'btn_data_search', title:'Data search', 
description:'Narrow the search dates'}
+       ]
+
+       var config_values =
+       {
+               date_search : 1 //if search has link "Data search"
+       }
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //category
+                       index = 
locate_in_array_options(0,"value",path_values.cat_id);
+                       if(index)
+                       {
+                               oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+                       }
+                       //district
+                       index = 
locate_in_array_options(1,"value",path_values.district_id);
+                       if(index)
+                       {
+                               oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       }
+                       //status
+                       index = 
locate_in_array_options(2,"value",path_values.status_id);
+                       if(index)
+                       {
+                               oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
+                       }
+                       //user
+                       index = 
locate_in_array_options(3,"value",path_values.user_id);
+                       if(index)
+                       {
+                               oMenuButton_3.set("label", ("<em>" + 
array_options[3][index][1] + "</em>"));
+                       }
+//                     oMenuButton_0.focus();
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+
+               }
+       }
+
+
+
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //nothing
+       }
+
+/****************************************************************************************/
+
+//----------------------------------------------------------
+       //YAHOO.util.Event.addListener(window, "load", function()
+       YAHOO.util.Event.onDOMReady(function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+       });
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/tts.index.simple.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/tts.index.simple.js         
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/tts.index.simple.js 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,84 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0;
+       var selectsButtons = [
+       {order:0, 
var_URL:'status_id',name:'btn_status_id',style:'partOFTownbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_export', funct:"onDownloadClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       var toolTips =
+       [
+               {name:'status', title:'Status', 
description:'',ColumnDescription:'status'},
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+       var config_values =
+       {
+               date_search : 1 //if search has link "Data search"
+       }
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //status
+                       index = 
locate_in_array_options(0,"value",path_values.status_id);
+                       if(index)
+                       {
+                               oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+                       }
+//                     oMenuButton_0.focus();
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+
+               }
+       }
+
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //nothing
+       }
+
+/****************************************************************************************/
+
+//----------------------------------------------------------
+       //YAHOO.util.Event.addListener(window, "load", function()
+       YAHOO.util.Event.onDOMReady(function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+       });
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/tts.view.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/tts.view.js                 
        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/tts.view.js 2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1,30 @@
+var  myPaginator_0, myDataTable_0
+var  myPaginator_1, myDataTable_1;
+
+/********************************************************************************/
+this.myParticularRenderEvent = function()
+{
+}
+
+/********************************************************************************/
     
+var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+{
+       elCell.innerHTML = "<center>"+oData+"</center>";
+}
+
+ 
/********************************************************************************/
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/ui_agreement.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/ui_agreement.edit.js        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/ui_agreement.edit.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,130 @@
+var  myPaginator_0, myDataTable_0;
+var Button_0_0, Button_0_1, Button_0_2;
+var Button_1_0,Button_1_1,Button_1_2,Button_1_3,Button_1_4;
+
+/********************************************************************************/
+       this.cleanValuesHiddenActionsButtons=function()
+       {
+               array_buttons = 
YAHOO.util.Dom.getElementsByClassName('actionButton');
+               for ( var i in array_buttons )
+               {
+                       array_buttons[i].setAttribute("value",""); 
+               }
+       }
+/********************************************************************************/
+       this.onActionsClick=function()
+       {
+               flag = false;
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+               
+               //validate ckecks true
+               array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }               
+               
+               if(flag)
+               {
+                       //asign value to hidden 
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+                       
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[1]);//second form
+                       execute_async(myDataTable_0);                   
+               }
+       }
+/********************************************************************************/
+       this.onAddClick=function()
+       {
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+               
+               //validate date drop-down in hidden buttons
+               array_buttons = 
YAHOO.util.Dom.getElementsByClassName('actionsFilter');
+               for ( var i in array_buttons )
+               {
+                       if(array_buttons[i].value ==0 || array_buttons[i].value 
=="" )
+                       {
+                               return;                         
+                       }
+               }
+               //asign value to hidden 
+               YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+               
+               formObject = document.body.getElementsByTagName('form');
+               YAHOO.util.Connect.setForm(formObject[1]);//second form
+               execute_async(myDataTable_0);   
+               
+               //come back label to bottons_1_*
+               Button_1_0.set("label", myButtons[1][0].label);
+               Button_1_1.set("label",myButtons[1][1].label);
+               Button_1_2.set("label", myButtons[1][2].label);
+               Button_1_3.set("label", myButtons[1][3].label);
+               
+               //clean hidden filter
+               for ( var i in array_buttons )
+               {
+                       array_buttons[i].value = "";
+               }
+               
+       }
+       
+/********************************************************************************/
+       this.onDateClick=function(p_sType, p_aArgs, p_oItem) 
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.opt+"");
+               control.set("value", p_oItem.opt);
+               
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.opt;
+               
+       }
+/********************************************************************************/
+       this.onUserClick=function(p_sType, p_aArgs, p_oItem) 
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.name+"");
+               control.set("value", p_oItem.id);
+               
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.id;               
+       }
+       
+/********************************************************************************/
+       this.myParticularRenderEvent = function()
+       {
+       }
+/********************************************************************************/
+       var myFormatterCheck = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks\"  value=\"\" 
name=\"values[alarm]["+oRecord.getData('alarm_id')+"]\"/></center>";
+       }
+/********************************************************************************/
     
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+ 
/********************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone",
+                       type: "js",
+                   fullpath: property_js
+                   });
+       
+               loader.require("anyone");
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/uiasync.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/uiasync.index.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/uiasync.index.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,74 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       // define buttons
+       var oNormalButton_0;
+       var selectsButtons = [];
+
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "admin.uimainscreen.mainscreen"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+               document.getElementById('txt_query').focus();
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,243 @@
+var  myPaginator_0, myDataTable_0;
+var Button_0_0, Button_0_1, Button_0_2;
+var Button_1_0,Button_1_1,Button_1_2,Button_1_3,Button_1_4;
+var tableYUI;
+
+/********************************************************************************/
+       this.cleanValuesHiddenActionsButtons=function()
+       {
+               YAHOO.util.Dom.get('hd_values[enable_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_values[disable_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_values[delete_alarm]').value = '';
+               YAHOO.util.Dom.get('hd_values[add_alarm]').value = '';
+       }
+/********************************************************************************/
     
+       this.validateValuesHiddenFilterButtons=function()
+       {
+               if( (YAHOO.util.Dom.get('hd_values[time][days]').value == 0) || 
(YAHOO.util.Dom.get('hd_values[time][hours]').value == 0) || 
(YAHOO.util.Dom.get('hd_values[time][mins]').value == 0) )
+               {
+                       exit;
+               }
+       }
+/********************************************************************************/
     
+       this.cleanValuesHiddenFilterButtons=function()
+       {
+               YAHOO.util.Dom.get('hd_values[time][days]').value = 
myButtons[1][0].value_hidden;
+               YAHOO.util.Dom.get('hd_values[time][hours]').value = 
myButtons[1][1].value_hidden;
+               YAHOO.util.Dom.get('hd_values[time][mins]').value = 
myButtons[1][2].value_hidden;
+               YAHOO.util.Dom.get('hd_values[user_id]').value = 
myButtons[1][3].value_hidden;
+       }
+/********************************************************************************/
+       this.onActionsClick=function()
+       {
+               flag = false;
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+
+               //validate ckecks true
+               array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }
+
+               if(flag)
+               {
+                       //asign value to hidden
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[1]);//second form
+                       execute_async(myDataTable_0);
+               }
+       }
+/********************************************************************************/
+       this.onAddClick=function()
+       {
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+
+               //validate date drop-down in hidden buttons
+               validateValuesHiddenFilterButtons();
+               
+               //asign value to hidden
+               YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+               formObject = document.body.getElementsByTagName('form');
+               YAHOO.util.Connect.setForm(formObject[1]);//second form
+               execute_async(myDataTable_0);
+
+               //come back initial labels to bottons_1_*
+               Button_1_0.set("label", myButtons[1][0].label);
+               Button_1_1.set("label",myButtons[1][1].label);
+               Button_1_2.set("label", myButtons[1][2].label);
+               Button_1_3.set("label", myButtons[1][3].label);
+
+               //set up initial values to hidden filter buttons
+               cleanValuesHiddenFilterButtons();
+
+       }
+
+/********************************************************************************/
+       this.onDateClick=function(p_sType, p_aArgs, p_oItem)
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.opt+"");
+               control.set("value", p_oItem.opt);
+
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.opt;
+
+       }
+/********************************************************************************/
+       this.onUserClick=function(p_sType, p_aArgs, p_oItem)
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.name+"");
+               control.set("value", p_oItem.id);
+
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.id;
+       }
+
+/********************************************************************************/
+       var myFormatterCheck = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks\"  value=\"\" 
name=\"values[alarm]["+oRecord.getData('alarm_id')+"]\"/></center>";
+       }
+/********************************************************************************/
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+//*************************
+var  myPaginator_1,myDataTable_1;
+var Button_2_0;
+
+
+/********************************************************************************/
+       this.onUpdateClick=function()
+       {
+               flag = false;
+               //clean hidden buttons actions
+               //cleanValuesHiddenActionsButtons();
+
+               //validate ckecks true
+               array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks_update');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }
+
+               if(flag)
+               {
+                       //asign value to hidden
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[3]);
+                       execute_async(myDataTable_1);
+               }
+
+       }
+
+/********************************************************************************/
+var myFormatterCheckUpdate = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks_update\"  value="+oRecord.getData('cost')+" 
name=\"values[select]["+oRecord.getData('item_id')+"]\"/></center> <input 
type=\"hidden\" name=\"values[item_id]["+oRecord.getData('item_id')+"]\" 
value="+oRecord.getData('item_id')+" /> <input type=\"hidden\" 
value="+oRecord.getData('index_count')+" 
name=\"values[id]["+oRecord.getData('item_id')+"]\" />";
+       }
+
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+               if(num==1)
+               {
+                       //tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[1].parentNode;
+                       tableObject = 
document.body.getElementsByTagName('table');
+                       for (x=0; x<tableObject.length; x++)
+                       {
+                               if (tableObject[x].parentNode.id == 
'datatable-container_1')
+                                       { tableYUI = tableObject[x]; }
+                       }
+                       tableYUI.setAttribute("id","tableYUI");
+                       tableYUI.deleteTFoot();
+                       YAHOO.util.Dom.get("values_date").value = "";
+                       YAHOO.util.Dom.get("values[new_index]").value = "";
+                       addFooterDatatable();
+               }
+       }
+
+/********************************************************************************
+*
+*/
+       this.addFooterDatatable = function()
+       {
+               //Create ROW
+               newTR = document.createElement('tr');
+               //RowChecked
+               td_empty(td_count);
+               CreateRowChecked("mychecks_update");
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR.cloneNode(true));
+       }
+
+/********************************************************************************
+*
+*/
+       check_all = function(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                               //for class=transfer_idClass, they have to be 
interchanged
+                               if(myclass=="mychecks_update")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+
+/********************************************************************************/
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       var loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: 
people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit_item.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit_item.js  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/uis_agreement.edit_item.js  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,251 @@
+var  myPaginator_0, myDataTable_0;
+var Button_0_0, Button_0_1, Button_0_2;
+var Button_1_0,Button_1_1,Button_1_2,Button_1_3,Button_1_4;
+var tableYUI;
+
+/********************************************************************************/
+       this.cleanValuesHiddenActionsButtons=function()
+       {
+               array_buttons = 
YAHOO.util.Dom.getElementsByClassName('actionButton');
+               for ( var i in array_buttons )
+               {
+                       array_buttons[i].setAttribute("value","");
+               }
+       }
+/********************************************************************************/
+       this.onActionsClick=function()
+       {
+               flag = false;
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+
+               //validate ckecks true
+               array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }
+
+               if(flag)
+               {
+                       //asign value to hidden
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[1]);//second form
+                       execute_async(myDataTable_0);
+               }
+       }
+/********************************************************************************/
+       this.onDeleteClick=function()
+       {
+               var path_update = new Array();
+               path_update["menuaction"] = base_java_url.menuaction;
+               path_update["s_agreement_id"] = base_java_url.s_agreement_id;
+               path_update["id"] = base_java_url.id;
+               path_update["delete_last"] = 1;
+
+               var sUrl = phpGWLink('index.php',path_update);
+
+               var callback =  {       success: function(o){
+
+                       execute_async(myDataTable_0);
+                       },
+                       failure: function(o){window.alert('Server or your 
connection is death.')},
+                       timeout: 10000
+               };
+               var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
callback);
+       }
+/********************************************************************************/
+       this.onAddClick=function()
+       {
+               //clean hidden buttons actions
+               cleanValuesHiddenActionsButtons();
+
+               //validate date drop-down in hidden buttons
+               array_buttons = 
YAHOO.util.Dom.getElementsByClassName('actionsFilter');
+               for ( var i in array_buttons )
+               {
+                       if(array_buttons[i].value ==0 || array_buttons[i].value 
=="" )
+                       {
+                               return;
+                       }
+               }
+               //asign value to hidden
+               YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+               formObject = document.body.getElementsByTagName('form');
+               YAHOO.util.Connect.setForm(formObject[1]);//second form
+               execute_async(myDataTable_0);
+
+               //come back label to bottons_1_*
+               /*Button_1_0.set("label", myButtons[1][0].label);
+               Button_1_1.set("label",myButtons[1][1].label);
+               Button_1_2.set("label", myButtons[1][2].label);
+               Button_1_3.set("label", myButtons[1][3].label);*/
+
+               //clean hidden filter
+               for ( var i in array_buttons )
+               {
+                       array_buttons[i].value = "";
+               }
+
+       }
+
+/********************************************************************************/
+       this.onDateClick=function(p_sType, p_aArgs, p_oItem)
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.opt+"");
+               control.set("value", p_oItem.opt);
+
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.opt;
+
+       }
+/********************************************************************************/
+       this.onUserClick=function(p_sType, p_aArgs, p_oItem)
+       {
+               //update label atributte
+               eval ("var control  = Button_"+p_oItem.id_button)
+               control.set("label", ""+p_oItem.name+"");
+               control.set("value", p_oItem.id);
+
+               //assign value to hd associado
+               YAHOO.util.Dom.get("hd_"+p_oItem.hidden_name).value = 
p_oItem.id;
+       }
+
+/********************************************************************************/
+       var myFormatterCheck = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks\"  value=\"\" 
name=\"values[alarm]["+oRecord.getData('alarm_id')+"]\"/></center>";
+       }
+/********************************************************************************/
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+//*************************
+var  myPaginator_1,myDataTable_1;
+var Button_2_0;
+
+
+/********************************************************************************/
+       this.onUpdateClick=function()
+       {
+               //alert("ssss");return false;
+               flag = false;
+               //clean hidden buttons actions
+               //cleanValuesHiddenActionsButtons();
+
+               /*array_checks = 
YAHOO.util.Dom.getElementsByClassName('mychecks_update');
+               for ( var i in array_checks )
+               {
+                       if(array_checks[i].checked)
+                       {
+                               flag = true;
+                               break;
+                       }
+               }*/
+
+               //if(flag)
+               //{
+                       //asign value to hidden
+                       YAHOO.util.Dom.get("hd_"+this.get("id")).value = 
this.get("value");
+
+                       formObject = document.body.getElementsByTagName('form');
+                       YAHOO.util.Connect.setForm(formObject[0]);
+                       execute_async(myDataTable_0);
+               //}
+
+       }
+
+/********************************************************************************/
+var myFormatterCheckUpdate = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center><input type=\"checkbox\" 
class=\"mychecks_update\"  value="+oRecord.getData('cost')+" 
name=\"values[select]["+oRecord.getData('item_id')+"]\"/></center> <input 
type=\"hidden\" name=\"values[item_id]["+oRecord.getData('item_id')+"]\" 
value="+oRecord.getData('item_id')+" /> <input type=\"hidden\" 
value="+oRecord.getData('index_count')+" 
name=\"values[id]["+oRecord.getData('item_id')+"]\" />";
+       }
+
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+               /*if(num==1)
+               {
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[1].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+                       tableYUI.deleteTFoot();
+                       YAHOO.util.Dom.get("values_date").value = "";
+                       YAHOO.util.Dom.get("values[new_index]").value = "";
+                       addFooterDatatable();
+               }*/
+       }
+
+/********************************************************************************
+*
+*/
+       this.addFooterDatatable = function()
+       {
+               //Create ROW
+               newTR = document.createElement('tr');
+               //RowChecked
+               td_empty(12);
+               CreateRowChecked("mychecks_update");
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR.cloneNode(true));
+       }
+
+/********************************************************************************
+*
+*/
+       check_all = function(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                               //for class=transfer_idClass, they have to be 
interchanged
+                               if(myclass=="mychecks_update")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+
+/********************************************************************************/
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       var loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/uisagreement.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/uisagreement.index.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/uisagreement.index.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,76 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2;
+       var selectsButtons = [
+       {order:0, 
var_URL:'member_id',name:'btn_member_id',style:'categorybutton',dependiente:''},
+       {order:1, 
var_URL:'cat_id',name:'btn_cat_id',style:'districtbutton',dependiente:''},
+       {order:2, 
var_URL:'vendor_id',name:'btn_vendor_id',style:'partOFTownbutton',dependiente:''}
+       ];
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+       ]
+
+       var linktoolTips =
+       [
+               {name:'btn_columns', title:'Columns', description:'Choose 
columns'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0 //if search has link "Data search"
+       }
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //focus initial
+                       oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+       }
+
+
+//----------------------------------------------------------
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/uistandard_2.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/uistandard_2.index.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/uistandard_2.index.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,73 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       // define buttons
+       var oNormalButton_0;
+       var selectsButtons = [];
+
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "admin.uimainscreen.mainscreen"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+               document.getElementById('txt_query').focus();
+       }
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/uistandard_3.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/uistandard_3.index.js       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/uistandard_3.index.js       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,74 @@
+//--------------------------------------------------------
+// Declaration of location.index vars
+//--------------------------------------------------------
+       // define buttons
+       var oNormalButton_0;
+       var selectsButtons = [];
+
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_done', funct:"onDoneClick"}
+       ];
+
+       // define Text buttons
+       var textImput = [
+               {order:0, name:'query',id:'txt_query'}
+       ];
+
+       var toolTips =
+       [
+               {name:'btn_export', title:'download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+
+       // define the hidden column in datatable
+       var config_values =
+       {
+               date_search : 0, //if search has link "Data search"
+               particular_done : "admin.uimainscreen.mainscreen"
+       }
+/****************************************************************************************/
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //oMenuButton_0.focus();
+               }
+               else if(flag_particular_setting=='update')
+               {
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+               //don't delete it
+               document.getElementById('txt_query').focus();
+       }
+
+
+/****************************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/uitenant.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/uitenant.edit.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/uitenant.edit.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,51 @@
+/********************************************************************************/
+/********************************************************************************/
+var  myPaginator_0, myDataTable_0;
+var Button_0_0, Button_0_1, Button_0_2;
+var Button_1_0,Button_1_1,Button_1_2,Button_1_3,Button_1_4;
+var tableYUI;
+/********************************************************************************/
+       YAHOO.widget.DataTable.formatLink = function(elCell, oRecord, oColumn, 
oData)
+       {
+               elCell.innerHTML = "<a 
href="+datatable[0][0]["edit_action"]+"&id="+oData+">" + oData + "</a>";
+       };
+/********************************************************************************/
+       this.addFooterDatatable = function(paginator,datatable)
+       {
+               //call getSumPerPage(name of column) in property.js
+               tmp_sum1 = getSumPerPage('budget',2,paginator,datatable);
+               tmp_sum2 = getSumPerPage('calculation',2,paginator,datatable);
+
+               //Create ROW
+               newTR = document.createElement('tr');
+               td_sum('Sum');
+               td_sum(tmp_sum1);
+               td_sum(tmp_sum2);
+               td_empty(7);
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+       }
+/********************************************************************************/
+       this.myParticularRenderEvent = function()
+       {
+               tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+               tableYUI.setAttribute("id","tableYUI");
+               tableYUI.deleteTFoot();
+               addFooterDatatable(myPaginator_0,myDataTable_0);
+       }
+/********************************************************************************/
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone",
+                       type: "js",
+                   fullpath: property_js
+                   });
+
+               loader.require("anyone");
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.deviation.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.deviation.js        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.deviation.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,63 @@
+       var myDataTable_0, myPaginator_0;
+
+/********************************************************************************/
     
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
+       }
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+               if(num == 0)
+               {
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+                       tableYUI.deleteTFoot();
+                       
+                       this.addFooterDatatable(myDataTable_0);
+               }
+       }
+/********************************************************************************/
+       
+       this.my_getSum = function(name_column,datatable)
+       {
+               var begin       = 0;
+               var end         = datatable.getRecordSet().getLength();
+               var tmp_sum = 0;
+               for(i = begin; i < end; i++)
+               {
+                       tmp_sum = tmp_sum + 
datatable.getRecordSet().getRecords(0)[i].getData(name_column);
+               }
+               return tmp_sum;
+       }
+/********************************************************************************/
+       this.addFooterDatatable = function(datatable)
+       {
+               //Create ROW
+               newTR = document.createElement('tr');
+               td_empty(1);
+               
+               tmp_sum1 = my_getSum('amount',datatable);
+               td_sum(tmp_sum1);
+               
+               td_empty(2);
+
+               //Add to Table
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+       }       
+ 
/********************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone",
+                       type: "js",
+                   fullpath: property_js
+                   });
+       
+               loader.require("anyone");
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.index.js            
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.index.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,547 @@
+//--------------------------------------------------------
+// Declaration of wo_hour.index vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var selectsButtons = [
+       ]
+
+       // define checkbox
+       var oCheckButton_0,oCheckButton_1,oCheckButton_2,oCheckButton_3;
+       var CheckButtons = [
+       {name:'check_show_details', check:true},
+       {name:'check_calculated_cost',  check:false},
+       {name:'check_calculated_cost_tender',   check:false},
+       {name:'check_mark_draft',       check:false}
+       ]
+       
+       // define buttons
+       var 
oNormalButton_0,oNormalButton_1,oNormalButton_2,oNormalButton_3,oNormalButton_4,oNormalButton_5;
+       var normalButtons = [
+       {order:0, name:'btn_add_prizebook', funct:"onAddPrizebookClick"},
+       {order:1, name:'btn_add_template',      funct:"onAddTemplate"},
+       {order:2, name:'btn_add_custom',        funct:"onAddCustom"},
+       {order:3, name:'btn_save_template',     funct:"onSaveTemplate"},
+       {order:4, name:'btn_print_preview',     funct:"onPrintPreview"},
+       {order:5, name:'btn_view_tender',       funct:"onViewTender"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+       
+       var div_footer, table, tableYUI ;
+/****************************************************************************************/
+
+       this.onAddPrizebookClick = function()
+       {
+               for(i=0;i<values_ds.rights_form.length;i++)
+               {
+                       if(values_ds.rights_form[i].my_name == 'add_prizebook')
+                       {
+                               //NEW is always the last options in arrays 
RIGHTS
+                               sUrl = values_ds.rights_form[i].action;
+                               //Convert all HTML entities to their applicable 
characters
+                               sUrl=html_entity_decode(sUrl);
+                               window.open(sUrl,'_self');
+                       }
+               }
+       }
+
+       this.onAddTemplate = function()
+       { 
+               for(i=0;i<values_ds.rights_form.length;i++)
+               {
+                       if(values_ds.rights_form[i].my_name == 'add_template')
+                       {
+                               //NEW is always the last options in arrays 
RIGHTS
+                               sUrl = values_ds.rights_form[i].action;
+                               //Convert all HTML entities to their applicable 
characters
+                               sUrl = html_entity_decode(sUrl);
+                               window.open(sUrl,'_self');
+                       }
+               }
+       }
+       
+       this.onAddCustom = function()
+       { 
+               for(i=0;i<values_ds.rights_form.length;i++)
+               {
+                       if(values_ds.rights_form[i].my_name == 'add_custom')
+                       {
+                               //NEW is always the last options in arrays 
RIGHTS
+                               sUrl = values_ds.rights_form[i].action;
+                               //Convert all HTML entities to their applicable 
characters
+                               sUrl=html_entity_decode(sUrl);
+                               window.open(sUrl,'_self');
+                       }
+               }
+       }       
+       
+       this.onSaveTemplate = function()
+       { 
+               for(i=0;i<values_ds.rights_form.length;i++)
+               {
+                       if(values_ds.rights_form[i].my_name == 'save_template')
+                       {
+                               //NEW is always the last options in arrays 
RIGHTS
+                               sUrl = values_ds.rights_form[i].action;
+                               //Convert all HTML entities to their applicable 
characters
+                               sUrl=html_entity_decode(sUrl);
+                               window.open(sUrl,'_self');
+                       }
+               }
+       }
+
+       this.onPrintPreview = function()
+       { 
+               for(i=0;i<values_ds.rights_form.length;i++)
+               {
+                       if(values_ds.rights_form[i].my_name == 'print_view')
+                       {
+                               //NEW is always the last options in arrays 
RIGHTS
+                               sUrl = values_ds.rights_form[i].action;
+                               //Convert all HTML entities to their applicable 
characters
+                               sUrl = html_entity_decode(sUrl);                
                 
+                       }
+               }
+               
+               if (YAHOO.util.Dom.inDocument('myform'))
+               {
+                       var form = document.getElementById('myform');
+                       document.body.removeChild(form);
+               }
+               
+               var submitForm = getNewSubmitForm(sUrl);
+               if (oCheckButton_0.get("checked")) {
+                       createNewFormElement(submitForm, "show_details", "1"); 
+               }
+               if (oCheckButton_1.get("checked")) {
+                       createNewFormElement(submitForm, "show_cost", "1"); 
+               }               
+               submitForm.submit();            
+       }
+
+       this.onViewTender = function()
+       { 
+               for(i=0;i<values_ds.rights_form.length;i++)
+               {
+                       if(values_ds.rights_form[i].my_name == 'view_tender')
+                       {
+                               //NEW is always the last options in arrays 
RIGHTS
+                               sUrl = values_ds.rights_form[i].action;
+                               //Convert all HTML entities to their applicable 
characters
+                               sUrl = html_entity_decode(sUrl);
+                       }
+               }
+               
+               if (YAHOO.util.Dom.inDocument('myform'))
+               {
+                       var form = document.getElementById('myform');
+                       document.body.removeChild(form);
+               }               
+               
+               var submitForm = getNewSubmitForm(sUrl);
+               if (oCheckButton_2.get("checked")) {
+                       createNewFormElement(submitForm, "show_cost", "1"); 
+               }
+               if (oCheckButton_3.get("checked")) {
+                       createNewFormElement(submitForm, "mark_draft", "1"); 
+               }               
+               submitForm.submit();                    
+       }
+
+       //function to create the form
+       this.getNewSubmitForm = function(url)
+       {
+                var submitForm = document.createElement("FORM");
+                submitForm.setAttribute("id", "myform");
+                document.body.appendChild(submitForm);
+                submitForm.action = url;
+                submitForm.method = "POST";
+                return submitForm;
+       }
+
+       //function to add elements to the form
+       this.createNewFormElement = function(inputForm, elementName, 
elementValue)
+       {
+                var newElement = document.createElement("input");
+                newElement.setAttribute("type", "hidden");
+                newElement.setAttribute("name", elementName);
+                newElement.setAttribute("value", elementValue);
+                inputForm.appendChild(newElement);
+                return newElement;
+       }
+       
+       this.particular_setting = function()
+       {
+               
+               if(flag_particular_setting=='init')
+               {                       
+                       var div_toolbar = 
YAHOO.util.Dom.getElementsByClassName("toolbar","div")[0];
+                       div_toolbar.setAttribute("style", "height:75px;");
+
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+                       
+                       div_footer = tableYUI.parentNode;
+
+                       var div_records = document.createElement('div');
+                       div_records.setAttribute("id","div_records");
+                       div_records.setAttribute("style", "text-align:center; 
height:25px; margin-top:15px;");
+                       
+                       div_footer.insertBefore(div_records, tableYUI)
+                       
+                       oNormalButton_0.focus();
+                       create_table_foot();
+                       create_table_info();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       update_datatable_details();
+               }
+       }
+       
+/********************************************************************************/
+       this.myParticularRenderEvent = function()
+       {
+               //unnecessary delete_content_div("message",2) here. wiht 
delete_content_div in property is sufficient.
+               create_message();
+               values_ds.message = null;
+               YAHOO.util.Dom.get("paging").innerHTML = '';
+       }
+       
+/********************************************************************************
+* Delete all message un DIV 'message'
+*/
+       this.create_message = function()
+       {
+
+               div_message= YAHOO.util.Dom.get("message");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                       // succesfull
+                       if(window.values_ds.message[0].message)
+                       {
+                               for(i=0; i<values_ds.message[0].message.length; 
i++)
+                               {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].message[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#009900';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+
+                       // error
+                       if(window.values_ds.message[0].error)
+                       {
+                               for(i=0; i<values_ds.message[0].error.length; 
i++)
+                               {
+
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].error[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#FF0000';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+
+                }
+       }
+       
+/********************************************************************************/
+
+       this.create_table_info = function()
+       {
+
+               var ds_action = '';
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.height = "70px";
+               div_message= 
YAHOO.util.Dom.getElementsByClassName("field","div")[0];
+
+               if ( div_message.hasChildNodes() )
+               {
+                       while ( div_message.childNodes.length >= 1 )
+                   {
+                       div_message.removeChild( div_message.firstChild );
+                   }
+               }
+
+               newTable = document.createElement('table');
+               mewBody = document.createElement('tbody');
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_project_id));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);       
+               
+               var link = document.createElement('a');
+               link.setAttribute('href', 
html_entity_decode(values_ds.workorder_data.link_project));
+               
link.appendChild(document.createTextNode(values_ds.workorder_data.project_id));
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(link);
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+       
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_workorder_id));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+
+               var link = document.createElement('a');
+               link.setAttribute('href', 
html_entity_decode(values_ds.workorder_data.link_workorder));
+               
link.appendChild(document.createTextNode(values_ds.workorder_data.workorder_id));
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(link);
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_workorder_title));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.workorder_title));
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_vendor_name));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.vendor_name));
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+               
+               newTable.appendChild(mewBody);
+               
+               div_message.appendChild(newTable);
+       }
+       
+
+       this.create_table_foot = function()
+       {               
+           var total_records = values_ds.total_hours_records;
+           var lang_total_records = values_ds.lang_total_records;
+           
+
+               document.getElementById("div_records").innerHTML = 
lang_total_records + " : " + total_records;  
+               document.getElementById("div_records").style.textAlign = 'left';
+               
+               var myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+                       
+               if (values_ds.table_sum)
+               {
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+                       
+                       newTD = document.createElement('td');
+                       newTD.style.borderTop="1px solid #000000";
+                       newTD.style.fontWeight = 'bolder';
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_sum_calculation));
+                       newTR.appendChild(nTD);                 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 5;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_sum_calculation));
+                       newTR.appendChild(nTD);         
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 1;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.sum_deviation));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 1;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.sum_result));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD);
+
+                       myfoot.appendChild(newTR);
+
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+
+                       newTD = document.createElement('td');
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_addition_rs));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_addition_rs));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR);
+               
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_addition_percentage));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_addition_percentage));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR);              
+                       
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_sum_tax));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_sum_tax));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR);              
+                       
+                       
+                       newTR = document.createElement('tr');
+ 
+                       newTD = document.createElement('td');
+                       newTD.style.borderTop="1px solid #000000";
+                       newTD.style.fontWeight = 'bolder';
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_total_sum));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_total_sum));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR); 
+               }
+               
+       }
+       
+
+    
+       this.update_datatable_details = function()
+       {
+               var total_records = values_ds.total_hours_records;
+           var lang_total_records = values_ds.lang_total_records;
+           
+               tableYUI.deleteTFoot();
+               create_table_foot();
+               document.getElementById("div_records").innerHTML = 
lang_total_records + " : " + total_records;
+       }
+               
+/********************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[1].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+
+               for(var p=0; p<CheckButtons.length; p++)
+               {
+                       var check_tmp = new 
YAHOO.widget.Button(CheckButtons[p].name, {label:"", value:"0", checked: 
CheckButtons[p].check});
+                       eval("oCheckButton_"+p+" = check_tmp");
+               }
+
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.prizebook.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.prizebook.js        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.prizebook.js        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,557 @@
+//--------------------------------------------------------
+// Declaration of wo_hour.prizebook vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var selectsButtons = [
+       ]
+
+       // define buttons
+       var oNormalButton_0,oNormalButton_1,oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_save',      funct:"onSave"},
+       {order:2, name:'btn_done',      funct:"onDoneClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+
+       var myDataSource_details, myDataTable_details, myContextMenu_details, 
div_footer, table, tableYUI ;
+/****************************************************************************************/
+
+       this.onSave = function()
+               {
+               //get the last div in th form
+               var divs= YAHOO.util.Dom.getElementsByClassName('field');
+               var mydiv = divs[divs.length-1];
+               //remove all child of mydiv
+               if ( mydiv.hasChildNodes() )
+           while ( mydiv.childNodes.length >= 1 )
+           {
+               mydiv.removeChild( mydiv.firstChild );
+           }
+
+               // styles for dont show
+               mydiv.style.display = 'none';
+
+               //asign values for select buttons 'select'
+               selects_dimb = 
YAHOO.util.Dom.getElementsByClassName('select_tmp');
+               hiddens_dimb = YAHOO.util.Dom.getElementsByClassName('select');
+               for(i=0;i<selects_dimb.length;i++)
+               {
+                       hiddens_dimb[i].value = selects_dimb[i].value;
+
+               }
+
+               //get all controls of datatable
+               valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+               var myclone = null;
+               //add all control to form.
+               for(i=0;i<valuesForPHP.length;i++)
+               {
+                       //Important true for Select Controls
+                       myclone = valuesForPHP[i].cloneNode(true);
+                       mydiv.appendChild(myclone);
+               }
+
+               // find out the unique form
+               formObject = document.getElementsByTagName('form');
+               // modify the 'form' for send it as POST using asyncronize call
+               YAHOO.util.Connect.setForm(formObject[0]);
+
+                execute_ds();
+               }
+
+/********************************************************************************/
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //--focus for txt_query---
+                       var div_toolbar = 
YAHOO.util.Dom.getElementsByClassName("toolbar","div")[0];
+                       div_toolbar.setAttribute("style", "height:75px;");
+
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+                       create_table_details();
+                       create_table_info();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       update_datatable_details();
+               }
+       }
+
+/********************************************************************************/
+       this.myParticularRenderEvent = function()
+       {
+               delete_content_div("message",2);
+               create_message();
+               values_ds.message = null;
+       }
+
+/********************************************************************************
+* Delete all message un DIV 'message'
+*/
+       this.create_message = function()
+       {
+
+               div_message= YAHOO.util.Dom.get("message");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                       // succesfull
+                       if(window.values_ds.message[0].message)
+                       {
+                               for(i=0; i<values_ds.message[0].message.length; 
i++)
+                               {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].message[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#009900';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+
+                       // error
+                       if(window.values_ds.message[0].error)
+                       {
+                               for(i=0; i<values_ds.message[0].error.length; 
i++)
+                               {
+
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].error[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#FF0000';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+                }
+                values_ds.message = null;
+       }
+
+/********************************************************************************/
+
+       this.create_table_info = function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.height = "75px";
+               var ds_action = '';
+               div_message= 
YAHOO.util.Dom.getElementsByClassName("field","div")[0];
+
+               if ( div_message.hasChildNodes() )
+               {
+                       while ( div_message.childNodes.length >= 1 )
+                   {
+                       div_message.removeChild( div_message.firstChild );
+                   }
+               }
+
+               newTable = document.createElement('table');
+               mewBody = document.createElement('tbody');
+
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_project_id));
+               newTR.appendChild(newTD);
+
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+
+               var link = document.createElement('a');
+               link.setAttribute('href', 
html_entity_decode(values_ds.workorder_data.link_project));
+               
link.appendChild(document.createTextNode(values_ds.workorder_data.project_id));
+
+               newTD = document.createElement('td');
+               newTD.appendChild(link);
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_workorder_id));
+               newTR.appendChild(newTD);
+
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+
+               var link = document.createElement('a');
+               link.setAttribute('href', 
html_entity_decode(values_ds.workorder_data.link_workorder));
+               
link.appendChild(document.createTextNode(values_ds.workorder_data.workorder_id));
+
+               newTD = document.createElement('td');
+               newTD.appendChild(link);
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_workorder_title));
+               newTR.appendChild(newTD);
+
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.workorder_title));
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_vendor_name));
+               newTR.appendChild(newTD);
+
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.vendor_name));
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+               newTable.appendChild(mewBody);
+
+               div_message.appendChild(newTable);
+       }
+
+       this.create_table_details = function()
+       {
+
+           var Data = values_ds.details.rows;
+           var total_records = values_ds.total_hours_records;
+           var lang_total_records = values_ds.lang_total_records;
+
+               div_footer = document.getElementById('footer');
+               div_footer.setAttribute("class","datatable-container yui-dt");
+
+               var myColumnDefs_details = new Array();
+               for(var k=0 ; k<values_ds.uicols_details.name.length; k++)
+           {
+               if (values_ds.uicols_details.input_type[k] == 'hidden')
+                       var obj_temp = {key: values_ds.uicols_details.name[k], 
label: values_ds.uicols_details.descr[k], visible: false, className: 
values_ds.uicols_details.className[k]};
+               else
+                       var obj_temp = {key: values_ds.uicols_details.name[k], 
label: values_ds.uicols_details.descr[k], visible: true, className: 
values_ds.uicols_details.className[k]};
+               myColumnDefs_details.push(obj_temp);
+           }
+
+               var fields = new Array();
+               for(var i=0; i<myColumnDefs_details.length;i++)
+               {
+                       fields[i] = myColumnDefs_details[i].key;
+               }
+
+               myDataSource_details = new YAHOO.util.DataSource(Data);
+               myDataSource_details.responseType = 
YAHOO.util.DataSource.TYPE_JSARRAY;
+           myDataSource_details.responseSchema = {
+                        fields: fields
+        };
+
+        myDataTable_details = new YAHOO.widget.DataTable(div_footer, 
myColumnDefs_details, myDataSource_details);
+
+        myDataTable_details.subscribe("rowMouseoverEvent", 
myDataTable_details.onEventHighlightRow);
+        myDataTable_details.subscribe("rowMouseoutEvent", 
myDataTable_details.onEventUnhighlightRow);
+
+           myContextMenu_details = new 
YAHOO.widget.ContextMenu("mycontextmenu_details", 
{trigger:myDataTable_details.getTbodyEl()});
+           myContextMenu_details.addItems(GetMenuContext_details());
+
+           myContextMenu_details.subscribe("beforeShow", 
onContextMenuBeforeShow);
+           myContextMenu_details.subscribe("hide", onContextMenuHide);
+
+           myContextMenu_details.subscribe("click", 
onContextMenuClick_details, myDataTable_details);
+           myContextMenu_details.render(div_footer);
+
+               for(var i=0; i<myColumnDefs_details.length;i++)
+               {
+                       if( !myColumnDefs_details[i].visible )
+                       {
+                               var sKey = myColumnDefs_details[i].key;
+                               myDataTable_details.hideColumn(sKey);
+                       }
+                       YAHOO.util.Dom.getElementsByClassName( 
'yui-dt-resizerliner', 'div' )[0].style.textAlign = 'center';
+               }
+
+               table = div_footer.getElementsByTagName("table");
+               table[0].setAttribute("id","tableYUI");
+               tableYUI = document.getElementById('tableYUI');
+               create_table_foot();
+
+               var div_records = document.createElement('div');
+               div_records.setAttribute("id","div_records");
+               div_records.setAttribute("style", "text-align:center; 
height:25px; margin-top:35px;");
+               div_footer.insertBefore(div_records, tableYUI)
+               document.getElementById("div_records").innerHTML = 
lang_total_records + " : " + total_records;
+
+       }
+
+       this.create_table_foot = function()
+       {
+               var myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+
+               if (values_ds.table_sum)
+               {
+
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+
+                       newTD = document.createElement('td');
+                       newTD.style.borderTop="1px solid #000000";
+                       newTD.style.fontWeight = 'bolder';
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_sum_calculation));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 5;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_sum_calculation));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 1;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.sum_deviation));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 1;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.sum_result));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD);
+
+                       myfoot.appendChild(newTR);
+
+
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+
+                       newTD = document.createElement('td');
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_addition_rs));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_addition_rs));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD);
+
+                       myfoot.appendChild(newTR);
+
+
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_addition_percentage));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_addition_percentage));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD);
+
+                       myfoot.appendChild(newTR);
+
+
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_sum_tax));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_sum_tax));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD);
+
+                       myfoot.appendChild(newTR);
+
+
+                       newTR = document.createElement('tr');
+
+                       newTD = document.createElement('td');
+                       newTD.style.borderTop="1px solid #000000";
+                       newTD.style.fontWeight = 'bolder';
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_total_sum));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_total_sum));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD);
+
+                       myfoot.appendChild(newTR);
+               }
+
+       }
+
+       this.GetMenuContext_details = function()
+       {
+          var opts = new Array();
+          var p=0;
+          for(var k =0; k < values_ds.details.rowactions.length; k ++)
+          {
+                       opts[p]=[{text: values_ds.details.rowactions[k].text}];
+                       p++;
+          }
+          return opts;
+    }
+
+    this.onContextMenuClick_details = function(p_sType, p_aArgs, p_myDataTable)
+       {
+               var task = p_aArgs[1];
+            if(task)
+            {
+                // Extract which TR element triggered the context menu
+                var elRow = p_myDataTable.getTrEl(this.contextEventTarget);
+                if(elRow)
+                               {
+                                       var oRecord = 
p_myDataTable.getRecord(elRow);
+                                       var url = 
values_ds.details.rowactions[task.groupIndex].action;
+                                       var sUrl = "";
+
+                                       
if(values_ds.details.rowactions[task.groupIndex].parameters!=null)
+                                       {
+                                               param_name = 
values_ds.details.rowactions[task.groupIndex].parameters.parameter[0].name;
+                                               param_source = 
values_ds.details.rowactions[task.groupIndex].parameters.parameter[0].source;
+                                               sUrl = url + "&"+param_name+"=" 
+ oRecord.getData(param_source);
+                                       }
+                                       else
+                                       {
+                                               sUrl = url;
+                                       }
+                                       //Convert all HTML entities to their 
applicable characters
+                                       sUrl=html_entity_decode(sUrl);
+
+                                       // look for the word "DELETE" in URL
+                                       if(substr_count(sUrl,'delete')>0)
+                                       {
+                                               confirm_msg = 
values_ds.details.rowactions[task.groupIndex].confirm_msg;
+                                               if(confirm(confirm_msg))
+                                               {
+                                                       sUrl = sUrl + 
"&confirm=yes&phpgw_return_as=json";
+                                                       delete_record(sUrl);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               
if(substr_count(sUrl,'target=_blank')>0)
+                                               {
+                                                       
window.open(sUrl,'_blank');
+                                               }
+                                               else
+                                               {
+                                                       
window.open(sUrl,'_self');
+                                               }
+                                       }
+                }
+            }
+    };
+
+       this.update_datatable_details = function()
+       {
+               var total_records = values_ds.total_hours_records;
+           var lang_total_records = values_ds.lang_total_records;
+
+               //delete values of datatable
+               myDataTable_details.getRecordSet().reset();
+               myDataTable_details.render();
+
+               //obtain records of the last DS and add to datatable
+               var record = values_ds.details.rows;
+
+               if(record.length)
+               {
+                       myDataTable_details.addRows(record);
+               }
+               else
+               {
+                       myDataTable_details.render();
+               }
+               tableYUI.deleteTFoot();
+               create_table_foot();
+               document.getElementById("div_records").innerHTML = 
lang_total_records + " : " + total_records;
+       }
+
+/********************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.save_template.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.save_template.js    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.save_template.js    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,31 @@
+var  myPaginator_0, myDataTable_0;
+
+/********************************************************************************/
     
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+/********************************************************************************/
     
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
+       }
+       
+/********************************************************************************/
+       this.myParticularRenderEvent = function(num)
+       {
+       }
+ 
/********************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone",
+                       type: "js",
+                   fullpath: property_js
+                   });
+       
+               loader.require("anyone");
+           loader.insert();
+       });

Added: people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.template.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.template.js         
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.template.js 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,653 @@
+//--------------------------------------------------------
+// Declaration of wo_hour.template vars
+//--------------------------------------------------------
+
+       //define SelectButton
+       var selectsButtons = [
+       ]
+
+       // define buttons
+       var oNormalButton_0,oNormalButton_1,oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_save',      funct:"onSave"},
+       {order:2, name:'btn_done',      funct:"onNewDoneClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values =     {
+               date_search : 0 //if search has link "Data search"
+       }
+       
+       var myDataSource_details, myDataTable_details, myContextMenu_details, 
div_footer, table, tableYUI, table_details ;
+/****************************************************************************************/
+
+       this.onNewDoneClick = function()
+       {
+               var path_values_action_original = path_values.menuaction;
+
+               tmp_array = path_values.menuaction.split(".")
+               tmp_array[2] = "index"; //set function INDEX
+               path_values.menuaction = tmp_array.join('.');
+               
+               var path_update = new Array();
+               path_update["menuaction"] = path_values.menuaction;
+               path_update["workorder_id"] = path_values.workorder_id;
+               
+               window.open(phpGWLink('index.php',path_update),'_self');
+               //come back to initial values
+               path_values.menuaction = path_values_action_original;
+
+       }
+/****************************************************************************************/
+       
+       this.onSave = function()
+               {
+               //get the last div in th form
+               var divs = YAHOO.util.Dom.getElementsByClassName('field');
+               var mydiv = divs[divs.length-1];
+               //remove all child of mydiv
+               if ( mydiv.hasChildNodes() )
+           while ( mydiv.childNodes.length >= 1 )
+           {
+               mydiv.removeChild( mydiv.firstChild );
+           }
+
+               // styles for dont show
+               mydiv.style.display = 'none';
+
+               // asign values for select buttons 'select'
+               selects_dimb = 
YAHOO.util.Dom.getElementsByClassName('combo_tmp');
+               hiddens_dimb = YAHOO.util.Dom.getElementsByClassName('combo');
+               for(i=0;i<selects_dimb.length;i++)
+               {
+                       hiddens_dimb[i].value = selects_dimb[i].value;
+               }
+
+               //asign values for check buttons 'close_order'
+               checks = 
YAHOO.util.Dom.getElementsByClassName('CheckClass_tmp');
+               hiddens_checks = 
YAHOO.util.Dom.getElementsByClassName('CheckClass');
+               for(i=0; i<checks.length; i++)
+               {
+                       if(checks[i].checked)
+                       {                               
+                               hiddens_checks[i].value = checks[i].value;
+                       }
+               }
+               
+               //get all controls of datatable
+               valuesForPHP = 
YAHOO.util.Dom.getElementsByClassName('myValuesForPHP');
+               var myclone = null;
+               //add all control to form.
+               for(i=0; i<valuesForPHP.length; i++)
+               {       
+                       //Important true for Select Controls
+                       myclone = valuesForPHP[i].cloneNode(false);
+
+                       if (myclone.className == 'myValuesForPHP CheckClass') 
+                       {
+                               if (myclone.value != '') {
+                                       mydiv.appendChild(myclone);
+                               }
+                       }
+                       else {
+                               mydiv.appendChild(myclone);
+                       }
+               }
+
+               // find out the unique form
+               formObject = document.getElementsByTagName('form');
+               // modify the 'form' for send it as POST using asyncronize call
+               YAHOO.util.Connect.setForm(formObject[0]);
+
+               execute_ds();
+               
+               }
+
+/********************************************************************************/
+       
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {                       
+                       var div_toolbar = 
YAHOO.util.Dom.getElementsByClassName("toolbar","div")[0];
+                       div_toolbar.setAttribute("style", "height:75px;");
+
+                       //locate (asign ID) to datatable
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+                       
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+                       create_table_details();
+                       create_table_info();
+                       
+                       addFooterDatatable();
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       update_datatable_details();
+               }
+       }
+       
+/********************************************************************************/
+       this.myParticularRenderEvent = function()
+       {
+               delete_content_div("message",2);
+               create_message();
+               values_ds.message = null;
+               
+       }
+       
+/********************************************************************************
+* Delete all message un DIV 'message'
+*/
+       this.create_message = function()
+       {
+
+               div_message= YAHOO.util.Dom.get("message");
+
+               //SHOW message if exist 'values_ds.message'
+                if(window.values_ds.message)
+                {
+                       // succesfull
+                       if(window.values_ds.message[0].message)
+                       {
+                               for(i=0; i<values_ds.message[0].message.length; 
i++)
+                               {
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].message[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#009900';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+
+                       // error
+                       if(window.values_ds.message[0].error)
+                       {
+                               for(i=0; i<values_ds.message[0].error.length; 
i++)
+                               {
+
+                                       oDiv=document.createElement("DIV");
+                                       txtNode = 
document.createTextNode(values_ds.message[0].error[i].msg);
+                                       oDiv.appendChild(txtNode);
+                                       oDiv.style.color = '#FF0000';
+                                       oDiv.style.fontWeight = 'bold';
+
+                                       div_message.appendChild(oDiv);
+                               }
+                       }
+                }
+                values_ds.message = null;
+       }
+       
+/********************************************************************************/
+       
+       check_all = function(myclass)
+       {
+               controls = YAHOO.util.Dom.getElementsByClassName(myclass);
+               for(i=0;i<controls.length;i++)
+               {
+                       if(!controls[i].disabled)
+                       {
+                               //for class=transfer_idClass, they have to be 
interchanged
+                               if(myclass=="CheckClass_tmp")
+                               {
+                                       if(controls[i].checked)
+                                       {
+                                               controls[i].checked = false;
+                                       }
+                                       else
+                                       {
+                                               controls[i].checked = true;
+                                       }
+                               }
+                               //for the rest, always id checked
+                               else
+                               {
+                                       controls[i].checked = true;
+                               }
+                       }
+               }
+       }
+/****************************************************************************************/
+       
+       this.addFooterDatatable = function()
+       {
+               //Create ROW
+               newTR = document.createElement('tr');
+               td_empty(1);
+               td_empty(2);
+               td_empty(3);
+               CreateRowChecked("CheckClass_tmp");
+               td_empty(4);
+       
+               //Add to Table
+               var myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+       }
+/****************************************************************************************/
+       
+       this.create_table_info = function()
+       {
+
+               var ds_action = '';
+               div_message= 
YAHOO.util.Dom.getElementsByClassName("field","div")[0];
+
+               if ( div_message.hasChildNodes() )
+               {
+                       while ( div_message.childNodes.length >= 1 )
+                   {
+                       div_message.removeChild( div_message.firstChild );
+                   }
+               }
+
+               newTable = document.createElement('table');
+               mewBody = document.createElement('tbody');
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_project_id));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);       
+               
+               var link = document.createElement('a');
+               link.setAttribute('href', 
html_entity_decode(values_ds.workorder_data.link_project));
+               
link.appendChild(document.createTextNode(values_ds.workorder_data.project_id));
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(link);
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+       
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_workorder_id));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+
+               var link = document.createElement('a');
+               link.setAttribute('href', 
html_entity_decode(values_ds.workorder_data.link_workorder));
+               
link.appendChild(document.createTextNode(values_ds.workorder_data.workorder_id));
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(link);
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_workorder_title));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.workorder_title));
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+
+               
+               newTR = document.createElement('tr');
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.lang_vendor_name));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               newTD.appendChild(document.createTextNode("\u00A0:\u00A0"));
+               newTR.appendChild(newTD);
+               
+               newTD = document.createElement('td');
+               
newTD.appendChild(document.createTextNode(values_ds.workorder_data.vendor_name));
+               newTR.appendChild(newTD);
+               mewBody.appendChild(newTR);
+               
+               newTable.appendChild(mewBody);
+               
+               div_message.appendChild(newTable);
+       }
+/****************************************************************************************/
+       
+       this.create_table_details = function()
+       {
+
+           var Data = values_ds.details.rows;
+           var total_records = values_ds.total_hours_records;
+           var lang_total_records = values_ds.lang_total_records;
+         
+               div_footer = document.getElementById('footer');
+               div_footer.setAttribute("class","datatable-container yui-dt");
+
+               var myColumnDefs_details = new Array();
+               for(var k=0 ; k<values_ds.uicols_details.name.length; k++)
+           {
+               if (values_ds.uicols_details.input_type[k] == 'hidden')
+                       var obj_temp = {key: values_ds.uicols_details.name[k], 
label: values_ds.uicols_details.descr[k], visible: false, className: 
values_ds.uicols_details.className[k]};
+               else
+                       var obj_temp = {key: values_ds.uicols_details.name[k], 
label: values_ds.uicols_details.descr[k], visible: true, className: 
values_ds.uicols_details.className[k]};
+               myColumnDefs_details.push(obj_temp);
+           }
+ 
+               var fields = new Array();
+               for(var i=0; i<myColumnDefs_details.length;i++)
+               {
+                       fields[i] = myColumnDefs_details[i].key;
+               }
+               
+               myDataSource_details = new YAHOO.util.DataSource(Data);         
        
+               myDataSource_details.responseType = 
YAHOO.util.DataSource.TYPE_JSARRAY; 
+           myDataSource_details.responseSchema = {                 
+                        fields: fields
+        }; 
+        
+        myDataTable_details = new YAHOO.widget.DataTable(div_footer, 
myColumnDefs_details, myDataSource_details);
+        
+        myDataTable_details.subscribe("rowMouseoverEvent", 
myDataTable_details.onEventHighlightRow);
+        myDataTable_details.subscribe("rowMouseoutEvent", 
myDataTable_details.onEventUnhighlightRow);
+
+           myContextMenu_details = new 
YAHOO.widget.ContextMenu("mycontextmenu_details", 
{trigger:myDataTable_details.getTbodyEl()});
+           myContextMenu_details.addItems(GetMenuContext_details());
+          
+           myContextMenu_details.subscribe("beforeShow", 
onContextMenuBeforeShow);
+           myContextMenu_details.subscribe("hide", onContextMenuHide);
+
+           myContextMenu_details.subscribe("click", 
onContextMenuClick_details, myDataTable_details);
+           myContextMenu_details.render(div_footer);   
+
+               for(var i=0; i<myColumnDefs_details.length;i++)
+               {
+                       if( !myColumnDefs_details[i].visible )
+                       {
+                               var sKey = myColumnDefs_details[i].key;
+                               myDataTable_details.hideColumn(sKey);
+                       }
+                       YAHOO.util.Dom.getElementsByClassName( 
'yui-dt-resizerliner', 'div' )[0].style.textAlign = 'center';
+               }
+               
+               table = div_footer.getElementsByTagName("table");
+               table[0].setAttribute("id","table_details");
+               table_details = document.getElementById('table_details');       
                
+               create_table_foot();
+
+               var div_records = document.createElement('div');
+               div_records.setAttribute("id","div_records");
+               div_records.setAttribute("style", "text-align:center; 
height:25px; margin-top:35px;");
+               div_footer.insertBefore(div_records, table_details)
+               document.getElementById("div_records").innerHTML = 
lang_total_records + " : " + total_records;
+               
+       }
+/****************************************************************************************/
+       
+       this.create_table_foot = function()
+       {               
+               var myfoot = table_details.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+                       
+               if (values_ds.table_sum)
+               {
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+                       
+                       newTD = document.createElement('td');
+                       newTD.style.borderTop="1px solid #000000";
+                       newTD.style.fontWeight = 'bolder';
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_sum_calculation));
+                       newTR.appendChild(nTD);                 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 5;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_sum_calculation));
+                       newTR.appendChild(nTD);         
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 1;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.sum_deviation));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 1;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.sum_result));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD);
+
+                       myfoot.appendChild(newTR);
+
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+
+                       newTD = document.createElement('td');
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_addition_rs));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_addition_rs));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR);
+               
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_addition_percentage));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_addition_percentage));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR);              
+                       
+                       
+                       newTR = document.createElement('tr');
+                       newTR.setAttribute("class","yui-dt-even");
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_sum_tax));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_sum_tax));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR);              
+                       
+                       
+                       newTR = document.createElement('tr');
+ 
+                       newTD = document.createElement('td');
+                       newTD.style.borderTop="1px solid #000000";
+                       newTD.style.fontWeight = 'bolder';
+                       newTD.style.textAlign = 'right';
+                       newTD.style.paddingRight = '0.8em';
+                       
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 3;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.lang_total_sum));
+                       newTR.appendChild(nTD); 
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 7;
+                       
nTD.appendChild(document.createTextNode(values_ds.table_sum.value_total_sum));
+                       newTR.appendChild(nTD);
+
+                       nTD = newTD.cloneNode(true);
+                       nTD.colSpan = 2;
+                       nTD.appendChild(document.createTextNode(''));
+                       newTR.appendChild(nTD); 
+                       
+                       myfoot.appendChild(newTR); 
+               }
+               
+       }
+/****************************************************************************************/
+       
+       this.GetMenuContext_details = function()
+       {
+          var opts = new Array();
+          var p=0;
+          for(var k =0; k < values_ds.details.rowactions.length; k ++)
+          {
+                       opts[p]=[{text: values_ds.details.rowactions[k].text}];
+                       p++;                    
+          }
+          return opts;
+    }
+/****************************************************************************************/
+       
+    this.onContextMenuClick_details = function(p_sType, p_aArgs, p_myDataTable)
+       {
+               var task = p_aArgs[1];
+            if(task)
+            {
+                // Extract which TR element triggered the context menu
+                var elRow = p_myDataTable.getTrEl(this.contextEventTarget);
+                if(elRow)
+                               {
+                                       var oRecord = 
p_myDataTable.getRecord(elRow);
+                                       var url = 
values_ds.details.rowactions[task.groupIndex].action;
+                                       var sUrl = "";
+
+                                       
if(values_ds.details.rowactions[task.groupIndex].parameters!=null)
+                                       {
+                                               param_name = 
values_ds.details.rowactions[task.groupIndex].parameters.parameter[0].name;
+                                               param_source = 
values_ds.details.rowactions[task.groupIndex].parameters.parameter[0].source;
+                                               sUrl = url + "&"+param_name+"=" 
+ oRecord.getData(param_source);
+                                       }
+                                       else 
+                                       {
+                                               sUrl = url;
+                                       }
+                                       //Convert all HTML entities to their 
applicable characters
+                                       sUrl=html_entity_decode(sUrl);
+
+                                       // look for the word "DELETE" in URL
+                                       if(substr_count(sUrl,'delete')>0)
+                                       {
+                                               confirm_msg = 
values_ds.details.rowactions[task.groupIndex].confirm_msg;
+                                               if(confirm(confirm_msg))
+                                               {
+                                                       sUrl = sUrl + 
"&confirm=yes&phpgw_return_as=json";
+                                                       delete_record(sUrl);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               
if(substr_count(sUrl,'target=_blank')>0)
+                                               {
+                                                       
window.open(sUrl,'_blank');
+                                               }
+                                               else
+                                               {
+                                                       
window.open(sUrl,'_self');                                              
+                                               }
+                                       }
+                }
+            }
+    }
+/****************************************************************************************/
+    
+       this.update_datatable_details = function()
+       {
+               var total_records = values_ds.total_hours_records;
+           var lang_total_records = values_ds.lang_total_records;
+           
+               //delete values of datatable
+               myDataTable_details.getRecordSet().reset();
+               myDataTable_details.render();
+
+               //obtain records of the last DS and add to datatable
+               var record = values_ds.details.rows;
+
+               if(record.length)
+               {
+                       myDataTable_details.addRows(record);
+               }
+               else
+               {
+                       myDataTable_details.render();
+               }
+               table_details.deleteTFoot();
+               create_table_foot();
+               document.getElementById("div_records").innerHTML = 
lang_total_records + " : " + total_records;
+       }
+               
+/********************************************************************************/
+       
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.view.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.view.js             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/wo_hour.view.js     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,25 @@
+var  myPaginator_0, myDataTable_0
+var  myPaginator_1, myDataTable_1;
+
+/********************************************************************************/
+this.myParticularRenderEvent = function()
+{
+       myDataTable_0.setColumnWidth("descr",400);
+
+}
+ 
/********************************************************************************/
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+

Added: people/sigurdne/modules/property/trunk/js/yahoo/workorder.edit.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/workorder.edit.js           
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/workorder.edit.js   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,17 @@
+var  myPaginator_0, myDataTable_0
+var  myPaginator_1, myDataTable_1;
+
+/********************************************************************************/
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});

Added: people/sigurdne/modules/property/trunk/js/yahoo/workorder.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/workorder.index.js          
                (rev 0)
+++ people/sigurdne/modules/property/trunk/js/yahoo/workorder.index.js  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,142 @@
+//--------------------------------------------------------
+// Declaration of workorder.index vars
+//--------------------------------------------------------
+       //define SelectButton
+       var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3, 
oMenuButton_4, oMenuButton_5;
+       var selectsButtons = [
+       {order:0, 
var_URL:'district_id',name:'btn_district_id',style:'districtbutton',dependiente:''},
+       {order:1, 
var_URL:'cat_id',name:'btn_cat_id',style:'categorybutton',dependiente:''},
+       {order:2, 
var_URL:'status_id',name:'btn_status_id',style:'districtbutton',dependiente:''},
+       {order:3, 
var_URL:'wo_hour_cat_id',name:'btn_wo_hour_cat_id',style:'partOFTownbutton',dependiente:''},
+       {order:4, var_URL:'filter', 
name:'btn_user_id',style:'ownerIdbutton',dependiente:''},
+       {order:5, var_URL:'criteria_id', 
name:'btn_criteria_id',style:'criteriabutton',dependiente:''}
+       ]
+
+       // define buttons
+       var oNormalButton_0, oNormalButton_1, oNormalButton_2;
+       var normalButtons = [
+       {order:0, name:'btn_search', funct:"onSearchClick"},
+       {order:1, name:'btn_new', funct:"onNewClick"},
+       {order:2, name:'btn_export', funct:"onDownloadClick"}
+       ]
+
+       // define Text buttons
+       var textImput = [
+       {order:0, name:'query', id:'txt_query'}
+       ]
+
+       var toolTips =
+       [
+               {name:'loc1', title:'', 
description:'',ColumnDescription:'loc1_name'},
+               {name:'vendor_id', title:'', 
description:'',ColumnDescription:'org_name'},
+               {name:'btn_export', title:'Download', description:'Download 
table to your browser',ColumnDescription:''}
+       ]
+
+       var linktoolTips =
+       [
+         {name:'btn_data_search', title:'Date search', description:'Narrow the 
search by dates'}
+       ]
+
+       // define the hidden column in datatable
+       var config_values = {
+        date_search : 1 //if search has link "Data search"
+       };
+
+       
/********************************************************************************/
+       this.myFormatNum2 = function(Data)
+       {
+               return  YAHOO.util.Number.format(Data, {decimalPlaces:0, 
decimalSeparator:"", thousandsSeparator:" "});
+       }                               
+       
/********************************************************************************/
+       var myFormatCount2 = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = myFormatNum2(oData);
+       }       
+
+       this.particular_setting = function()
+       {
+               if(flag_particular_setting=='init')
+               {
+                       //district
+                       index = 
locate_in_array_options(0,"value",path_values.district_id);
+                       if(index)
+                       {
+                               oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+                       }
+
+                       //category
+                       index = 
locate_in_array_options(1,"value",path_values.cat_id);
+                       if(index)
+                       {
+                               oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       }
+
+                       //status
+                       index = 
locate_in_array_options(2,"value",path_values.status_id);
+                       if(index)
+                       {
+                               oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
+                       }
+
+                       //wo_hour_cat_id
+                       index = 
locate_in_array_options(3,"value",path_values.wo_hour_cat_id);
+                       if(index)
+                       {
+                               oMenuButton_3.set("label", ("<em>" + 
array_options[3][index][1] + "</em>"));
+                       }
+
+                       //user
+                       index = 
locate_in_array_options(4,"value",path_values.filter);
+                       if(index)
+                       {
+                               oMenuButton_4.set("label", ("<em>" + 
array_options[4][index][1] + "</em>"));
+                       }
+
+                       //criteria
+                       index = 
locate_in_array_options(5,"value",path_values.criteria_id);
+                       if(index)
+                       {
+                               oMenuButton_5.set("label", ("<em>" + 
array_options[5][index][1] + "</em>"));
+                       }
+
+                       //focus initial
+                       //--focus for txt_query---
+                       YAHOO.util.Dom.get(textImput[0].id).focus();
+
+               }
+               else if(flag_particular_setting=='update')
+               {
+                       //nothing
+               }
+       }
+/****************************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       //don't delete it
+       }
+/****************************************************************************************/
+
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               //avoid render buttons html
+               
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display = 
'none';
+               var loader = new YAHOO.util.YUILoader();
+               loader.addModule({
+                       name: "anyone", //module name; must be unique
+                       type: "js", //can be "js" or "css"
+                   fullpath: property_js //'property_js' have the path for 
property.js, is render in HTML
+                   });
+
+               loader.require("anyone");
+
+               //Insert JSON utility on the page
+
+           loader.insert();
+       });
+
+
+
+
+
+

Modified: people/sigurdne/modules/property/trunk/login.php
===================================================================
--- people/sigurdne/modules/property/trunk/login.php    2009-11-20 10:28:44 UTC 
(rev 20847)
+++ people/sigurdne/modules/property/trunk/login.php    2009-11-20 10:29:01 UTC 
(rev 20848)
@@ -1,4 +1,5 @@
 <?php
+
        /**
        * phpGroupWare
        *
@@ -24,7 +25,7 @@
        *
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package phpgroupware
-       * @version $Id$
+       * @version $Id$
        */
 
        // FIXME this should be changed significantly - it duplicates a lot of 
login code, most of which has been improved
@@ -91,17 +92,26 @@
                                return lang('Sorry, your login has expired');
                        case 5:
                                return lang('Bad login or password');
+                               case 20:
+                                       return lang('Cannot find the mapping ! 
(please advice your adminstrator)');
+                               case 21:
+                                       return lang('you had inactive mapping 
to %1 account', phpgw::get_var('phpgw_account', 'string', 'GET', ''));
+                               case 22:
+                                       
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
+                                       
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
+                                       
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
+                                       return lang('you seemed to have an 
active session elsewhere for the domain "%1", now set to expired - please try 
again', phpgw::get_var('domain', 'string', 'COOKIE'));
                        case 99:
                                return lang('Blocked, too many attempts');
                        case 10:
-                               
$GLOBALS['phpgw']->sessions->phpgw_setcookie('sessionid');
-                               
$GLOBALS['phpgw']->sessions->phpgw_setcookie('kp3');
-                               
$GLOBALS['phpgw']->sessions->phpgw_setcookie('domain');
+                                       
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
+                                       
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
+                                       
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
 
-                               // fix for bug in php expired sessions not 
being cleared
+                                       // fix for bug php4 expired sessions bug
                                
if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php')
                                {
-                                       
$GLOBALS['phpgw']->sessions->phpgw_setcookie(PHPGW_PHPSESSID);
+                                               
$GLOBALS['phpgw']->session->phpgw_setcookie('phpgwsessid');
                                }
 
                                return lang('Your session could not be 
verified.');
@@ -178,6 +188,11 @@
        }
 
        /* Program starts here */
+       $GLOBALS['phpgw']->session->phpgw_setcookie('sessionphpgwsessid');
+//     $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
+       $GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
+       $GLOBALS['phpgw']->session->phpgw_setcookie('domain');
+
        $login = phpgw::get_var('login', 'string' , 'POST');
        $passwd = phpgw::get_var('passwd', 'string' , 'POST');
 
@@ -248,8 +263,12 @@
 
                        $_passwd = md5($passwd);
 
-                       $db->query("SELECT fm_tenant.id, 
phpgw_accounts.account_lid,phpgw_accounts.account_pwd  FROM fm_tenant $join 
phpgw_accounts ON fm_tenant.phpgw_account_id = phpgw_accounts.account_id WHERE 
fm_tenant.account_lid = '$login' AND "
-                               . "fm_tenant.account_pwd='" . $_passwd . "' AND 
fm_tenant.account_status ='1'",__LINE__,__FILE__);
+                       $db->query("SELECT fm_tenant.id, 
phpgw_accounts.account_lid,phpgw_accounts.account_pwd"
+                               . " FROM fm_tenant {$join} phpgw_accounts ON 
fm_tenant.phpgw_account_id = phpgw_accounts.account_id"
+                               . " WHERE phpgw_accounts.account_status = 'A' 
AND"
+                               . " fm_tenant.account_lid = '{$login}' AND"
+                               . " fm_tenant.account_pwd='{$_passwd}' AND"
+                               . " fm_tenant.account_status 
=1",__LINE__,__FILE__);
                        $db->next_record();
 
                        if (!$db->f('account_lid'))
@@ -261,7 +280,7 @@
                        $tenant_id = $db->f('id');
                        $login = $db->f('account_lid');
                        $passwd = $db->f('account_pwd');
-
+//_debug_array($passwd);die();
                        if ( 
isset($GLOBALS['phpgw_info']['server']['usecookies']) && 
$GLOBALS['phpgw_info']['server']['usecookies'] )
                        {
                                
$GLOBALS['phpgw']->session->phpgw_setcookie('last_usertype', 
phpgw::get_var('loginusertype') ,time()+1209600); /* For 2 weeks */
@@ -274,7 +293,7 @@
                        $login .= '@' . phpgw::get_var('logindomain', 'string', 
'POST');
                }
 
-               $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, $passwd);
+               $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, '', true);
 
                
$GLOBALS['phpgw']->session->appsession('tenant_id','property',$tenant_id);
 
@@ -383,7 +402,7 @@
        $tmpl->set_var(
                        array(
                                'usertype_from_hosts'   => '',
-                               'lang_usertype'         => lang('Usertype')
+                               'lang_usertype'         => lang('usertype')
                        )
                );
 
@@ -398,7 +417,7 @@
                }
                else
                {
-                       $GLOBALS['phpgw_info']['user']['preferences'] = 
$prefs->read_repository();
+                       $GLOBALS['phpgw_info']['user']['preferences'] = 
$prefs->read();
                }
                #print 'LANG:' . 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>';
        }

Added: people/sigurdne/modules/property/trunk/setup/default/README
===================================================================
--- people/sigurdne/modules/property/trunk/setup/default/README                 
        (rev 0)
+++ people/sigurdne/modules/property/trunk/setup/default/README 2009-11-20 
10:29:01 UTC (rev 20848)
@@ -0,0 +1,2 @@
+This catalag represent localised tranlsation for each 'phpgw_domain'.
+If one wants differents translation to the same item - create a catalog for 
the domain in question and create a lang file with your translations

Added: 
people/sigurdne/modules/property/trunk/setup/default/phpgw_no.lang_example
===================================================================
--- people/sigurdne/modules/property/trunk/setup/default/phpgw_no.lang_example  
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/setup/default/phpgw_no.lang_example  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,10 @@
+add a part of town     property        no      Legg til en XXX
+delete part of town    property        no      Slett XXX
+delete the part of town        property        no      Slett XXX
+edit the part of town  property        no      Rette XXXen
+Enter a name for this part of town     property        no      Angi ett navn 
for denne XXXen
+Leave the part of town untouched and return back to the list   property        
no      Forlat XXX uendret og returner til oversikten
+No part of town        property        no      XXX ikke valgt
+Part of town   property        no      XXX
+Part of town id        property        no      XXX
+

Modified: people/sigurdne/modules/property/trunk/setup/default_records.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/default_records.inc.php        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/setup/default_records.inc.php        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -57,25 +57,27 @@
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.location.3', 'Entrance')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.location.4', 'Apartment')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.custom', 'custom queries')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant) VALUES ({$app_id}, '.project', 'Demand -> Workorder', 
1)");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function) VALUES ({$app_id}, 
'.project.workorder', 'Workorder', 1, 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib, c_attrib_table) 
VALUES ({$app_id}, '.project', 'Demand -> Workorder', 1, 1, 1, 'fm_project')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib, c_attrib_table) 
VALUES ({$app_id}, '.project.workorder', 'Workorder', 1, 1 ,1, 
'fm_workorder')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function) VALUES ({$app_id}, 
'.project.request', 'Request', 1, 1)");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant) VALUES ({$app_id}, '.ticket', 'Helpdesk', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib, c_attrib_table) 
VALUES ({$app_id}, '.ticket', 'Helpdesk', 1, 1, 1, 'fm_tts_tickets')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.ticket.external', 'Helpdesk External user')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.ticket.order', 'Helpdesk ad hock order')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.invoice', 'Invoice')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.document', 'Documents')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.drawing', 'Drawing')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant) VALUES ({$app_id}, '.entity.1', 'Equipment', 1)");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_attrib,c_attrib_table) VALUES ({$app_id}, 
'.entity.1.1', 'Meter', 1, 1, 'fm_entity_1_1')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_attrib,c_attrib_table) VALUES ({$app_id}, 
'.entity.1.2', 'Elevator', 1, 1, 'fm_entity_1_2')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_attrib,c_attrib_table) VALUES ({$app_id}, 
'.entity.1.3', 'Fire alarm central', 1, 1, 'fm_entity_1_3')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib,c_attrib_table) 
VALUES ({$app_id}, '.entity.1.1', 'Meter', 1, 1, 1, 'fm_entity_1_1')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib,c_attrib_table) 
VALUES ({$app_id}, '.entity.1.2', 'Elevator', 1, 1, 1, 'fm_entity_1_2')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib,c_attrib_table) 
VALUES ({$app_id}, '.entity.1.3', 'Fire alarm central', 1, 1, 1, 
'fm_entity_1_3')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant) VALUES ({$app_id}, '.entity.2', 'Report', 1)");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_attrib,c_attrib_table) VALUES ({$app_id}, 
'.entity.2.1', 'Report type 1', 1, 1, 'fm_entity_2_1')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_attrib,c_attrib_table) VALUES ({$app_id}, 
'.entity.2.2', 'Report type 2', 1, 1, 'fm_entity_2_2')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib,c_attrib_table) 
VALUES ({$app_id}, '.entity.2.1', 'Report type 1', 1, 1, 1, 'fm_entity_2_1')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib,c_attrib_table) 
VALUES ({$app_id}, '.entity.2.2', 'Report type 2', 1, 1, 1, 'fm_entity_2_2')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.b_account', 'Budget account')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.tenant_claim', 'Tenant claim')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.budget', 'Budet')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.budget.obligations', 'Obligations')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.budget.basis', 'Basis for high level lazy 
budgeting')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.ifc', 'ifc integration')");
 
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_c_attrib,c_attrib_table) VALUES ({$app_id}, '.agreement', 
'Agreement',1,'fm_agreement')");
@@ -96,9 +98,6 @@
 //$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_workorder_category 
(id, descr) VALUES (1, 'Preventive')");
 //$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_workorder_category 
(id, descr) VALUES (2, 'Ad Hoc')");
 
-#
-#fm_meter_category
-#
 
 $GLOBALS['phpgw_setup']->oProc->query("DELETE from phpgw_config WHERE 
config_app='property'");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_config (config_app, 
config_name, config_value) VALUES ('property','meter_table', 'fm_entity_1_1')");
@@ -236,10 +235,44 @@
 # fm_document_category
 #
 
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_document_category (id, 
descr) VALUES ('1', 'Picture')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_document_category (id, 
descr) VALUES ('2', 'Report')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_document_category (id, 
descr) VALUES ('3', 'Instruction')");
+$GLOBALS['phpgw_setup']->oProc->query("DELETE FROM phpgw_categories WHERE 
cat_appname = 'property.document'");
+$GLOBALS['phpgw_info']['server']['account_repository'] = 
isset($GLOBALS['phpgw_info']['server']['account_repository']) ? 
$GLOBALS['phpgw_info']['server']['account_repository'] : '';
+$GLOBALS['phpgw']->accounts            = createObject('phpgwapi.accounts');
+$GLOBALS['phpgw']->db = & $GLOBALS['phpgw_setup']->oProc->m_odb;
+$GLOBALS['phpgw']->acl = CreateObject('phpgwapi.acl');
+$GLOBALS['phpgw']->hooks = CreateObject('phpgwapi.hooks', 
$GLOBALS['phpgw_setup']->oProc->m_odb);
+$cats = CreateObject('phpgwapi.categories', -1, 'property.document');
 
+$cats->add(    array
+       (
+               'name'  => 'Picture',
+               'descr' => 'Picture',
+               'parent' => 'none',
+               'old_parent' => 0,
+               'access' => 'public'
+       )
+);
+
+$cats->add(    array
+       (
+               'name'  => 'Report',
+               'descr' => 'Report',
+               'parent' => 'none',
+               'old_parent' => 0,
+               'access' => 'public'
+       )
+);
+
+$cats->add(    array
+       (
+               'name'  => 'Instruction',
+               'descr' => 'Instruction',
+               'parent' => 'none',
+               'old_parent' => 0,
+               'access' => 'public'
+       )
+);
+
 #
 # fm_tts_category
 #
@@ -631,6 +664,10 @@
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 13, 'owner_id', 'owner_id', 'owner_id', 'I', NULL, NULL, NULL, 
4, NULL, NULL, 'True', NULL)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 14, 'change_type', 'change_type', 'change_type', 'I', NULL, 
NULL, NULL, 4, NULL, NULL, 'True', NULL)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 15, 'rental_area', 'Rental area', 'Rental area', 'N', NULL, 5, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 16, 'area_gross', 'Gross area', 'Sum of the areas included 
within the outside face of the exterior walls of a building.', 'N', NULL, 5, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 17, 'area_net', 'Net area', 'The wall-to-wall floor area of a 
room.', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 18, 'area_usable', 'Usable area', 'generally measured from paint 
to paint inside the permanent walls and to the middle of partitions separating 
rooms', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
+
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 8, 1, 'OK')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 8, 2, 'Not OK')");
 
@@ -640,6 +677,9 @@
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 10, 'remark', 'Remark', 'Remark', 'T', NULL, 2, NULL, NULL, 
NULL, NULL, 'True', 1)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 11, 'change_type', 'change_type', 'change_type', 'I', NULL, 
NULL, NULL, 4, NULL, NULL, 'True', NULL)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 12, 'rental_area', 'Rental area', 'Rental area', 'N', NULL, 3, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 13, 'area_gross', 'Gross area', 'Sum of the areas included 
within the outside face of the exterior walls of a building.', 'N', NULL, 5, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 14, 'area_net', 'Net area', 'The wall-to-wall floor area of a 
room.', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 15, 'area_usable', 'Usable area', 'generally measured from paint 
to paint inside the permanent walls and to the middle of partitions separating 
rooms', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 9, 1, 'OK')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 9, 2, 'Not OK')");
 
@@ -648,6 +688,9 @@
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 11, 'remark', 'Remark', 'Remark', 'T', NULL, 2, NULL, NULL, 
NULL, NULL, 'True', 1)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 12, 'change_type', 'change_type', 'change_type', 'I', NULL, 
NULL, NULL, 4, NULL, NULL, 'True', NULL)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 13, 'rental_area', 'Rental area', 'Rental area', 'N', NULL, 3, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 14, 'area_gross', 'Gross area', 'Sum of the areas included 
within the outside face of the exterior walls of a building.', 'N', NULL, 5, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 15, 'area_net', 'Net area', 'The wall-to-wall floor area of a 
room.', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 16, 'area_usable', 'Usable area', 'generally measured from paint 
to paint inside the permanent walls and to the middle of partitions separating 
rooms', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 10, 1, 'OK')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 10, 2, 'Not OK')");
 
@@ -660,6 +703,14 @@
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 15, 'tenant_id', 'tenant_id', 'tenant_id', 'I', NULL, NULL, 
NULL, 4, NULL, NULL, 'True', NULL)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, size, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 16, 'change_type', 'change_type', 'change_type', 'I', NULL, 
NULL, NULL, 4, NULL, NULL, 'True', NULL)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 17, 'rental_area', 'Rental area', 'Rental area', 'N', NULL, 4, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 18, 'area_gross', 'Gross area', 'Sum of the areas included 
within the outside face of the exterior walls of a building.', 'N', NULL, 5, 
20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 19, 'area_net', 'Net area', 'The wall-to-wall floor area of a 
room.', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute 
(location_id, id, column_name, input_text, statustext, datatype, list, 
attrib_sort, precision_, scale, default_value, nullable,custom) VALUES 
($location_id, 20, 'area_usable', 'Usable area', 'generally measured from paint 
to paint inside the permanent walls and to the middle of partitions separating 
rooms', 'N', NULL, 5, 20, 2, NULL, 'True', 1)");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 11, 1, 'OK')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice 
(location_id, attrib_id, id, value) VALUES ($location_id, 11, 2, 'Not OK')");
 
+
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_action_pending_category 
(num, name, descr) VALUES ('approval', 'Approval', 'Please approve the item 
requested')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_action_pending_category 
(num, name, descr) VALUES ('remind', 'Remind', 'This is a reminder of task 
assigned')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_action_pending_category 
(num, name, descr) VALUES ('accept_delivery', 'Accept delivery', 'Please accept 
delivery on this item')");
+

Modified: people/sigurdne/modules/property/trunk/setup/phpgw_en.lang
===================================================================
--- people/sigurdne/modules/property/trunk/setup/phpgw_en.lang  2009-11-20 
10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/setup/phpgw_en.lang  2009-11-20 
10:29:01 UTC (rev 20848)
@@ -987,6 +987,8 @@
 Open Date      property        en      Open Date
 Opened property        en      Opened
 Opened By      property        en      Opened By
+open edit in new window        property        en      Open Edit in new Window
+open view in new window        property        en      Open View in new Window
 Order  property        en      Order
 Order # that initiated the invoice     property        en      Order # that 
initiated the invoice
 Order ID       property        en      Order ID

Modified: people/sigurdne/modules/property/trunk/setup/phpgw_no.lang
===================================================================
--- people/sigurdne/modules/property/trunk/setup/phpgw_no.lang  2009-11-20 
10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/setup/phpgw_no.lang  2009-11-20 
10:29:01 UTC (rev 20848)
@@ -1,27 +1,36 @@
-%1 Buildings has been updated to not active of %2 already not active   
property        no      %1 Bygninger er oppdatert til IKKE AKTIVE av %2 som var 
IKKE ACTIVE fra før
-%1 Entrances has been updated to not active of %2 already not active   
property        no      %1 Innganger er oppdatert til IKKE AKTIVE av %2 som var 
IKKE ACTIVE fra før
+%1 buildings has been updated to not active of %2 already not active   
property        no      %1 Bygninger er oppdatert til IKKE AKTIVE av %2 som var 
IKKE ACTIVE fra før
+%1 entrances has been updated to not active of %2 already not active   
property        no      %1 Innganger er oppdatert til IKKE AKTIVE av %2 som var 
IKKE ACTIVE fra før
 %1 entries is added!   property        no      %1 poster er lagt til
 %1 entries is updated! property        no      %1 poster er oppdatert
+%1 group       property        no      %1 gruppe
 %1 is notified property        no      Melding sendt til %1
-%1 Properties has been updated to not active of %2 already not active  
property        no      %1 Eiendommer er oppdatert til IKKE AKTIVE av %2 som 
var IKKE ACTIVE fra før
-Access error   property        no      Manglende tilgang
+%1 properties has been updated to not active of %2 already not active  
property        no      %1 Eiendommer er oppdatert til IKKE AKTIVE av %2 som 
var IKKE ACTIVE fra før
+about  common  no      Om
+access error   property        no      Manglende tilgang
+accounting     property        no      Regnskap
+accounting categories  property        no      Kategorier regnskap
+accounting dim b       property        no      Kostnadssted
+accounting dim d       property        no      Regnskap dim d
+accounting tax property        no      Regnskap skatter
+accounting voucher category    property        no      Regnskap kategorier 
faktura
+accounting voucher type        property        no      Regnskap type faktura
 acl_locastion is missing       property        no      ACL-lokalisering mangler
-Acquisition date       property        no      Anskaffelses dato
-Action property        no      Handling
-Active property        no      Aktiv
-Activities     property        no      Aktiviteter
-Activity       property        no      Aktivitet
-Activity code  property        no      Aktivitets kode
-Activity has been edited       property        no      Aktivitet er rettet
-Activity has been saved        property        no      Aktivitet er lagret
-Activity ID    property        no      Aktivitet ID
-Activity Num   property        no      Aktivitet num
+acquisition date       property        no      Anskaffelses dato
+action property        no      Handling
+activities     property        no      Aktiviteter
+activity       property        no      Aktivitet
+activity code  property        no      Aktivitets kode
+activity has been edited       property        no      Aktivitet er rettet
+activity has been saved        property        no      Aktivitet er lagret
+activity id    property        no      Aktivitet ID
+activity num   property        no      Aktivitet num
 actor  property        no      Aktør
-Actual cost    property        no      Faktisk kostnad
-Add    property        no      Legg til
+actual cost    property        no      Faktisk kostnad
+actual cost - paid so far      property        no      Faktisk betalt - pr dd
 add a apartment        property        no      Legg til leilighet
 add a attrib   property        no      Legg til en attibutt
 add a budget account   property        no      Legg til en budsjettkonto
+add a budget query     property        no      Legg til en budsjettspørring
 add a building property        no      legg til bygning
 add a category property        no      Legg til en kategori
 add a claim    property        no      Legg til et krav
@@ -33,14 +42,14 @@
 add a entity   property        no      Legg til en entitet
 add a entrance property        no      legg til inngang
 add a equipment        property        no      legg til utstyr
-add a gab      property        no      Legg til GAB-info
+add a gab      property        no      Legg til GrunnEiendom
 add agreement  property        no      legg til avtale
 add agreement group    property        no      Legg til en avtalegruppe
 add a hour     property        no      legg til post
 add a hour to this template    property        no      lett til en post til 
denne malen
 add a investment       property        no      legg til investering
-Add alarm      property        no      Legg til alarm
-Add alarm for selected user    property        no      Legg til alarm for 
valgt bruker
+add alarm      property        no      Legg til alarm
+add alarm for selected user    property        no      Legg til alarm for 
valgt bruker
 add a location property        no      Legg til en lokalisering
 add a meter    property        no      legg til måler
 add a method   property        no      Legg til en metode
@@ -48,6 +57,8 @@
 add an actor   property        no      Legg til en aktør
 add an agreement       property        no      Legg til en avtale
 add an alarm   property        no      Legg til en alarm
+add an entity  property        no      Legg til en entitet
+add an investment      property        no      Legg til en investering
 add an invoice property        no      Legg til en faktura
 add an item to the details     property        no      Legg til en post til 
detaljer
 add another    property        no      Legg til flere
@@ -63,296 +74,335 @@
 add a ticket   property        no      legg til melding
 add attribute  property        no      legg til attribute
 add a workorder        property        no      legg til arbeidsordre
-Add a workorder to this project        property        no      legg til en 
arbeidsordre til dette prosjektet
+add a workorder to this project        property        no      legg til en 
arbeidsordre til dette prosjektet
 add budget account     property        no      Legg til budsjettkonto
 add building   property        no      legg til bygning
 add category   property        no      Legg til kategori
 add common     property        no      Legg til felles
-Add custom     property        no      legg til tilpasset
+add custom     property        no      legg til tilpasset
 add custom function    property        no      Legg til egendefinert funksjon
 add detail     property        no      Legg til detalj
 add deviation  property        no      Legg til avvik
-Add document   property        no      legg til dokument
+add document   property        no      legg til dokument
 added  property        no      Lagt til
 add entity     property        no      Legg til entitet
 add entrance   property        no      legg til inngang
 add equipment  property        no      legg til utstyr
-Add first value for this prizing       property        no      legg til første 
verdi for denne prisingen
-Add from prizebook     property        no      legg til fra prisbok
-Add from template      property        no      legg til fra mal
-Add gab        property        no      Legg til GAB-nr
-Add hour       property        no      legg til post
+add first value for this prizing       property        no      legg til første 
verdi for denne prisingen
+add from prizebook     property        no      legg til fra prisbok
+add from template      property        no      legg til fra mal
+add gab        property        no      Legg til GrunnEiendom
+add hour       property        no      legg til post
 add investment property        no      legg til investering
-Add invoice    property        no      Legg til faktura
+add invoice    property        no      Legg til faktura
 add items from a predefined template   property        no      legg til poster 
fra mal
 add items from this vendors prizebook  property        no      legg til poster 
fra leverandørs prisbok
-Additional notes       property        no      Tilleggs kommentarer
+additional notes       property        no      Tilleggs kommentarer
 add meter      property        no      legg til måler
 add method     property        no      Legg til metode
-Add new comments       property        no      legg til ny kommentar
-Add Project    property        no      Legg til prosjekt
+add new comments       property        no      legg til ny kommentar
+add new ticket property        no      Legg til ny melding
+add project    property        no      Legg til prosjekt
 add property   property        no      legg til prosjekt
-Add request    property        no      Legg til behov
-Add request for this project   property        no      Legg til behov til 
dette prosjektet
-address        property        no      adresse
-Address        property        no      Adresse
-addressbook    property        no      Adressebok
-Adds a new project - then a new workorder      property        no      legger 
til nytt prosjekt - så arbeidsordre
-Adds a new workorder to an existing project    property        no      legger 
til ny arbeidsordre til eksisterende prosjekt
+add request    property        no      Legg til behov
+add request for this project   property        no      Legg til behov til 
dette prosjektet
+addressmasters common  no      AddresseMaster
+address        property        no      Adresse
+adds a new project - then a new workorder      property        no      legger 
til nytt prosjekt - så arbeidsordre
+adds a new workorder to an existing project    property        no      legger 
til ny arbeidsordre til eksisterende prosjekt
 add selected request to project        property        no      Legg valgte 
tiltak til prosjektet
 add service    property        no      Legg til service
-Add single custom line property        no      legg til en enkel tilpasset post
+add single custom line property        no      legg til en enkel tilpasset post
 add space      property        no      Legg til areal
 add standard   property        no      legg til standard
 add status     property        no      Legg til status
-Adds this workorders calculation as a template for later use   property        
no      legger kalkulasjonen for denne arbeidsordren som en mal for senere bruk
-Add template   property        no      legg til mal
-Add the selected items property        no      legg til valgte element
-Add this invoice       property        no      Legg til denne fakturaen
-Add this vendor to this activity       property        no      legg til denne 
leverandøren til denne aktiviteten
+adds this workorders calculation as a template for later use   property        
no      legger kalkulasjonen for denne arbeidsordren som en mal for senere bruk
+add template   property        no      legg til mal
+add the selected items property        no      legg til valgte element
+add this invoice       property        no      Legg til denne fakturaen
+add this vendor to this activity       property        no      legg til denne 
leverandøren til denne aktiviteten
 add ticket     property        no      legg til melding
-Add Workorder  property        no      Legg til Arbeidsordre
-Admin entity   property        no      Administrer entitet
-Admin Location property        no      Administrer lokalisering
+add to project property        no      Legg til eksisterende prosjekt
+add workorder  property        no      Legg til Arbeidsordre
+admin async services   property        no      Administrer planlagte oppgaver
+admin custom functions property        no      Administrer tilpassede 
funksjoner
+admin entity   property        no      Administrer entitet
+admin location property        no      Administrer lokalisering
 aesthetics     property        no      Estetikk
-Aesthetics     property        no      Estetikk
 again  property        no      igjen
-Agreement      property        no      Avtale
-Agreement code property        no      avtale kode
-Agreement group        property        no      Avtale gruppe
-Agreement group code   property        no      Avtale gruppe kode
-Agreement group has been edited        property        no      Avtale gruppe 
er rettet
-Agreement group has been saved property        no      Avtale gruppe er lagret
-Agreement group ID     property        no      Avtale gruppe ID
-Agreement has been edited      property        no      avtale er rettet
-Agreement has been saved       property        no      avtale er lagret
+agreement      property        no      Avtale
+agreement attributes   property        no      Avtale attributter
+agreement code property        no      avtale kode
+agreement group        property        no      Avtale gruppe
+agreement group code   property        no      Avtale gruppe kode
+agreement group has been edited        property        no      Avtale gruppe 
er rettet
+agreement group has been saved property        no      Avtale gruppe er lagret
+agreement group id     property        no      Avtale gruppe ID
+agreement has been edited      property        no      avtale er rettet
+agreement has been saved       property        no      avtale er lagret
+agreement id   property        no      avtale ID
 agreement_id   property        no      Avtale ID
-Agreement ID   property        no      avtale ID
-Alarm  property        no      Alarm
+agreement status       property        no      Avtale status
+alarm  property        no      Alarm
 alarm id       property        no      Alarm ID
-All    property        no      Alle
-All users      property        no      Alle brukere
+all    property        no      Alle
+all users      property        no      Alle brukere
 altered        property        no      Endret
-Altered by     property        no      Endret av
-Altering ColumnName OR Datatype  - deletes your data in this Column    
property        no      Endring av kolonnenavn eller datatype vil slette data i 
denne kolonnen
-Alternative - link instead of uploading a file property        no      
Alternativt - link istedet for opplasting av fil
-Amount property        no      Sum
+altered by     property        no      Endret av
+altering columnname or datatype  - deletes your data in this column    
property        no      Endring av kolonnenavn eller datatype vil slette data i 
denne kolonnen
+alternative - link instead of uploading a file property        no      
Alternativt - link istedet for opplasting av fil
+amount property        no      Sum
 amount not entered!    property        no      Sum ikke angitt
-Amount of the invoice  property        no      Sum for fakturaen
-Apartment      property        no      Leilighet
-Apartment has been edited      property        no      Leilighet er rettet
-Apartment has been saved       property        no      leilighet er lagret
+amount of the invoice  property        no      Sum for fakturaen
+an unique code for this activity       property        no      En unik kode fo 
denne aktiviteten
+apartment      property        no      Leilighet
+apartment has been edited      property        no      Leilighet er rettet
+apartment has been saved       property        no      leilighet er lagret
 apartment id   property        no      leilighet ID
-apply  property        no      Bruk
-Apply the values       property        no      Bruke verdier
-Approval       property        no      Godkjenning
-Approval from  property        no      Godkjenning fra
-Approval from is updated       property        no      Godkjenning fra er 
oppdatert
-Archive        property        no      Arkiv
-Art    property        no      Art
-Ask for approval       property        no      Be om godkjenning
-Assigned from  property        no      Tildelt fra
-Assigned to    property        no      Tildelt til
-Assigned To    property        no      Tildelt til
-Assign to      property        no      Til
+applications   property        no      Applikasjoner
+apply the values       property        no      Bruke verdier
+approval       property        no      Godkjenning
+approvals      property        no      Godkjenninger
+approvals request      property        no      Anmodninger om godkjenning
+approval from  property        no      Godkjenning fra
+approval from is updated       property        no      Godkjenning fra er 
oppdatert
+approved       property        no      Godkjent
+archive        property        no      Arkiv
+art    property        no      Art
+ask for approval       property        no      Be om godkjenning
+assigned from  property        no      Tildelt fra
+assignedto     property        no      Tildelt til
+assigned to    property        no      Tildelt til
+assign to      property        no      Til
 async  property        no      async
+asynchronous timed services    property        no      Planlagte oppgaver
 async method   property        no      async metode
 async method has been saved    property        no      async metode er lagret
-Attribute      property        no      Verdier
-Attribute has been edited      property        no      Attributt er rettet
-Attribute has been saved       property        no      Attributt er lagret
-Attribute has NOT been deleted property        no      Attributt er IKKE 
slettet
-Attribute has NOT been edited  property        no      Attributt er IKKE endret
-Attribute has NOT been saved   property        no      Attributt er IKKE lagret
-Attribute ID   property        no      Attributt ID
-Attributes     property        no      Attributter
+async services property        no      Planlagte oppgaver
+attach file    property        no      legg til vedlegg
+attachments    property        no      Vedlegg
+attribute      property        no      Verdier
+attribute has been edited      property        no      Attributt er rettet
+attribute has been saved       property        no      Attributt er lagret
+attribute has not been deleted property        no      Attributt er IKKE 
slettet
+attribute has not been edited  property        no      Attributt er IKKE endret
+attribute has not been saved   property        no      Attributt er IKKE lagret
+attribute id   property        no      Attributt ID
+attributes     property        no      Attributter
 attributes for the attrib      property        no      Verdier for atributter
 attributes for the entity category     property        no      Attributter for 
entitet-kategori
 attributes for the location type       property        no      Attributter for 
lokaliserings type
 attributes for the standard    property        no      verdier for standard
-A unique code for this activity        property        no      En unik kode fo 
denne aktiviteten
+a unique code for this activity        property        no      En unik kode fo 
denne aktiviteten
 authorities demands    property        no      Offentlige pålegg
-Authorities Demands    property        no      Offentlige pålegg
-Auto TAX       property        no      Auto MVA
-b_account      property        no      Budjett konto
-Back to Admin  property        no      Tilbake til Admin
-Back to calculation    property        no      Tilbake til kalkulsajon
+auto tax       property        no      Auto MVA
+b_account      property        no      Budsjett konto
+back to admin  property        no      Tilbake til Admin
+back to calculation    property        no      Tilbake til kalkulsajon
 back to entity property        no      Returner til entitet
-Back to investment list        property        no      Tilbake til liste over 
investeringer
-Back to list   property        no      Tilbake til liste
-Back to the list       property        no      Tilbake til liste
-Back to the ticket list        property        no      Tilbake til meldings 
liste
-Back to the workorder list     property        no      Tilbake til 
arbeidsordre liste
-Base   property        no      Grunnlag
-Base description       property        no      Beskrivelse av grunnlag
+back to investment list        property        no      Tilbake til liste over 
investeringer
+back to list   property        no      Tilbake til liste
+back to the list       property        no      Tilbake til liste
+back to the ticket list        property        no      Tilbake til meldings 
liste uten å lagre
+back to the workorder list     property        no      Tilbake til 
arbeidsordre liste
+base   property        no      Grunnlag
+base description       property        no      Beskrivelse av grunnlag
+basis  property        no      Basis
+besiktigelse   property        no      Besiktigelse
 bilagsnr       property        no      Bilagsnr
-Billable hours changed property        no      Fakturerbar time endret
-Billable rate changed  property        no      Fakturerbar sats endret
-Bill per unit  property        no      Pris pr enhet, ex mva
+billable hours changed property        no      Fakturerbar time endret
+billable rate changed  property        no      Fakturerbar sats endret
+bill per unit  property        no      Pris pr enhet, ex mva
 branch property        no      Fag
-B - responsible        property        no      B-ansv
+b - responsible        property        no      B-ansv
 bruks nr       property        no      bruks nr
-Budget property        no      Budsjett
-Budget account property        no      Budsjett konto
-Budget account is missing:     property        no      Budsjett konto mangler
-Budget changed property        no      Budsjett er endret
-Budget code is missing from sub invoice in :   property        no      
Budsjett konto mangler fra underbilag i :
-budget cost    property        no      Budsjettkostnad
-Budget Responsible     property        no      Budsjett ansvarlig
-Building       property        no      Bygning
-Building common        property        no      Bygnings felles
-Building has been edited       property        no      Bygning er endret
-Building has been saved        property        no      Bygning er lagret
+budget property        no      Budsjett
+budget account property        no      Budsjett konto
+budget account is missing:     property        no      Budsjett konto mangler
+budget changed property        no      Budsjett er endret
+budget code is missing from sub invoice in :   property        no      
Budsjett konto mangler fra underbilag i :
+budget cost    property        no      Budsjett-beløp
+budget_cost    property        no      Budsjett-beløp
+budget responsible     property        no      Budsjett ansvarlig
+building       property        no      Bygning
+building common        property        no      Bygnings felles
+building has been edited       property        no      Bygning er endret
+building has been saved        property        no      Bygning er lagret
 building id    property        no      bygnings ID
+building part  property        no      Bygningsdel
 building_part  property        no      Bygningsdel
-Building part  property        no      Bygningsdel
-But Your message could not be sent by mail!    property        no      Men din 
melding kunne ikke sendes med epost!
+bulk import - contacts common  no      Mengde import kontakter
+bulk import - csv      common  no      Mengde import CSV
+but your message could not be sent by mail!    property        no      Men din 
melding kunne ikke sendes med epost!
 calculate      property        no      Kalkulèr
 calculate this workorder       property        no      kalkuler arbeidsordren
-Calculate Workorder    property        no      kalkuler arbeidsordren
-Calculate workorder by adding items from vendors prizebook or adding general 
hours     property        no      kalkuler arbeidsordren ved å legge til poster 
fra prisbok - eller egne tilpassede poster
-Calculation    property        no      Kalkulasjon
-Cancel property        no      Avbryt
+calculate workorder    property        no      kalkuler arbeidsordren
+calculate workorder by adding items from vendors prizebook or adding general 
hours     property        no      kalkuler arbeidsordren ved å legge til poster 
fra prisbok - eller egne tilpassede poster
+calculation    property        no      Kalkulasjon
 cancel the import      property        no      avbryt import
-Categories     property        no      Kategorier
+categories     property        no      Kategorier
 categories for the entity type property        no      Kategori for 
entitet-type
 categories for the location type       property        no      Kategori for 
lokaliserings type
-category       property        no      kategori
-Category       property        no      Kategori
-Category changed       property        no      Kategori er endret
+categorise persons     common  no      Kategoriser personer
+category       common  no      Kategori
+category changed       property        no      Kategori er endret
 category has been edited       property        no      Kategori er rettet
 category has been saved        property        no      Kategori er lagret
-Category has NOT been saved    property        no      Kategori er IKKE lagret
+category has not been saved    property        no      Kategori er IKKE lagret
 category id    property        no      Kategori ID
-category ID    property        no      Kategori ID
-Change type    property        no      Endrings type
-Chapter        property        no      Kapittel
-Character      property        no      karakter
-Charge tenant  property        no      Fakturer leietaker
-Check this to have the output to screen before import (recommended)    
property        no      Kryss av denne for å kontrollere importdata på skjerm 
før import (anbefalt)
-Check this to notify your supervisor by email  property        no      Kryss 
av for å varsle din foresatte med epost
-Check this to send a mail to your supervisor for approval      property        
no      kryss av for å be din foresatte om godkjenning - epost
+change main screen message     common  no      Endre melding - hovedside
+change status  property        no      Endre status
+change to      property        no      Endre til
+change type    property        no      Endrings type
+chapter        property        no      Kapittel
+char   property        no      Karakter
+character      property        no      karakter
+charge tenant  property        no      Fakturer leietaker
+check payments property        no      Sjekk betalinger
+check this to have the output to screen before import (recommended)    
property        no      Kryss av denne for å kontrollere importdata på skjerm 
før import (anbefalt)
+check this to notify your supervisor by email  property        no      Kryss 
av for å varsle din foresatte med epost
+check this to send a mail to your supervisor for approval      property        
no      kryss av for å be din foresatte om godkjenning - epost
 check to activate custom function      property        no      Merk av for å 
aktivere egendefinert funksjon
-Check to delete file   property        no      Merk for å slette fil
-Check to delete this request from this project property        no      Merk 
for a slette dette tiltaket fra dette prosjektet
+Check to add text to order     property        no      Merk for å legge 
teksten til i bestillingen
+check to delete file   property        no      Merk for å slette fil
+check to delete this request from this project property        no      Merk 
for a slette dette tiltaket fra dette prosjektet
 check to inherit from this location    property        no      Merk av for å 
arve fra denne lokalisering
 check to reset the query       property        no      Merk av for å nulle 
spørring
 check to show this attribue in lookup forms    property        no      Merk av 
for å vise denne attributten i loaliseringsskjema
 check to show this attribute in entity list    property        no      Merk av 
for å vise denne attributten i oversikt
 check to show this attribute in list   property        no      Merk av for å 
vise denne attributten i oversikt
 check to show this attribute in location list  property        no      Merk av 
for å vise denne attributten i oversikt
-Check to update the email-address for this vendor      property        no      
kryss av for å oppdatere adressa til denne levedrandøren
-Choice property        no      Valg
-Choose a category      property        no      Velg en kategori
-Choose an ID   property        no      Velg en ID
-Choose charge tenant if the tenant i to pay for this project   property        
no      Kryss av for å belaste leietaker dersom leietakeren skal betale for 
arbeidene
-Choose columns property        no      Velg kolonner
-Choose Copy Hour to copy this hour to a new hour       property        no      
Kryss av for å kopiere denne posten til en ny post
-Choose Copy Project to copy this project to a new project      property        
no      Kryss av for å kopiere dette prosjektet til et nytt prosjekt
-Choose Copy request to copy this request to a new request      property        
no      Kryss av for å kopiere denne anmodningen til en ny anmodning
-Choose Copy Workorder to copy this workorder to a new workorder        
property        no      Kryss av for å kopiere denne arbeidsordren til en ny 
arbeidsordre
-Choose Generate ID to automaticly assign new ID based on type-prefix   
property        no      Kryss av for generere ny ID basert på type-prefiks
-Choose the end date for the next period        property        no      Velg 
slutt-dato for neste periode
-Choose the start date for the next period      property        no      Velg 
start-dato for neste periode
-Choose to send mailnotification        property        no      Velg å sende 
påminnelse på epost
-Chose if this column is nullable       property        no      Velg om denne 
kolonnen kan være uten verdier
-Claim  property        no      Krav
+check to update the email-address for this vendor      property        no      
kryss av for å oppdatere adressa til denne levedrandøren
+child_date     property        no      Dato for referert element
+choice property        no      Valg
+choose a category      property        no      Velg en kategori
+choose an id   property        no      Velg en ID
+choose charge tenant if the tenant i to pay for this project   property        
no      Kryss av for å belaste leietaker dersom leietakeren skal betale for 
arbeidene
+choose columns property        no      Velg kolonner
+choose copy hour to copy this hour to a new hour       property        no      
Kryss av for å kopiere denne posten til en ny post
+choose copy project to copy this project to a new project      property        
no      Kryss av for å kopiere dette prosjektet til et nytt prosjekt
+choose copy request to copy this request to a new request      property        
no      Kryss av for å kopiere denne anmodningen til en ny anmodning
+choose copy workorder to copy this workorder to a new workorder        
property        no      Kryss av for å kopiere denne arbeidsordren til en ny 
arbeidsordre
+choose generate id to automaticly assign new id based on type-prefix   
property        no      Kryss av for generere ny ID basert på type-prefiks
+choose the end date for the next period        property        no      Velg 
slutt-dato for neste periode
+choose the start date for the next period      property        no      Velg 
start-dato for neste periode
+choose to send mailnotification        property        no      Velg å sende 
påminnelse på epost
+chose if this column is nullable       property        no      Velg om denne 
kolonnen kan være uten verdier
+claim  property        no      Krav
 claim id       property        no      Krav ID
-Close  property        no      Avslutt
-Closed property        no      Avsluttet
-Close order    property        no      Avslutt Ordre
-Close this window      property        no      Steng vindu
-Code   property        no      Kode
+click this button to add a invice      property        no      Klikk på denne 
knappen for å legg til en faktura
+click this button to add a invoice     property        no      Klikk denne 
knappen for å legge til en faktura
+click this button to start the import  property        no      Press denne 
knappen for å starte importen
+click this link to edit the period     property        no      klikk denne 
linken for å rette perioden
+click this link to enter the list of sub-invoices      property        no      
klikk her for å entre liste over underbilag
+click this link to select      property        no      Klikk her for å velge
+click this link to select apartment    property        no      klikk her for å 
velge leilighet
+click this link to select budget account       property        no      klikk 
her for å velge budsjett konto
+click this link to select building     property        no      klikk her for å 
velge bygning
+click this link to select customer     property        no      Klikk her for å 
velge kunde
+click this link to select entrance     property        no      klikk her for å 
velge inngang
+click this link to select equipment    property        no      klikk her for å 
velge utstyr
+click this link to select property     property        no      klikk her for å 
velge eiendom
+click this link to select tenant       property        no      klikk her for å 
velge leietaker
+click this link to select vendor       property        no      klikk her for å 
velge leverandør
+click this link to view the remark     property        no      klikk her for å 
vise merknad
+click this to add an order to an existing project      property        no      
klikk her for å legge til en ny bestilling til et eksisterende prosjekt
+click this to generate a request with this information property        no      
klikk her for å generere en anmodning med basis denne informasjonen
+click this to generate a project with this information property        no      
klikk her for å lage ett nytt prosjekt med informasjon fra denne saken
+click to view file     property        no      Klikk for vise fil
+close  property        no      Avslutt
+closed property        no      Avsluttet
+close order    property        no      Avslutt Ordre
+close this window      property        no      Steng vindu
+code   property        no      Kode
+collapse all   property        no      Slå samen
 column could not be added      property        no      Kolonne kunne ikke 
legges til
-Column description     property        no      Beskrivelse av kolonne
+column description     property        no      Beskrivelse av kolonne
 column name    property        no      Kolonnenavn
-Column name    property        no      Kolonne navn
-Column name not entered!       property        no      Manglende kolonnenavn
+column name not entered!       property        no      Manglende kolonnenavn
 columns        property        no      kolonner
 columns is updated     property        no      Kolonner er oppdatert
-Coordination   property        no      Koordinering
 common costs   property        no      Fellsekostnader
-Condidtion degree      property        no      Tilstandsgrad
-Config property        no      Konfigurer
-Configuration  property        no      Konfigurasjon
-Confirm status property        no      Bekreft status
-Confirm status to the history  property        no      Bekreft status til 
historikk
-Consequence    property        no      Konsekvens
+communication descriptions manager     property        no      Kommunikasjons 
beskrivelse
+communication types manager    property        no      Type kommunikasjon
+condidtion degree      property        no      Tilstandsgrad
+config property        no      Konfigurer
+configuration  property        no      Konfigurasjon
+confirm status property        no      Bekreft status
+confirm status to the history  property        no      Bekreft status til 
historikk
+consequence    property        no      Konsekvens
 consequential damage   property        no      Følgeskader
-Consequential damage   property        no      Følgeskader
 consume        property        no      forbruk
-Contact        property        no      Kontakt
+contact        property        no      Kontakt
+contact email  property        no      Epost
 contact phone  property        no      kontakt telefon
-Contact phone  property        no      Kontakt telefon
-Contact Phone  property        no      Kontakt tlf
+contacts       common  no      Kontakter
 content        property        no      innhold
-Conversion     property        no      format
-Coordinator    property        no      Koordinator
-Coordinator changed    property        no      endret koordinator
-Copy hour ?    property        no      kopier post ?
-Copy project ? property        no      kopier prosjekt ?
-Copy request ? property        no      kopier anmodning ?
-Copy workorder ?       property        no      Kopier arbeidsordre ?
-Correct error  property        no      Rett opp feil
+contractual obligations        property        no      regnskap
+conversion     property        no      format
+coordination   property        no      Koordinering
+coordinator    property        no      Koordinator
+coordinator changed    property        no      endret koordinator
+copy hour ?    property        no      kopier post ?
+copy project ? property        no      kopier prosjekt ?
+copy request ? property        no      kopier anmodning ?
+copy workorder ?       property        no      Kopier arbeidsordre ?
+correct error  property        no      Rett opp feil
 cost   property        no      kostnad
-Cost   property        no      Kostnad
-Cost (incl tax):       property        no      Kostnader (inkl mva)
-Cost per unit  property        no      Enhetspris
-Could not find any location to save to!        property        no      Kunne 
ikke finne lokalisering å lagre til
-Count  property        no      tell
-Custom property        no      Tilpasset
+cost estimate  property        no      Kostnadsestimat
+cost - either budget or calculation    property        no      Beløp - enten 
budsjett eller kalkulalasjon
+cost (incl tax):       property        no      Kostnader (inkl mva)
+cost per unit  property        no      Enhetspris
+could not find any location to save to!        property        no      Kunne 
ikke finne lokalisering å lagre til
+count  property        no      Antall
+custom property        no      Tilpasset
 customer       property        no      Kunde
-Customer       property        no      Kunde
 custom function        property        no      Egendefinert funksjon
 custom function file not chosen!       property        no      Fil for 
egendefinert funskjon er ikke valgt
-Custom function has been edited        property        no      Egendefinert 
funksjon er  rettet
-Custom function has NOT been saved     property        no      Egendefinert 
funksjon er IKKE lagret
-Custom function ID     property        no      Egendefinert funksjons ID
+custom function has been edited        property        no      Egendefinert 
funksjon er  rettet
+custom function has not been saved     property        no      Egendefinert 
funksjon er IKKE lagret
+custom function id     property        no      Egendefinert funksjons ID
 custom functions       property        no      Egendefinert funksjoner
-Custom functions       property        no      Egendefinerte funksjoner
 custom functions for the entity category       property        no      
Egendefinert funksjoner for entitet-kategori
-Custom queries property        no      Egendefinerte spørringer
+custom queries property        no      Egendefinerte spørringer
+daily  property        no      Daglig
 data   property        no      data
-Data   property        no      Data
-Datatype       property        no      datatype
-Datatype type not chosen!      property        no      datatype er ikke valgt
-Date   property        no      Dato
-Date Closed    property        no      dato avsluttet
-Date Opened    property        no      Startet
-Date search    property        no      Dato søk
-Datetime       property        no      dato-tid
+datatype       property        no      datatype
+datatype type not chosen!      property        no      datatype er ikke valgt
+date closed    property        no      dato avsluttet
+date opened    property        no      Startet
+date search    property        no      Dato søk
+datetime       property        no      dato-tid
 day    property        no      dag
-Day    property        no      Dag
-Day of week (0-6, 0=Sun)       property        no      Ukedag (0-6, 0=søndag)
-Days   property        no      Dager
-Deadline       property        no      Frist
-Debug  property        no      kontroller
-Debug output in browser        property        no      Kontroller data før  
import
-Decimal        property        no      desimal
+day of week (0-6, 0=sun)       property        no      Ukedag (0-6, 0=søndag)
+days   property        no      Dager
+deadline       property        no      Frist
+debug  common  no      kontroller
+debug output in browser        property        no      Kontroller data før  
import
+decimal        property        no      desimal
 default        property        no      Standard
 default vendor category        property        no      Standard leverandør 
kategori
 default vendor category is updated     property        no      Standard 
leverandør kategori er oppdatert
 delay  property        no      forsinkelse
-Delete property        no      Slett
 delete activity        property        no      slett aktivitet
-Delete agreement and all the activities associated with it!    property        
no      slett avtale og alle aktiviteter assosiert med den
-Delete agreement group and all the activities associated with it!      
property        no      Slett avtalegruppe og alle aktiviteter som er assosiert 
med den
+delete agreement and all the activities associated with it!    property        
no      slett avtale og alle aktiviteter assosiert med den
+delete agreement group and all the activities associated with it!      
property        no      Slett avtalegruppe og alle aktiviteter som er assosiert 
med den
 delete apartment       property        no      seltt leilighjet
-Delete a single entry by passing the id.       property        no      slett 
en enkelt post ved å sende id
+delete a single entry by passing the id.       property        no      slett 
en enkelt post ved å sende id
 delete async method    property        no      Slett async metode
 delete budget account  property        no      Slett budsjettkonto
 delete building        property        no      slett bygning
 delete claim   property        no      Slett krav
-Delete column  property        no      Slett kolonne
+delete column  property        no      Slett kolonne
 delete custom  property        no      Slett egendefinert
 delete document        property        no      slett dokument
 delete entity  property        no      Slett entitet
 delete entity type     property        no      Slett entitet-type
 delete entrance        property        no      slett inngang
 delete equipment       property        no      slett utstyr
-Delete file    property        no      Slett fil
+delete file    property        no      Slett fil
 delete investment history element      property        no      slett historie 
post for investering
-Delete last entry      property        no      slett siste post
+delete last entry      property        no      slett siste post
 delete last index      property        no      Slett siste index
 delete location        property        no      Slett lokalisering
 delete location standard       property        no      Slett lokaliserings 
config verdi
@@ -376,8 +426,8 @@
 delete the deviation   property        no      Slett avvik
 delete the entity      property        no      Slett entitet
 delete the entrance    property        no      slett inngang
-Delete the entry       property        no      slett post
-delete the gab property        no      Slett GAB-info
+delete the entry       property        no      slett post
+delete the gab property        no      Slett GrunnEiendom
 delete the item        property        no      Slett post
 delete the last index  property        no      Slett siste index
 delete the location    property        no      Slett lokalisering
@@ -393,65 +443,72 @@
 delete the template    property        no      slett mal
 delete the voucher     property        no      Slett bilag
 delete this activity   property        no      slett aktivitet
-Delete this agreement  property        no      slett avtale
-Delete this agreement group    property        no      Slett denne 
avtalegruppen
-Delete this column from the output     property        no      Fjern denne 
kolonnen fra visning
+delete this agreement  property        no      slett avtale
+delete this agreement group    property        no      Slett denne 
avtalegruppen
+delete this column from the output     property        no      Fjern denne 
kolonnen fra visning
 delete this document   property        no      slett dokument
-Delete this entry      property        no      slett post
+delete this entity     property        no      Slett denne entiteten
+delete this entry      property        no      slett post
 delete this equipment  property        no      slett utstyr
 delete this hour       property        no      slett post
 delete this item       property        no      Slett denne posten
 delete this project    property        no      slett prosjekt
 delete this request    property        no      slett anmodning
-Delete this value from the list of multiple choice     property        no      
Slett denne verdien fra listen over fler-valg
+delete this value from the list of multiple choice     property        no      
Slett denne verdien fra listen over fler-valg
 delete this vendor from this activity  property        no      slett denne 
leverandøren fra denne aktiviteten
 delete this workorder  property        no      slett arbeidsordre
 delete ticket  property        no      slett melding
-Delete value   property        no      Slett verdi
+delete value   property        no      Slett verdi
 delete vendor activity property        no      slett aktivitet
 delete voucher property        no      Slett bilag
 delete workorder       property        no      slett arbeidsordre
-descr  property        no      beskrivelse
-Descr  property        no      beskrivelse
-Description    property        no      Beskrivelse
-Details        property        no      Detaljer
+delivered      property        no      Levert
+description    property        no      Beskrivelse
+description order      property        no      Bestilling til leverandør
+descr  property        no      Beskrivelse
+details        property        no      Detaljer
 deviation      property        no      Avvik
 deviation has been added       property        no      Avvik er lagt til
 deviation has been edited      property        no      Avvik er rettet
-deviation ID   property        no      Avvik ID
-Dim A  property        no      Dim A
-Dim A is missing       property        no      Dim A mangler
-Dima is missing from sub invoice in:   property        no      Dim A mangler 
fra underbilag i :
-Dim B  property        no      Dim B
-Dim D  property        no      Dim D
+deviation id   property        no      Avvik ID
+difference     property        no      Differanse
+dim a  property        no      Dim A
+dim a is missing       property        no      Dim A mangler
+dima is missing from sub invoice in:   property        no      Dim A mangler 
fra underbilag i :
+dim b  property        no      Kostnadssted
+dimb   property        no      Kostnadssted
+dimb roles     property        no      Roller kostnadssted
+no dimb        property        no      K Ikke valgt
+dim d  property        no      Dim D
 directory created      property        no      katalog er opprettet
-Disable        property        no      Deaktiver
+disable        property        no      Deaktiver
 disabled       property        no      inaktivt
-District       property        no      Område
+district       property        no      Område
 district_id    property        no      Distrikt ID
-Doc type       property        no      Dokumenttype
+doc type       property        no      Dokumenttype
 document       property        no      dokument
 document %1 has been edited    property        no      dokument %1 er rettet
 document %1 has been saved     property        no      dokument %1 er lagret
-Documentation  property        no      Dokumentasjon
-Documentation for locations    property        no      Dokumentasjon for 
arealer
+documentation  property        no      Dokumentasjon
+documentation for locations    property        no      Dokumentasjon for 
arealer
+document categories    property        no      Dokument kategorier
 document date  property        no      dokument dato
-document ID    property        no      dokument id
-Document name  property        no      dokument navn
+document id    property        no      dokument id
+document name  property        no      dokument navn
 documents      property        no      Dokumenter
-done   property        no      Avbryt
-Done   property        no      Avbryt
-Do not add this invoice        property        no      Ikke legg til denne 
fakturaen
-Do not import this invoice     property        no      Ikke importer dette 
bilaget
+document status        property        no      Dokument status
+domain name for mail-address, eg. %1   property        no      Domenenavn for 
e-post adresser
+do not add this invoice        property        no      Ikke legg til denne 
fakturaen
+do not import this invoice     property        no      Ikke importer dette 
bilaget
 down   property        no      Ned
-Down   property        no      Ned
+download       property        no      Last ned
 download table to your browser property        no      Last ned tabell til din 
nettleser
-download       property        no      Last ned
+do you really want to change the status to %1  property        no      Vil du 
virkelig endre status til %1
 do you really want to delete this entry        property        no      Vil du 
virkelig slette denne posten
-Do you really want to update the categories    property        no      vil du 
virkelig oppdatere kategoriene
-Do you really want to update the categories again      property        no      
vil du virkelig oppdatere kategoriene igjen
-DRAFT  property        no      UTKAST
-Edit   property        no      Oppdater
+do you really want to update the categories    property        no      vil du 
virkelig oppdatere kategoriene
+do you really want to update the categories again      property        no      
vil du virkelig oppdatere kategoriene igjen
+do you want to perform this action     property        no      Vil du 
gjennomføre denne handlingen
+draft  property        no      UTKAST
 edit activity  property        no      rette aktivitet
 edit agreement property        no      rette avtale
 edit agreement group   property        no      Rette avtale gruppe
@@ -459,31 +516,36 @@
 edit attribute property        no      endre attributt
 edit budget account    property        no      Rette budsjettkonto
 edit building  property        no      rette bygning
+edit categories        property        no      Endre kategorier
 edit category  property        no      Rette kategori
+edit claim     property        no      Endre klage
+edit custom fields     property        no      Editer egendefinerte felt
 edit custom function   property        no      Rette egendefinert funksjon
 edit/customise this hour       property        no      rett eller tilpass 
denne posten
 edit deviation property        no      Rette avvik
-Edit document  property        no      rette dokument
+edit document  property        no      rette dokument
 edit entity    property        no      Rette entitet
 edit entrance  property        no      rette inngang
 edit equipment property        no      rette utstyr
-Edit gab       property        no      Rette GAB-informasjon
-Edit hour      property        no      rette post
-Edit ID        property        no      rette ID
+edit gab       property        no      Editer GrunnEiendom
+edit hour      property        no      rette post
+edit id        property        no      rette ID
 edit info      property        no      Rette informasjon
 edit information about the document    property        no      Rette 
informasjon om dokumentet
 edit location config for       property        no      Rette konfigurasjon for 
lokalisering
+edit log levels        common  no      Endre log nivåer
 edit meter     property        no      rette måler
 edit method    property        no      Rette metode
-Edit period    property        no      rette periode
+edit period    property        no      rette periode
 edit pricing   property        no      rette prising
-Edit priority key      property        no      rette prioriterings nøkkel
-Edit Project   property        no      rette prosjekt
+edit priority key      property        no      rette prioriterings nøkkel
+edit project   property        no      rette prosjekt
 edit property  property        no      rette eiendom
-Edit request   property        no      rette anmodning
+edit request   property        no      rette anmodning
 edit standard  property        no      rette standard
-Edit status    property        no      Endre status
-Edit template  property        no      rette mal
+edit status    property        no      Endre status
+edit template  property        no      rette mal
+edit the account       property        no      Endre kontoen
 edit the actor property        no      Rette aktør
 edit the agreement     property        no      rette avtale
 edit the agreement_group       property        no      Rette avtalegruppe
@@ -498,10 +560,9 @@
 edit the custom_function       property        no      Rette egendefinert 
funksjon
 edit the deviation     property        no      Rette avvik
 edit the entity        property        no      Rette entitet
-Edit the entity        property        no      Rette entitet
 edit the entrance      property        no      rette inngang
 edit the equipment     property        no      rette utstyr
-edit the gab   property        no      Rette GAB-info
+edit the gab   property        no      Editer GrunnEiendom
 edit the location      property        no      Rette lokalisering
 edit the meter property        no      rette måler
 edit the method        property        no      Rette metoden
@@ -516,336 +577,342 @@
 edit the template      property        no      rette mal
 edit the workorder     property        no      rette arbeidsordre
 edit this activity     property        no      rette aktivitet
-Edit this entry        property        no      rette post
-Edit this entry equipment      property        no      rett utstyr
-Edit this entry project        property        no      rette prosjekt
-Edit this entry request        property        no      rett anmodning
-Edit this entry workorder      property        no      rett arbeidsordre
-Edit this meter        property        no      rett måler
-Edit Workorder property        no      Endre arbeidsordre
-Email  property        no      Epost
-E-Mail property        no      E-Post
-Enable property        no      Aktiver
-Enabled        property        no      Aktiv
-Enable file upload     property        no      Aktiver opplasting av filer
-Enables help message for this attribute        property        no      
Hjelpetekst for denne attributten
-Enable history for this attribute      property        no      Aktiver 
historikk for denne attributten
-Enable link from location detail       property        no      Aktiver link 
fra detaljer for areal
-Enable start project from this category        property        no      
Aktiviser mulighet for å starte prosjekt herfra
+edit this entity       property        no      Endre entiteten
+edit this entry        property        no      rette post
+edit this entry equipment      property        no      rett utstyr
+edit this entry project        property        no      rette prosjekt
+edit this entry request        property        no      rett anmodning
+edit this entry workorder      property        no      rett arbeidsordre
+edit this meter        property        no      rett måler
+edit workorder property        no      Endre arbeidsordre
+email-address of the user, eg. %1      property        no      E-post adresse 
for bruker, %1
+enable property        no      Aktiver
+enabled        property        no      Aktiv
+enable file upload     property        no      Aktiver opplasting av filer
+enable history for this attribute      property        no      Aktiver 
historikk for denne attributten
+enable link from location detail       property        no      Aktiver link 
fra detaljer for areal
+enables help message for this attribute        property        no      
Hjelpetekst for denne attributten
+enable start project from this category        property        no      
Aktiviser mulighet for å starte prosjekt herfra
 end    property        no      slutt
 end date       property        no      sluttdato
-End date       property        no      Slutt dato
-Enter additional remarks to the description - if any   property        no      
gi en merknad - om noen
-Enter a descr for the custom function  property        no      Angi en 
beskrivelse av egendefinert funksjon
-Enter a description for prerequisitions for this activity - if any     
property        no      gi en beskrivelse av nødvendige grunnlagsarbeid - om 
noen - for denne aktiviteten
-Enter a description of the deviation   property        no      Angi en 
beskrivelse av avviket
-Enter a description of the document    property        no      gi en 
beskrivelse av dokumentet
-Enter a description of the equipment   property        no      gi en 
beskrivelse av utstyret
-Enter a description of the project     property        no      gi en 
beskrivelse av prosjektet
-Enter a description of the request     property        no      gi en 
beskrivelse av anmodningen
-Enter a description of the standard    property        no      gi en 
beskrivelse av standarden
-Enter a description of the status      property        no      Angi en 
beskrivelse av statusen
-Enter a description the attribute      property        no      gi en 
beskrivelse av attributten
-Enter a description the budget account property        no      Angi en 
beskrivelse av budsjettkontoen
-Enter a description the category       property        no      Angi en 
beskrivelse av kategorien
-Enter a description the method property        no      Angi en beskrivelse av 
metoden
-Enter a description the standard       property        no      gi en 
beskrivelse av  standarden
-Enter a meter ID !     property        no      Angi måler ID
-Enter a name for the query     property        no      Angi et navn for 
spørringen
-Enter a name for this part of town     property        no      Angi ett navn 
for denne bydelen
-Enter a name of the standard   property        no      gi standarden et navn
-Enter a new grouping for this activity if not found in the list        
property        no      skriv inn en ny gruppering for denne posten om den ikke 
finnes i listen
-Enter a new index      property        no      gi en ny index
-Enter a new writeoff period if it is NOT in the list   property        no      
skriv inn en ny avskrivningsperiode om den ikke finnes i listen
-Enter any persentage addition per unit property        no      angi prosentvis 
tillegg pr enhet
-Enter any remarks regarding this apartment     property        no      angi 
merknader vedrørende denne leiligheten
-Enter any remarks regarding this building      property        no      angi 
merknader vedrørende denne bygningen
-Enter any remarks regarding this entrance      property        no      angi 
merknader vedrørende denne inngangen
-Enter any round sum addition per order property        no      angi riggtillegg
-Enter apartment ID     property        no      angi leilighets ID
-Enter a remark for this claim  property        no      Angi en merknad for 
dette kravet
-Enter a remark for this entity property        no      Angi en merknad for 
denne entiteten
-Enter a remark - if any        property        no      gi en merknad - om noen
-Enter a short description of the workorder     property        no      Gi en 
kort beskrivelse av arbeidsordren
-Enter a short description of this template     property        no      Gi en 
kort beskrivelse av malen
-Enter a sql query      property        no      Skriv inn en sql-spørring
-Enter a standard prefix for the id     property        no      Angi et prefix 
for ID
-Enter a standard prefix for the id of the equipments   property        no      
Angi et standard prefix for utstyr av denne typen
-Enter a statustext for the inputfield in forms property        no      Angi en 
statustekst for inputfeltet
-Enter a value for the labour cost      property        no      angi arbeids 
kostnader
-Enter a value for the material cost    property        no      angi 
materialkostnader
-Enter Building ID      property        no      angi bygnings ID
-Enter document Name    property        no      angi dokument ID
-Enter document title   property        no      angi dokument tittel
-Enter document version property        no      angi dokument versjon
-Enter entrance ID      property        no      angi inngangs ID
-Enter equipment ID     property        no      angi utstyrs ID
-Enter Invoice Number   property        no      Angi bilagsnummer
-Enter Kid nr   property        no      Angi KID nr
-Enter other branch if not found in the list    property        no      Angi 
andre fag om det ikke finnes i listen
-Enter Project Name     property        no      Angi Prosjekt navn
-Enter quantity of unit property        no      angi mengde
-Enter request Title    property        no      angi tittel for anmodning
-Enter the attribute ID property        no      angi attributt ID
-Enter the attribute value for this entity      property        no      angi 
attributt verdi for denne posten
-Enter the budget       property        no      Angi budsjett
-Enter the budget account       property        no      Angi budsjettkonto
-Enter the category ID  property        no      Angi kategori ID
-Enter the cost per unit        property        no      angi kostnad pr enhet
-Enter the date for this reading        property        no      Angi dato for 
denne avlesningen
+enter additional remarks to the description - if any   property        no      
gi en merknad - om noen
+enter a descr for the custom function  property        no      Angi en 
beskrivelse av egendefinert funksjon
+enter a description for prerequisitions for this activity - if any     
property        no      gi en beskrivelse av nødvendige grunnlagsarbeid - om 
noen - for denne aktiviteten
+enter a description of the deviation   property        no      Angi en 
beskrivelse av avviket
+enter a description of the document    property        no      gi en 
beskrivelse av dokumentet
+enter a description of the equipment   property        no      gi en 
beskrivelse av utstyret
+enter a description of the project     property        no      gi en 
beskrivelse av prosjektet
+enter a description of the request     property        no      gi en 
beskrivelse av anmodningen
+enter a description of the standard    property        no      gi en 
beskrivelse av standarden
+enter a description of the status      property        no      Angi en 
beskrivelse av statusen
+enter a description the attribute      property        no      gi en 
beskrivelse av attributten
+enter a description the budget account property        no      Angi en 
beskrivelse av budsjettkontoen
+enter a description the category       property        no      Angi en 
beskrivelse av kategorien
+enter a description the method property        no      Angi en beskrivelse av 
metoden
+enter a description the standard       property        no      gi en 
beskrivelse av  standarden
+enter a meter id !     property        no      Angi måler ID
+enter a name for the query     property        no      Angi et navn for 
spørringen
+enter a name for this part of town     property        no      Angi ett navn 
for denne bydelen
+enter a name of the standard   property        no      gi standarden et navn
+enter a new grouping for this activity if not found in the list        
property        no      skriv inn en ny gruppering for denne posten om den ikke 
finnes i listen
+enter a new index      property        no      gi en ny index
+enter a new writeoff period if it is not in the list   property        no      
skriv inn en ny avskrivningsperiode om den ikke finnes i listen
+enter any persentage addition per unit property        no      angi prosentvis 
tillegg pr enhet
+enter any remarks regarding this apartment     property        no      angi 
merknader vedrørende denne leiligheten
+enter any remarks regarding this building      property        no      angi 
merknader vedrørende denne bygningen
+enter any remarks regarding this entrance      property        no      angi 
merknader vedrørende denne inngangen
+enter any round sum addition per order property        no      angi riggtillegg
+enter apartment id     property        no      angi leilighets ID
+enter a remark for this claim  property        no      Angi en merknad for 
dette kravet
+enter a remark for this entity property        no      Angi en merknad for 
denne entiteten
+enter a remark - if any        property        no      gi en merknad - om noen
+enter a remark to add to the history of the project    property        no      
Legg til en merknad til historikken for prosjektet
+enter a short description of the workorder     property        no      Gi en 
kort beskrivelse av arbeidsordren
+enter a short description of this template     property        no      Gi en 
kort beskrivelse av malen
+enter a sql query      property        no      Skriv inn en sql-spørring
+enter a standard prefix for the id     property        no      Angi et prefix 
for ID
+enter a standard prefix for the id of the equipments   property        no      
Angi et standard prefix for utstyr av denne typen
+enter a statustext for the inputfield in forms property        no      Angi en 
statustekst for inputfeltet
+enter a value for the labour cost      property        no      angi arbeids 
kostnader
+enter a value for the material cost    property        no      angi 
materialkostnader
+enter building id      property        no      angi bygnings ID
+enter document name    property        no      angi dokument ID
+enter document title   property        no      angi dokument tittel
+enter document version property        no      angi dokument versjon
+enter entrance id      property        no      angi inngangs ID
+enter equipment id     property        no      angi utstyrs ID
+enter invoice number   property        no      Angi bilagsnummer
+enter kid nr   property        no      Angi KID nr
+enter other branch if not found in the list    property        no      Angi 
andre fag om det ikke finnes i listen
+enter project name     property        no      Angi Prosjekt navn
+enter quantity of unit property        no      angi mengde
+enter request title    property        no      angi tittel for anmodning
+enter the attribute id property        no      angi attributt ID
+enter the attribute value for this entity      property        no      angi 
attributt verdi for denne posten
+enter the budget       property        no      Angi budsjett
+enter the budget account       property        no      Angi budsjettkonto
+enter the category id  property        no      Angi kategori ID
+enter the cost per unit        property        no      angi kostnad pr enhet
+enter the date for this reading        property        no      Angi dato for 
denne avlesningen
 enter the default value        property        no      Angi standard-verdi
-Enter the description  property        no      angi beskrivelse
-Enter the description for this activity        property        no      angi 
beskrivelse av denne aktiviteten
-Enter the description for this template        property        no      angi 
beskrivelse av denne malen
-Enter the details of this ticket       property        no      angi detaljer 
for meldingen
-Enter the email-address for this user  property        no      Oppgi 
epostadressen for denne brukeren
-Enter the expected longevity in years  property        no      angi forventet 
levetid [Ã¥r]
-Enter the floor        property        no      angi etasje
-Enter the floor ID     property        no      angi etasje ID
-Enter the general address      property        no      angi generell adresse
+enter the description  property        no      angi beskrivelse
+enter the description for this activity        property        no      angi 
beskrivelse av denne aktiviteten
+enter the description for this template        property        no      angi 
beskrivelse av denne malen
+enter the details of this ticket       property        no      angi detaljer 
for meldingen
+enter the email-address for this user  property        no      Oppgi 
epostadressen for denne brukeren
+enter the expected longevity in years  property        no      angi forventet 
levetid [Ã¥r]
+enter the floor        property        no      angi etasje
+enter the floor id     property        no      angi etasje ID
+enter the general address      property        no      angi generell adresse
 enter the input text for records       property        no      Angi ledetekst 
for datafelt
-Enter the invoice date property        no      angi faktura dato
-Enter the meter ID     property        no      angi måler ID
-Enter the method ID    property        no      Angi metode ID
+enter the invoice date property        no      angi faktura dato
+enter the meter id     property        no      angi måler ID
+enter the method id    property        no      Angi metode ID
 enter the name for the column  property        no      Angi navn for kolonne i 
database
 enter the name for this location       property        no      Angi navn for 
denne lokaliseringen
-Enter the name of the apartment        property        no      angi navn for 
leiligheten
-Enter the name of the building property        no      angi navn for bygningen
-Enter the name of the entrance property        no      angi navn for inngangen
-Enter the name of the meter    property        no      angi navn for måleren
-Enter the name of the property property        no      angi navn for eiendommen
-Enter the name the template    property        no      angi navn for malen
-Enter the payment date or the payment delay    property        no      angi 
betalingsdato eller antall dager til forfall
-Enter the power_meter  property        no      angi måler
-Enter the Property ID  property        no      angi eiendoms ID
-Enter the purchase cost        property        no      angi anskaffelses 
kostnad
+enter the name of the apartment        property        no      angi navn for 
leiligheten
+enter the name of the building property        no      angi navn for bygningen
+enter the name of the entrance property        no      angi navn for inngangen
+enter the name of the meter    property        no      angi navn for måleren
+enter the name of the property property        no      angi navn for eiendommen
+enter the name the template    property        no      angi navn for malen
+enter the payment date or the payment delay    property        no      angi 
betalingsdato eller antall dager til forfall
+enter the power meter  property        no      Legg til måleren
+enter the power_meter  property        no      angi måler
+enter the property id  property        no      angi eiendoms ID
+enter the purchase cost        property        no      angi anskaffelses 
kostnad
 enter the record length        property        no      Angi lengde for datafelt
-Enter the reserve      property        no      Angi reserve
+enter the reserve      property        no      Angi reserve
 enter the scale if type is decimal     property        no      Angi skala 
dersom type er desimal
-Enter the search string. To show all entries, empty this field and press the 
SUBMIT button again       property        no      angi søkestrengen. for å vise 
alle poster, tøm dette feltet og søk på nytt
-Enter the standard ID  property        no      angi standard ID
-Enter the status ID    property        no      Angi statius ID
-Enter the street number        property        no      angi gatenummer
-Enter the subject of this ticket       property        no      angi overskrift 
for denne meldingen
-Enter the total cost of this activity - if not to be calculated from unit-cost 
property        no      angi total kostnad for denne posten - dersom den ikke 
skal beregnes fra enhetskostnader
-enter the Workorder ID to search by workorder - at any date    property        
no      angi arbeidsordre ID for å søke etter arbeidsordre - gjelder alle datoer
-Enter Workorder title  property        no      angi arbeidsordre tittel
+enter the search string. to show all entries, empty this field and press the 
submit button again       property        no      angi søkestrengen. for å vise 
alle poster, tøm dette feltet og søk på nytt
+enter the standard id  property        no      angi standard ID
+enter the status id    property        no      Angi statius ID
+enter the street number        property        no      angi gatenummer
+enter the subject of this ticket       property        no      angi overskrift 
for denne meldingen
+enter the total cost of this activity - if not to be calculated from unit-cost 
property        no      angi total kostnad for denne posten - dersom den ikke 
skal beregnes fra enhetskostnader
+enter the workorder id to search by workorder - at any date    property        
no      angi arbeidsordre ID for å søke etter arbeidsordre - gjelder alle datoer
+enter workorder title  property        no      angi arbeidsordre tittel
 entity property        no      type
 entity has been added  property        no      Entitet er lagt til
 entity has been edited property        no      Entitet er rettet
-entity has NOT been edited     property        no      Entitet er IKKE rettet
-Entity has NOT been saved      property        no      Entitet er IKKE lagret
-Entity ID      property        no      entitet ID
-Entity name    property        no      entitet navn
-Entity not chosen      property        no      Entitet er ikke valgt
+entity has not been edited     property        no      Entitet er IKKE rettet
+entity has not been saved      property        no      Entitet er IKKE lagret
+entity id      property        no      entitet ID
+entity name    property        no      entitet navn
+entity not chosen      property        no      Entitet er ikke valgt
 entity num     property        no      Entitet num
-Entity Type    property        no      entitet type
+entity type    property        no      entitet type
 entity type not chosen!        property        no      Entitet type er ikke 
valgt
-Entity type not chosen!        property        no      entitet type er ikke 
valgt
-Entrance       property        no      inngang
-Entrance has been edited       property        no      inngang er rettet
-Entrance has been saved        property        no      inngang er lagret
+entrance       property        no      inngang
+entrance has been edited       property        no      inngang er rettet
+entrance has been saved        property        no      inngang er lagret
 entrance id    property        no      inngang ID
-Entry Date     property        no      Entry date
-Equipment      property        no      Utstyr
+entry date     property        no      Dato
+entry_date     property        no      Dato
+equipment      property        no      Utstyr
 equipment %1 has been edited   property        no      utstyr %1 er rettet
-Equipment %1 has been saved    property        no      utstyr %1 er lagret
+equipment %1 has been saved    property        no      utstyr %1 er lagret
+equipment id   property        no      utstyr ID
 equipment_id   property        no      utstyr ID
-equipment ID   property        no      utstyr ID
-Equipment type property        no      Type utstyr/anlegg
-Event  property        no      Hendelse
-Events property        no      Hendelser
-Example        property        no      Eksempel
+equipment type property        no      Type utstyr/anlegg
+event  property        no      Hendelse
+event action   property        no      Handling ved hendelse
+events property        no      Hendelser
+example        property        no      Eksempel
+expand all     property        no      Vis alle
 exp date       property        no      Utgått dato
-Export date    property        no      Eksport dato
-Export invoice property        no      Overfør
-Export to file property        no      Eksport til fil
-Extra  property        no      Ekstra
-Failed to copy file !  property        no      Kopiering av fil feilet!
+export contacts        property        no      Eksporter kontakter
+export date    property        no      Eksport dato
+export invoice property        no      Overfør
+export to file property        no      Eksport til fil
+extra  property        no      Ekstra
+f      property        no      F
+failed to copy file !  property        no      Kopiering av fil feilet!
 failed to create directory     property        no      klarte ikke å lage 
katalog
 failed to delete file  property        no      klarte ikke å slette fil
-Failed to upload file !        property        no      Opplasting av fil 
feilet!
-False  property        no      False
-Feste nr       property        no      Feste nr
-Fetch the history for this item        property        no      Hent historikk 
for dette elementet
-File   property        no      fil
+failed to upload file !        property        no      Opplasting av fil 
feilet!
+false  property        no      False
+feste nr       property        no      Feste nr
+fetch the history for this item        property        no      Hent historikk 
for dette elementet
+file   property        no      fil
 file deleted   property        no      fil er slettet
-Filename       property        no      Filnavn
-files  property        no      Filer
-finnish date   property        no      ferdig dato
+filename       property        no      Filnavn
+find and register all application hooks        property        no      Finn og 
registrer alle Hooks
+finnish date   property        no      Ferdig dato
+finnish_date   property        no      Ferdig dato
 finnish date changed   property        no      endret ferdig-dato
-First entry is added!  property        no      fil er lagt til
-first name     property        no      Fornavn
-Firstname      property        no      Fornavn
-First Note Added       property        no      første notat er lagt til
-Floor  property        no      Etasje
-Floor common   property        no      Etasje felles
-Floor ID       property        no      etasje ID
-Force year for period  property        no      Overstyr år for periode
+first entry is added!  property        no      fil er lagt til
+firstname      property        no      Fornavn
+first name of the user, eg. %1 property        no      Fornavn til bruker, %1
+first note added       property        no      første notat er lagt til
+float  property        no      Flyttall
+floor  property        no      Etasje
+floor common   property        no      Etasje felles
+floor id       property        no      etasje ID
+fm_vendor      property        no      Leverandør
+force year for period  property        no      Overstyr år for periode
 fraction       property        no      Fraksjon
-From   property        no      Fra
+from   property        no      Fra
 from date      property        no      Fra dato
-Funding        property        no      Finansiering
+funding        property        no      Finansiering
 gaards nr      property        no      GÃ¥rdsNr
-gab    property        no      GAB
-GAB    property        no      GAB
-gabnr  property        no      GabNr
-General        property        no      Generelt
-General Address        property        no      Generell adresse
-General Info   property        no      generell informasjon
-Generate a project from this request   property        no      generer et 
prosjekt basert på denne anmodningen
-Generate ID ?  property        no      generer ID
-Generate order property        no      Lag bestilling
-Generate project       property        no      generer prosjekt
-Generate Request       property        no      Registrer behov
-Group  property        no      Gruppe
+gab    property        no      GrunnEiendom
+gabnr  property        no      GrunnEiendom
+general        property        no      Generelt
+general address        property        no      Generell adresse
+general info   property        no      generell informasjon
+generate a project from this request   property        no      generer et 
prosjekt basert på denne anmodningen
+generate id ?  property        no      generer ID
+generate order property        no      Lag bestilling
+generate project       property        no      generer prosjekt
+generate request       property        no      Registrer behov
+generate new project   property        no      Registrer nytt prosjekt
+global property        no      Global
+global categories      property        no      Globale kategorier
+global configuration   property        no      Global konfigurasjon
+grant access   property        no      Gi tilgang
+group  property        no      Gruppe
 grouping       property        no      Gruppering
-groups property        no      Grupper
-Groups property        no      Grupper
-Help   property        no      Hjelp
 helpdesk       property        no      Meldinger
-Helpdesk       property        no      Meldinger
 help message   property        no      hjelpetekst
-Highest        property        no      Høyest
-History        property        no      Historikk
-History not allowed for this datatype  property        no      Historikk er 
ikke tilgjengelig for denne datatypen
+highest        property        no      Høyest
+history        property        no      Historikk
+history not allowed for this datatype  property        no      Historikk er 
ikke tilgjengelig for denne datatypen
 history of this attribute      property        no      Historie for denne 
attributten
+hits   property        no      Treff
 hour   property        no      Time
-Hour   property        no      Time
 hour %1 has been deleted       property        no      post %1 er slettet
 hour %1 has been edited        property        no      post %1 er rettet
 hour %1 is added!      property        no      post %1 er lagt til
-Hour ID        property        no      Post ID
-ID     property        no      ID
-ID is updated  property        no      ID er oppdatert
-ID not entered!        property        no      ID er ikke valgt
-If files can be uploaded for this category     property        no      Om 
filer skal kunne lastes opp for denne kategorien
-If this entity type is to be linked to a location      property        no      
Om denne entitetstypen skal linkes til en lokalisering
-If this entity type is to be linked to documents       property        no      
Om denne entitetstypen skal linkes til dokumentasjon
-If this entity type is to be tracket in ticket list    property        no      
Om denne entiteten skal spores fra helpdesk
-If this entity type is to look up tenants      property        no      Om 
denne entiteten skal gjøre oppslag på leietakere
-Import property        no      Import
-Importance     property        no      Viktighet
-Import from CSV        property        no      Fil - import til Faktura
-Import invoice property        no      Import faktura
-Import this invoice    property        no      Importer denne fakturaen
+hour category  property        no      Post kategori
+hour id        property        no      Post ID
+id     property        no      ID
+id control     property        no      ID kontroll
+id is updated  property        no      ID er oppdatert
+id not entered!        property        no      ID er ikke valgt
+if files can be uploaded for this category     property        no      Om 
filer skal kunne lastes opp for denne kategorien
+if this entity type is to be linked to a location      property        no      
Om denne entitetstypen skal linkes til en lokalisering
+if this entity type is to be linked to documents       property        no      
Om denne entitetstypen skal linkes til dokumentasjon
+if this entity type is to be tracket in ticket list    property        no      
Om denne entiteten skal spores fra helpdesk
+if this entity type is to look up tenants      property        no      Om 
denne entiteten skal gjøre oppslag på leietakere
+import property        no      Import
+importance     property        no      Viktighet
+import detail  property        no      Importer detalj
+import details to this agreement from spreadsheet      property        no      
Import detaljer til denne avtalen fra regneark
+import from csv        property        no      Fil - import til Faktura
+import invoice property        no      Import faktura
+import this invoice    property        no      Importer denne fakturaen
+import vcard   common  no      Importer visittkort
 incl tax       property        no      inkl mva
 include in location form       property        no      Inkluder i 
lokaliseringsskjema
-Include in search      property        no      Inkluder i søk
-Include the workorder to this claim    property        no      Inkluder 
arbeidsordren i dette kravet
+include in search      property        no      Inkluder i søk
+include the workorder to this claim    property        no      Inkluder 
arbeidsordren i dette kravet
 include this entity    property        no      Inkluder denne entiteten
 index  property        no      indeks
+index count    property        no      Antall
 index_count    property        no      indeks teller
-Index count    property        no      Antall
-Index date     property        no      Dato for indeks
+index date     property        no      Dato for indeks
 indoor climate property        no      Innendørs klima
-Indoor climate property        no      Inneklima
-Initial Category       property        no      Initiell kategori
-Initial Coordinator    property        no      Initiell koordinator
-Initials       property        no      Initialer
-Initial Status property        no      Initiell status
-Initial value  property        no      Initiell verdi
-In progress    property        no      PÃ¥begynt
+initial category       property        no      Initiell kategori
+initial coordinator    property        no      Initiell koordinator
+initials       property        no      Initialer
+initial status property        no      Initiell status
+initial value  property        no      Initiell verdi
+in progress    property        no      PÃ¥begynt
 inputdata for the method       property        no      inputdata for metoden
-Input data for the nethod      property        no      Input data til metoden
+input data for the nethod      property        no      Input data til metoden
 input text     property        no      ledetekst
-Input text not entered!        property        no      Input tekst er ikke 
angitt!
+input text not entered!        property        no      Input tekst er ikke 
angitt!
 insert the date for the acquisition    property        no      angi dato for 
anskaffelsen
 insert the date for the initial value  property        no      angi dato for 
initiell verdi
 insert the value at the start-date as a positive amount        property        
no      angi verdie ved startdatoen som en positiv verdi
-Integer        property        no      heltall
-Investment     property        no      investering
-Investment added !     property        no      Investering er lagt til
+integer        property        no      heltall
+interval       property        no      intervall
+investment     property        no      investering
+investment added !     property        no      Investering er lagt til
 investment history     property        no      Investerings historie
 investment id  property        no      investering ID
-Investment ID: property        no      investering ID:
-Investment value       property        no      Avskrivning
-Invoice        property        no      Faktura
+investment id: property        no      investering ID:
+investment value       property        no      Avskrivning
+invoice        property        no      Faktura
 invoice date   property        no      Faktura dato
-Invoice Id     property        no      Faktura ID
-Invoice is NOT added!  property        no      Fakturaen er IKKE lagt til!
-Invoice Number property        no      Faktura nr
-Invoice tranferred     property        no      bilag er overført
+invoice id     property        no      Faktura ID
+invoice is not added!  property        no      Fakturaen er IKKE lagt til!
+invoice number property        no      Faktura nr
+invoice tranferred     property        no      bilag er overført
 is registered  property        no      er registert
-Is there a demand from the authorities to correct this condition?      
property        no      Finnes det offentlige pålegg fo å rette opp tilstanden?
-Janitor        property        no      Oppsynsmann
+is there a demand from the authorities to correct this condition?      
property        no      Finnes det offentlige pålegg fo å rette opp tilstanden?
+items  property        no      Detaljer
+janitor        property        no      Oppsynsmann
 key deliver location   property        no      Sted for å levere nøkkel
-key fetch location     property        no      sted for å hente nøkkel
+key fetch location     property        no      Sted for å hente nøkkel
+key location   property        no      Nøkkel lokalisert
 key responsible        property        no      Nøkkel ansvarlig
-KID nr property        no      KID nr
-click this button to add a invice      property        no      Klikk på denne 
knappen for å legg til en faktura
-click this button to start the import  property        no      Press denne 
knappen for å starte importen
-click this link to edit the period     property        no      klikk denne 
linken for å rette perioden
-click this link to enter the list of sub-invoices      property        no      
klikk her for å entre liste over underbilag
-click this link to select      property        no      Klikk her for å velge
-click this link to select apartment    property        no      klikk her for å 
velge leilighet
-click this link to select budget account       property        no      klikk 
her for å velge budsjett konto
-click this link to select building     property        no      klikk her for å 
velge bygning
-click this link to select customer     property        no      Klikk her for å 
velge kunde
-click this link to select entrance     property        no      klikk her for å 
velge inngang
-click this link to select equipment    property        no      klikk her for å 
velge utstyr
-click this link to select property     property        no      klikk her for å 
velge eiendom
-click this link to select tenant       property        no      klikk her for å 
velge leietaker
-click this link to select vendor       property        no      klikk her for å 
velge leverandør
-click this link to view the remark     property        no      klikk her for å 
vise merknad
-click this to generate an order with this information  property        no      
klikk her for å generere et prosjekt med basis denne informasjonen
-click this to generate a request with this information property        no      
klikk her for å generere en anmodning med basis denne informasjonen
-click to view file     property        no      Klikk for vise fil
+kid nr property        no      KID nr
 kommune nr     property        no      Kommune nr
-KreditNota     property        no      Kreditnota
-Labour cost    property        no      Arbeid
-Large  property        no      Stor
-Last index     property        no      Siste indeks
-last name      property        no      Etternavn
-Lastname       property        no      Etternavn
-Leave the actor untouched and return back to the list  property        no      
Forlat aktøren uendret og returner til oversikten
-Leave the agreement untouched and return back to the list      property        
no      Forlat avtalen uendret og returner til oversikten
-Leave the claim untouched and return back to the list  property        no      
Forlat kravet uendret og returner til oversikten
-Leave the custom untouched and return back to the list property        no      
Forlat egendefinert uendret og returner til oversikten
-Leave the owner untouched and return back to the list  property        no      
Forlat eier uendret og returner til oversikten
-Leave the part of town untouched and return back to the list   property        
no      Forlat bydel uendret og returner til oversikten
-Leave the rental agreement untouched and return back to the list       
property        no      Forlat leieavtalen uendret og returner til oversikten
-Leave the service agreement untouched and return back to the list      
property        no      Forlat serviceavtalen uendret og returner til oversikten
-Let this entity show up in location form       property        no      Vis 
denne entiteten i lokaliseringsskjemaet
-Link   property        no      Lenke
-Link from location     property        no      Lenke fra lokalisering
-Link to the origin for this request    property        no      Link til 
opprinnelsen for dette tiltaket
-Link to the project originatet from this request       property        no      
Link til prosjektet som har opprinnelse fra dette tiltaket
-Link to the project originatet from this ticket        property        no      
Link til prosjektet som har opprinnelse fra denne hendelsen
-Link to the request for this project   property        no      Link til tiltak 
omfattet av dette prosjektet
-Link to the request originatet from this ticket        property        no      
Link til tiltak som har opprinnelse fra dette hendelsen
+kreditnota     property        no      Kreditnota
+labour cost    property        no      Arbeid
+large  property        no      Stor
+last index     property        no      Siste indeks
+lastname       property        no      Etternavn
+last name of the user, eg. %1  property        no      Etternavn til bruker, %1
+laws and regulations   property        no      Lover og forskrifter
+leave the actor untouched and return back to the list  property        no      
Forlat aktøren uendret og returner til oversikten
+leave the agreement untouched and return back to the list      property        
no      Forlat avtalen uendret og returner til oversikten
+leave the claim untouched and return back to the list  property        no      
Forlat kravet uendret og returner til oversikten
+leave the custom untouched and return back to the list property        no      
Forlat egendefinert uendret og returner til oversikten
+leave the owner untouched and return back to the list  property        no      
Forlat eier uendret og returner til oversikten
+leave the part of town untouched and return back to the list   property        
no      Forlat bydel uendret og returner til oversikten
+leave the rental agreement untouched and return back to the list       
property        no      Forlat leieavtalen uendret og returner til oversikten
+leave the service agreement untouched and return back to the list      
property        no      Forlat serviceavtalen uendret og returner til oversikten
+let this entity show up in location form       property        no      Vis 
denne entiteten i lokaliseringsskjemaet
+link   property        no      Lenke
+link from location     property        no      Lenke fra lokalisering
+link to the origin for this request    property        no      Link til 
opprinnelsen for dette tiltaket
+link to the project originatet from this request       property        no      
Link til prosjektet som har opprinnelse fra dette tiltaket
+link to the project originatet from this ticket        property        no      
Link til prosjektet som har opprinnelse fra denne hendelsen
+link to the request for this project   property        no      Link til tiltak 
omfattet av dette prosjektet
+link to the request originatet from this ticket        property        no      
Link til tiltak som har opprinnelse fra dette hendelsen
+link_view      property        no      Vis lenke
+list   property        no      Oversikt
 list activities per agreement  property        no      List aktiviteter pr 
avtale
 list activities per agreement_group    property        no      List 
aktiviteter pr avtalegruppe
 list agreement property        no      list avtale
 list agreement group   property        no      List avtalegruppe
+list alarm     property        no      Oversikt alarm
 list apartment property        no      list leilighet
 list async method      property        no      List async-metode
 list attribute property        no      List attributter
-ListBox        property        no      ListBox
+listbox        property        no      ListBox
+list budget    property        no      Oversikt budsjett
 list budget account    property        no      list budsjett konto
 list building  property        no      list bygning
+list claim     property        no      Oversikt klage
 list config    property        no      List konfigurasjon
 list consume   property        no      list forbruk
+list custom    property        no      List tilpasset
 list custom function   property        no      List egendefinerte funksjoner
 list deviation property        no      List avvik
 list document  property        no      list dokumenter
+list documents property        no      Oversikt dokument
 list entity attribute  property        no      List entitet-attributter
 list entity custom function    property        no      List egendefinerte 
funskjoner for entiteter
 list entity type       property        no      List entitet-type
 list entrance  property        no      list inngang
 list equipment property        no      list utstyr
-list gab       property        no      List GAB-info
-list gab detail        property        no      List GAB-detaljer
+list gab       property        no      List GrunnEiendom
+list gab detail        property        no      List GrunnEiendom-detaljer
 list hours     property        no      List timer
 list investment        property        no      List investeringer
 list invoice   property        no      List bilag
 list location attribute        property        no      List lokaliserings 
attributter
 list location standard property        no      List lokaliserings standard
 list meter     property        no      List måler
+list obligations       property        no      Oversikt regnskap
 list paid invoice      property        no      List betalte bilag
 list pricebook property        no      list prisbok
 list pricebook per vendor      property        no      List prisbok pr 
leverandør
-list Project   property        no      List Prosjekt
+list project   property        no      List Prosjekt
 list property  property        no      List eiendom
 list request   property        no      List Anmodning
 list standard description      property        no      List standard 
beskrivelse
@@ -854,719 +921,775 @@
 list template  property        no      List mal
 list tenant    property        no      List leietaker
 list ticket    property        no      List melding
+list vendor    property        no      Oversikt leverandører
 list vendors   property        no      List leverandør
 list vendors per activity      property        no      List leverandør pr 
aktivitet
 list voucher   property        no      list underbilag
 list workorder property        no      List arbeidsordre
-location       property        no      lokalisering
-Location       property        no      Lokalisering
-Location code  property        no      Lokaliserings kode
-Location Config        property        no      Konfigurering av lokalisering
+location       property        no      Lokalisering
+loc1_name      property        no      Navn
+location changed       property        no      Lokalisering er endret
+location code  property        no      Lokaliserings kode
+location_code  property        no      Lokaliserings kode
+location config        property        no      Konfigurering av lokalisering
 location form  property        no      Lokaliseringsskjema
 location level property        no      Lokaliserings-nivå
+location manager       property        no      Forvalter lokasjon
 location not chosen!   property        no      Lokalisering er ikke valgt
-Location type  property        no      Lokaliserings type
-Location type not chosen!      property        no      Lokaliseringsnivå ikke 
valgt
-Longevity      property        no      Levetid
+location type  property        no      Lokaliserings type
+location type not chosen!      property        no      Lokaliseringsnivå ikke 
valgt
+longevity      property        no      Levetid
 lookup property        no      Slå opp
 lookup tenant  property        no      Slå opp leietaker
-Lowest property        no      Lavest
-Mailing method is not chosen! (admin section)  property        no      Mail 
metode er ikke valgt! (admin seksjon)
-Manage property        no      Forvalte
-Manager        property        no      Manager
-Map    property        no      Kart
-Mark as DRAFT  property        no      Merk som UTKAST
-Mark the tender as DRAFT       property        no      Merk tilbud som UTKAST
+lowest property        no      Lavest
+mailing method is not chosen! (admin section)  property        no      Mail 
metode er ikke valgt! (admin seksjon)
+make order     property        no      Lag bestilling
+manage property        no      Forvalte
+manage groups  property        no      Administrere grupper
+manage users   property        no      Administrere brukere
+map    property        no      Kart
+mark as draft  property        no      Merk som UTKAST
+mark the tender as draft       property        no      Merk tilbud som UTKAST
 mask   property        no      Masker
-Material cost  property        no      Materiell
-Materials:__________   property        no      Materialer:__________
+material cost  property        no      Materiell
+materials:__________   property        no      Materialer:__________
 m_cost property        no      Materialkost
-Medium property        no      Medium
-Medium Consequences    property        no      Middels store konsekvenser
+medium consequences    property        no      Middels store konsekvenser
+member property        no      Medlem
 member of      property        no      medlem av
-Memo   property        no      Memo
-Meter  property        no      MÃ¥ler
-Meter %1 has been edited       property        no      MÃ¥ler %1 er oppdatert
-Meter %1 has been saved        property        no      MÃ¥ler %1 er lagret
+memo   property        no      Memo
+meter  property        no      MÃ¥ler
+meter %1 has been edited       property        no      MÃ¥ler %1 er oppdatert
+meter %1 has been saved        property        no      MÃ¥ler %1 er lagret
 meter id       property        no      måler ID
-Meter type     property        no      måler type
+meter type     property        no      måler type
 method property        no      Metode
-Method property        no      Metode
 method has been edited property        no      Metode er rettet
 method id      property        no      Metode ID
-method ID      property        no      Metode ID
-Minor  property        no      Liten
-Minor Consequences     property        no      Små konsekvenser
+migrate to alternative db      property        no      Migrer til alternativ 
database
+minor  property        no      Liten
+minor consequences     property        no      Små konsekvenser
 minute property        no      Minutt
-Minutes before the event       property        no      Minutter til hendelse
+minutes before the event       property        no      Minutter til hendelse
 month  property        no      MÃ¥ned
-Multiple Checkbox      property        no      Flervalgs avkrysningsknapp
-Multiple radio property        no      Flervalgs radioknapp
-Name   property        no      Navn
-Name not entered!      property        no      Navn er ikke angitt
-Narrow the search by dates     property        no      Avgrens søket med dato
+Monthly (by day)       property        no      MÃ¥nedlig (dag)
+Monthly (by date)      property        no      MÃ¥nedlig (dato)
+muliple checkbox       property        no      Flervalgs avkrysningsknapp
+muliple radio  property        no      Flervalgs radioknapp
+multiple checkbox      property        no      Flervalgs avkrysningsknapp
+multiple radio property        no      Flervalgs radioknapp
+my preferences property        no      Mine innstillinger
+name not entered!      property        no      Navn er ikke angitt
+name of the user, eg. %1       property        no      Navn til bruker, %1
+narrow the search by dates     property        no      Avgrens søket med dato
 needs approval property        no      Behøver godkjenning
-New    property        no      Ny
-New grouping   property        no      Ny gruppering
-New index      property        no      Ny index
-New Note       property        no      Ny kommentar
-New value      property        no      Ny verdi
-New value for multiple choice  property        no      Ny verdi for fler-valg
-New values     property        no      Nye verdier
-Next run       property        no      Neste kjøring
-no     property        no      Nei
-No access      property        no      Ingen tilgang
-No account     property        no      Ingen konto
-No additional notes    property        no      Ingen tilleggskommentarer
-No branch      property        no      fag ikke valgt
-no category    property        no      kategori ikke valgt
-No Change type property        no      Ingen endringstype
-No conversion type could be located.   property        no      Format filter 
ble ikke funnet
-No custom function     property        no      Ingen egendfinert funksjon
-No datatype    property        no      Datatype ikke valgt
-No Dim B       property        no      Dim B ikke valgt
-No Dim D       property        no      Dim D ikke valgt
+new    property        no      Ny
+new grouping   property        no      Ny gruppering
+new index      property        no      Ny index
+new note       property        no      Ny kommentar
+new organisation       common  no      Ny organisasjon
+new person     common  no      Ny person
+new_ticket     common  no      Ny melding
+new value      property        no      Ny verdi
+new value for multiple choice  property        no      Ny verdi for fler-valg
+new values     property        no      Nye verdier
+next run       property        no      Neste kjøring
+no access      property        no      Ingen tilgang
+no account     property        no      Ingen konto
+no additional notes    property        no      Ingen tilleggskommentarer
+no branch      property        no      fag ikke valgt
+no category    property        no      Kategori ikke valgt
+no change type property        no      Ingen endringstype
+no conversion type could be located.   property        no      Format filter 
ble ikke funnet
+no custom function     property        no      Ingen egendfinert funksjon
+no criteria    property        no      kriterie ikke valgt
+no datatype    property        no      Datatype ikke valgt
+no dim b       property        no      Kostnadssted ikke valgt
+no dim d       property        no      Dim D ikke valgt
 no district    property        no      Distrikt ikke valgt
 no document type       property        no      Ingen dokument-type
-No entity type property        no      Entitet type ikke valgt
-No equipment type      property        no      Utstyrs type ikke valgt
-No file selected       property        no      Fil ikke valgt
-No granting group      property        no      Ingen granting gruppe
-No group       property        no      ingen gruppe
-No history     property        no      Historie er ikke registert
-No history for this record     property        no      Ingen historie for 
denne meldingen
+no entity type property        no      Entitet type ikke valgt
+no equipment type      property        no      Utstyrs type ikke valgt
+no file selected       property        no      Fil ikke valgt
+no granting group      property        no      Ingen granting gruppe
+no group       property        no      ingen gruppe
+no grouping    property        no      Ingen gruppering
+no history     property        no      Historie er ikke registert
+no history for this record     property        no      Ingen historie for 
denne meldingen
 no hour category       property        no      Ingen post-kategori
-No janitor     property        no      Oppsynsmann ikke valgt
-No location    property        no      Lokalisering ikke valgt
-No mailaddress is selected     property        no      E-post ikke valgt
+no janitor     property        no      Oppsynsmann ikke valgt
+no location    property        no      Lokalisering ikke valgt
+no mailaddress is selected     property        no      E-post ikke valgt
 no member      property        no      Ingen medlem
 no method      property        no      Ingen metode
-None   property        no      Ingen
-None Consequences      property        no      Ingen konsekvenser
-No part of town        property        no      Bydel ikke valgt
-No status      property        no      Status ikke valgt
-No supervisor  property        no      Boligleder ikke valgt
-Note   property        no      Notat
-Nothing to do! property        no      Ingen ting å gjøre
-Notify property        no      varsle
-No type        property        no      Type ikke valgt
-No user        property        no      Bruker ikke valgt
-No user selected       property        no      Bruker ikke valgt
+none consequences      property        no      Ingen konsekvenser
+no part of town        property        no      Bydel ikke valgt
+no revision    property        no      Ingen revisjon
+no status      property        no      Status ikke valgt
+no supervisor  property        no      Boligleder ikke valgt
+note   property        no      Notat
+nothing to do! property        no      Ingen ting å gjøre
+notify property        no      varsle
+no type        property        no      Type ikke valgt
+no user        property        no      Bruker ikke valgt
+no user selected       property        no      Bruker ikke valgt
 no vendor      property        no      leverandør ikke valgt
-No workorder bugdet    property        no      Ingen arbeidsordrer er 
budsjettert
-NS3420 property        no      NS3420
+no workorder budget    property        no      Ingen budsjett 
arbeidsordre/bestilling
+no workorder bugdet    property        no      Ingen arbeidsordrer er 
budsjettert
+no year        property        no      Ingen årstall
+ns3420 property        no      NS3420
 ns3420 description     property        no      NS3420 beskrivelse
-Nullable       property        no      Kan være NULL
-Nullable not chosen!   property        no      Nullable ikke valgt
-Num    property        no      Num
+nullable       property        no      Kan være NULL
+nullable not chosen!   property        no      Nullable ikke valgt
+num    property        no      Num
 number property        no      Nummer
+obligations    property        no      Regnskap
 of     property        no      av
-Open   property        no      Ã…pen
-Open Date      property        no      Startet dato
-Opened property        no      Ã…pnet
-Opened by      property        no      Startet av
-Opened By      property        no      Startet av
-Order  property        no      bestill
-Order ID       property        no      Ordre nr
-Order # that initiated the invoice     property        no      Order nr som 
referanse for fakturaen
-Other branch   property        no      Andre fag
+old value      property        no      opprinnelig verdi
+only private   property        no      Bare privat
+open   property        no      Ã…pen
+open date      property        no      Startet dato
+opened property        no      Ã…pnet
+opened by      property        no      Startet av
+open edit in new window        property        no      Ã…pne endring i nytt 
vindu
+open view in new window        property        no      Ã…pne visning i nytt 
vindu
+order  property        no      bestill
+order id       property        no      OrdreNr
+order # that initiated the invoice     property        no      Order nr som 
referanse for fakturaen
+order text     property        no      Bestillingstekst
+other branch   property        no      Andre fag
 override fraction      property        no      Overstyrt-faktor
-Override fraction      property        no      Overstyringsfaktor
-Override fraction of common costs      property        no      
Overstyringsfaktor for felleskostnader
+override fraction of common costs      property        no      
Overstyringsfaktor for felleskostnader
 overview       property        no      oversikt
 owner  property        no      eier
-Owner type     property        no      Eiertype
-Paid   property        no      Betalt
-Part of town   property        no      Bydel
-Part of town id        property        no      Bydel
-Payment date   property        no      Forfallsdato
-Payment Date   property        no      Forfallsdato
-Per Agreement  property        no      pr avtale
-Per Cent       property        no      Prosent
-Percentage addition    property        no      prosentvis tillegg
-Period property        no      Periode
+owner attributes       property        no      Eier attributter
+owner categories       property        no      Eier kategorier
+owner type     property        no      Eiertype
+paid   property        no      Betalt
+part of town   property        no      Bydel
+part of town id        property        no      Bydel
+payment date   property        no      Forfallsdato
+per agreement  property        no      pr avtale
+per cent       property        no      Prosent
+percentage addition    property        no      prosentvis tillegg
+period property        no      Periode
 permission     property        no      rettighet
-Permissions    property        no      Rettigheter
+permissions    property        no      Rettigheter
 permissions are updated!       property        no      rettigheter er oppdatert
-Per Vendor     property        no      pr leverandør
-Phone  property        no      Telefon
+per vendor     property        no      pr leverandør
+phone  property        no      Telefon
+php configuration      common  no      php konfigurasjon
+phpinfo        common  no      phpinformasjon
 plain  property        no      Vanlig
-Pleace select a location - or an equipment !   property        no      velg en 
lokalisering - eller et utstyr
-Please choose a conversion type        property        no      Velg eksport 
type
-Please choose a conversion type from the list  property        no      velg 
eksport type fra listen
-Please choose a file   property        no      Velg en fil
-Please either select GENERATE ID or type a Equipment ID !      property        
no      enten valg GENERER ID eller angi et utstyrs ID
-Please enter a Apartment ID !  property        no      angi leilighet ID
-Please enter a Building ID !   property        no      angi bygg ID
-Please enter a description!    property        no      angi en beskrivelse!
-Please enter a Entrance ID !   property        no      angi inngang ID
-Please enter a index ! property        no      Angi en indeks
-Please enter an activity code !        property        no      angi en 
aktivitets kode
-Please enter an agreement code !       property        no      angi en avtale 
kode
-Please enter an agreement group code ! property        no      Angi en 
avtale-gruppe-kode
-Please enter a name !  property        no      Angi et navn
-Please - enter an amount!      property        no      Angi et beløp!
-Please enter a new index for calkulating next value(s)!        property        
no      angi en ny index for beregning av neste verdi(er)!
-Please enter an integer !      property        no      Angi heltall
-Please enter an integer for order!     property        no      Angi heltall 
for ordrenr
-Please enter a project NAME !  property        no      angi prosjekt navn
-Please enter a Property ID !   property        no      angi eiendoms ID
-Please enter a request TITLE ! property        no      angi tittel for 
anmodning
-Please enter a sql query !     property        no      Angi en sql-spørring
-Please enter a value for either material cost, labour cost or both !   
property        no      angi enten material kostnader, arbeidskostnader eller 
begge
-Please enter a workorder title !       property        no      angi en 
arbeidsordre tittel
-Please enter precision as integer !    property        no      Angi heltall 
for presisjon
-Please enter scale as integer !        property        no      Angi heltall 
for skalering
-Please give som details !      property        no      angi detaljer
-Please select a branch !       property        no      velg fag
-Please select a budget account !       property        no      Velg en 
budsjettkonto
-Please select a budget reponsible!     property        no      Velg en 
budsjettansvarlig
-Please select a Building ID !  property        no      velg bygnings ID
-Please select a category !     property        no      velg kategori
-Please select a coordinator !  property        no      Velg en koordinator
-Please select a date ! property        no      velg dato
-Please select a district !     property        no      Velg et distrikt
-Please select a Entrance ID !  property        no      velg inngangs ID
-Please - select a file to import from !        property        no      velg en 
fil å importere fra
-Please select a file to upload !       property        no      Velg en fil for 
opplasting
-Please - select a import format !      property        no      velg et import 
format
-Please select a location !     property        no      velg lokalisering
-Please select a location - or an entity!       property        no      Velg en 
lokalisering eller en entitet
-Please select an agreement !   property        no      velg en avtale
-Please select an agreement_group !     property        no      Velg en 
avtale-gruppe
-Please select a period for write off ! property        no      velg en 
avskrivningsperiode
-Please select a person or a group to handle the ticket !       property        
no      Velg en person eller gruppe for tildeling av melding
-Please select a person to handle the ticket !  property        no      velg en 
person som saksbehandler for denne meldingen
-Please select a Property ID !  property        no      velg en eiendoms ID
-Please select a status !       property        no      velg status
-Please select a type ! property        no      velg type
-Please select a valid project !        property        no      velg et gyldig 
prosjekt
-Please - select a vendor!      property        no      velg en leverandør
-Please select a workorder !    property        no      velg en ordre!
-Please - select budget responsible!    property        no      velg en 
budsjettansvarlig
-Please select change type      property        no      Velg en endringstype
-Please - select either payment date or number of days from invoice date !      
property        no      velg enten betalingsdato eller angi antall dager till 
forfall fra fakturadato
-Please select entity type !    property        no      Velg en entitets-type
-Please select equipment type ! property        no      velg utstyrstype
-Please select type     property        no      Velg type
-Please - select type invoice!  property        no      velg type bilag
-Please - select type order!    property        no      velg type bestilling
-Please - select Vendor!        property        no      velg leverandør
-Please set a initial value !   property        no      sett initiell verdi
-Please set a new index !       property        no      angi ny index
-Please type a subject for this ticket !        property        no      angi 
overskrift for denne meldingen
-Popup Calendar property        no      Kalender
-Post   property        no      post
-Power meter    property        no      Strømmåler
-Precision      property        no      Presisjon
-preferences    property        no      Innstillinger
+planned cost   property        no      Planlagt
+pleace select a location - or an equipment !   property        no      velg en 
lokalisering - eller et utstyr
+please choose a conversion type        property        no      Velg eksport 
type
+please choose a conversion type from the list  property        no      velg 
eksport type fra listen
+please choose a file   property        no      Velg en fil
+please either select generate id or type a equipment id !      property        
no      enten valg GENERER ID eller angi et utstyrs ID
+please enter a apartment id !  property        no      angi leilighet ID
+please enter a building id !   property        no      angi bygg ID
+please enter a description!    property        no      angi en beskrivelse!
+please enter a entrance id !   property        no      angi inngang ID
+please enter a index ! property        no      Angi en indeks
+Please enter a title ! property        no      Angi en overskrift
+please enter an activity code !        property        no      angi en 
aktivitets kode
+please enter an agreement code !       property        no      angi en avtale 
kode
+please enter an agreement group code ! property        no      Angi en 
avtale-gruppe-kode
+please enter a name !  property        no      Angi et navn
+please - enter an amount!      property        no      Angi et beløp!
+please enter a new index for calkulating next value(s)!        property        
no      angi en ny index for beregning av neste verdi(er)!
+please enter an integer !      property        no      Angi heltall
+please enter an integer for order!     property        no      Angi heltall 
for ordrenr
+please enter a project name !  property        no      angi prosjekt navn
+please enter a property id !   property        no      angi eiendoms ID
+please enter a request title ! property        no      angi tittel for 
anmodning
+please enter a sql query !     property        no      Angi en sql-spørring
+please enter a value for either material cost, labour cost or both !   
property        no      angi enten material kostnader, arbeidskostnader eller 
begge
+please enter a workorder title !       property        no      angi en 
arbeidsordre tittel
+please enter precision as integer !    property        no      Angi heltall 
for presisjon
+please enter scale as integer !        property        no      Angi heltall 
for skalering
+please give som details !      property        no      angi detaljer
+please select a branch !       property        no      velg fag
+please select a budget account !       property        no      Velg en 
budsjettkonto
+please select a budget reponsible!     property        no      Velg en 
budsjettansvarlig
+please select a building id !  property        no      velg bygnings ID
+please select a category !     property        no      velg kategori
+please select a coordinator !  property        no      Velg en koordinator
+please select a date ! property        no      velg dato
+please select a district !     property        no      Velg et distrikt
+please select a entrance id !  property        no      velg inngangs ID
+please - select a file to import from !        property        no      velg en 
fil å importere fra
+please select a file to upload !       property        no      Velg en fil for 
opplasting
+please - select a import format !      property        no      velg et import 
format
+please select a location !     property        no      velg lokalisering
+please select a location - or an entity!       property        no      Velg en 
lokalisering eller en entitet
+please select an agreement !   property        no      velg en avtale
+please select an agreement_group !     property        no      Velg en 
avtale-gruppe
+please select a period for write off ! property        no      velg en 
avskrivningsperiode
+please select a person or a group to handle the ticket !       property        
no      Velg en person eller gruppe for tildeling av melding
+please select a person to handle the ticket !  property        no      velg en 
person som saksbehandler for denne meldingen
+please select a property id !  property        no      velg en eiendoms ID
+please select a status !       property        no      velg status
+please select a type ! property        no      velg type
+please select a valid project !        property        no      velg et gyldig 
prosjekt
+please - select a vendor!      property        no      velg en leverandør
+please select a workorder !    property        no      velg en ordre!
+please - select budget responsible!    property        no      velg en 
budsjettansvarlig
+please select change type      property        no      Velg en endringstype
+please - select either payment date or number of days from invoice date !      
property        no      velg enten betalingsdato eller angi antall dager till 
forfall fra fakturadato
+please select entity type !    property        no      Velg en entitets-type
+please select equipment type ! property        no      velg utstyrstype
+please select type     property        no      Velg type
+please - select type invoice!  property        no      velg type bilag
+please - select type order!    property        no      velg type bestilling
+please - select vendor!        property        no      velg leverandør
+please set a initial value !   property        no      sett initiell verdi
+please set a new index !       property        no      angi ny index
+Please set default assign to in preferences for user %1!       property        
no      Angi standardverdi for ansvarlig saksbehandler for bruker %1
+Please set default category in preferences for user %1!        property        
no      Angi standardverdi for kategori for bruker %1
+please type a subject for this ticket !        property        no      angi 
overskrift for denne meldingen
+popup calendar property        no      Kalender
+post   property        no      post
+power meter    property        no      Strømmåler
+precision      property        no      Presisjon
 prefix property        no      prefiks
 presumed finnish date  property        no      Antatt ferdig-dato
-Pricebook      property        no      prisbok
-Print view     property        no      Vis utskrift
-Priority       property        no      Prioritet
-Priority changed       property        no      prioritet er endret
-Priority key   property        no      Prioriteringsnøkkel
+pricebook      property        no      prisbok
+print view     property        no      Vis utskrift
+priority changed       property        no      prioritet er endret
+priority key   property        no      Prioriteringsnøkkel
 priority keys has been updated property        no      prioriteringsnøkkel er 
oppdatert
-private        property        no      Privat
 prizing        property        no      Priser
-Probability    property        no      sansynlighet
+probability    property        no      sansynlighet
 project        property        no      prosjekt
-Project        property        no      Prosjekt
-Project budget property        no      Prosjekt budsjett
-Project info   property        no      Prosjekt info.
-project %1 has been edited     property        no      prosjekt %1 er oppdatert
-project %1 has been saved      property        no      prosjekt %1 er lagret
-Project coordinator    property        no      Prosjekt ansvarlig
-Project end date       property        no      prosjekt sluttdato
-Project ID     property        no      Prosjekt ID
-Project name   property        no      Prosjekt navn
-Project start date     property        no      prosjekt startdato
+.project       property        no      Prosjekt
+project %1 has been edited     property        no      Prosjekt %1 er oppdatert
+project %1 has been saved      property        no      Prosjekt %1 er lagret
+project %1 needs approval      property        no      Prosjekt %1 venter på 
godkjenning
+project budget property        no      Prosjekt budsjett
+project categories     property        no      Prosjekt kategorier
+project coordinator    property        no      Prosjekt ansvarlig
+project end date       property        no      Prosjekt sluttdato
+project group  property        no      Prosjekt gruppe
+project id     property        no      Prosjekt ID
+project info   property        no      Prosjekt info.
+project name   property        no      Prosjekt navn
+.project.request       property        no      Behov
+project start date     property        no      prosjekt startdato
+.project.workorder     property        no      Arbeidsordre
 propagate      property        no      Propager
-property       property        no      Eiendom
-Property has been edited       property        no      eiendom er oppdater
-Property has been saved        property        no      eiendom er lagret
+property       common  no      Eiendom
+property has been edited       property        no      eiendom er oppdater
+property has been saved        property        no      eiendom er lagret
 property id    property        no      eiendoms ID
-Property Name  property        no      Eiendoms Navn
-Purchase cost  property        no      anskaffelses kostnad
-Quantity       property        no      Mengde
-Read   property        no      Les
-Re-assigned    property        no      Videresendt
-Record property        no      Post
+property name  property        no      Eiendoms Navn
+purchase cost  property        no      anskaffelses kostnad
+quantity       property        no      Mengde
+read   property        no      Les
+ready for processing claim     property        no      Til fakturering
+re-assigned    property        no      Videresendt
+re-assigned group      property        no      Tildelt ny gruppe
+receipt        property        no      Kvittering
+record property        no      Post
+related        property        no      Relatert
 related info   property        no      Relatert info
-Remark property        no      merknad
-Reminder       property        no      PÃ¥minning
-Rental property        no      Utleie
+remark property        no      Merknad
+remainder      property        no      Rest
+reminder       property        no      PÃ¥minning
+rental property        no      Utleie
 rental agreement       property        no      Utleieavtale
-Rental agreement       property        no      Utleieavtale
+rental agreement attributes    property        no      Leieavtale attributter
+rental agreement categories    property        no      Leieavtale kategorier
+rental agreement item attributes       property        no      Attributter for 
utleie - detaljer
 rental type    property        no      Utleietype
-Rental type    property        no      Utleietype
-Re-opened      property        no      gjenåpnet
+re-opened      property        no      gjenåpnet
+repeat property        no      serie
+repeat type    property        no      type serie
+repeat day     property        no      gjenta dag
 request        property        no      behov
-Request        property        no      Behov
 request %1 has been edited     property        no      anmodning %1 er oppdater
 request %1 has been saved      property        no      anmodning %1 er lagret
-Request budget property        no      Budsjett for tiltak
-Request descr  property        no      Beskrivelse av tiltak
+request budget property        no      Budsjett for tiltak
+request condition_type property        no      Tema for tilstand
+request descr  property        no      Beskrivelse av tiltak
 request end date       property        no      anmodning frist
-Request entry date     property        no      Registreringsdato for tiltak
-request ID     property        no      Anmodnings ID
+request entry date     property        no      Registreringsdato for tiltak
+request id     property        no      Anmodnings ID
 request start date     property        no      anmodning startdato
-Request title  property        no      Tiltak tittel
-Requirement    property        no      Behov/pålegg
+request status property        no      Status anmodning
+request title  property        no      Tiltak tittel
+requirement    property        no      Behov/pålegg
+resend workorder       property        no      Send ordre på nytt
 reserve        property        no      reserve
-reserve remainder      property        no      rest
+reserve remainder      property        no      rest av reserve
+reset  property        no      Tilbakestill
 residential environment        property        no      Bo-miljø
-Residential environment        property        no      Bomiljø
-Responsible    property        no      Ansvarlig
+responsible    property        no      Ansvarlig
+responsible matrix     property        no      Ansvarsmatrise
 result property        no      Resultat
 return back to the list        property        no      Returner til oversikt
-Rig addition   property        no      Rigg tillegg
+revision       property        no      Revisjon
+rig addition   property        no      Rigg tillegg
 right  property        no      Rettighet
-Roll back      property        no      Rull tilbake
-Rollback invoice       property        no      Rull  tilbake bilag
-Run Now        property        no      Kjør nå
-Run the method now     property        no      Kjør metoden nå
+roll back      property        no      Rull tilbake
+rollback invoice       property        no      Rull  tilbake bilag
+run now        property        no      Kjør nå
+run the method now     property        no      Kjør metoden nå
 safety property        no      Sikkerhet
-Safety property        no      Sikkerhet
-save   property        no      Lagre
-Save as template       property        no      lagre som mal
-Save the actor and return back to the list     property        no      Lagre 
aktøren og returner til oversikten
-Save the agreement and return back to the list property        no      Lagre 
avtalen og returner til oversikten
-Save the apartment     property        no      lagre leilighet
-Save the attribute     property        no      lagre attributt
-Save the budget account        property        no      Lagre budsjettkotntoen
-Save the building      property        no      lagre bygning
-Save the category      property        no      Lagre kategorien
-Save the claim and return back to the list     property        no      Lagre 
kravet og returner til oversikten
-Save the custom and return back to the list    property        no      Lagre 
egendefinert og returner til oversikten
-Save the custom function       property        no      Lagre egendefinert 
funksjon
-Save the deviation     property        no      Lagre avvik
-Save the document      property        no      lagre dokument
-Save the entity        property        no      Lagre entitet
-Save the entrance      property        no      lagre inngang
-Save the equipment     property        no      lagre utstyr
-Save the gab   property        no      Lagre GAB info
-Save the investment    property        no      lagre investering
-Save the location      property        no      Lagre lokalisering
-Save the meter property        no      lagre måler
-Save the method        property        no      Lagre metoden
-Save the owner and return back to the list     property        no      Lagre 
eier og returner til oversikten
-Save the part of town and return back to the list      property        no      
Lagre bydel og returner til oversikten
-Save the project       property        no      lagre prosjekt
-Save the property      property        no      lagre eiendom
-Save the rental agreement and return back to the list  property        no      
Lagre utleieavtale og returner til oversikten
-Save the request       property        no      lagre anmodning
-Save the service agreement and return back to the list property        no      
Lagre serviceavtale og returner til oversikten
-Save the standard      property        no      lagre standard
-Save the status        property        no      Lagre status
-Save the ticket        property        no      lagre melding
-Save the voucher       property        no      lagre bilag
-Save the workorder     property        no      lagre arbeidsordre
-Save this workorder as a template for later use        property        no      
lagre denne arbeidsordren som mal for senere bruk
+save as template       property        no      lagre som mal
+save the actor and return back to the list     property        no      Lagre 
aktøren og returner til oversikten
+save the agreement and return back to the list property        no      Lagre 
avtalen og returner til oversikten
+save the apartment     property        no      lagre leilighet
+save the attribute     property        no      lagre attributt
+save the budget account        property        no      Lagre budsjettkotntoen
+save the building      property        no      lagre bygning
+save the category      property        no      Lagre kategorien
+save the claim and return back to the list     property        no      Lagre 
kravet og returner til oversikten
+save the custom and return back to the list    property        no      Lagre 
egendefinert og returner til oversikten
+save the custom function       property        no      Lagre egendefinert 
funksjon
+save the deviation     property        no      Lagre avvik
+save the document      property        no      lagre dokument
+save the entity        property        no      Lagre entitet
+save the entrance      property        no      lagre inngang
+save the entry and return to list      property        no      lagre data og 
returner til hovedliste
+save the equipment     property        no      lagre utstyr
+save the gab   property        no      Lagre GrunnEiendom
+save the investment    property        no      lagre investering
+save the location      property        no      Lagre lokalisering
+save the meter property        no      lagre måler
+save the method        property        no      Lagre metoden
+save the owner and return back to the list     property        no      Lagre 
eier og returner til oversikten
+save the part of town and return back to the list      property        no      
Lagre bydel og returner til oversikten
+save the project       property        no      lagre prosjekt
+save the property      property        no      lagre eiendom
+save the rental agreement and return back to the list  property        no      
Lagre utleieavtale og returner til oversikten
+save the request       property        no      lagre anmodning
+save the service agreement and return back to the list property        no      
Lagre serviceavtale og returner til oversikten
+save the standard      property        no      lagre standard
+save the status        property        no      Lagre status
+save the ticket        property        no      Lagre melding og bli stående i 
skjema
+save the voucher       property        no      lagre bilag
+save the workorder     property        no      lagre arbeidsordre
+save this workorder as a template for later use        property        no      
lagre denne arbeidsordren som mal for senere bruk
 scale  property        no      Scale
-Schedule       property        no      planlegge (tid)
+schedule       property        no      planlegge (tid)
 schedule the method    property        no      Tidsplanlegging
 score  property        no      poengsum
-Score  property        no      Poeng
-Search property        no      Søk
-search by bruk. To show all entries, empty all fields and press the SUBMIT 
button again        property        no      Søk etter BruksNr
-search by feste. To show all entries, empty all fields and press the SUBMIT 
button again       property        no      Søk etter FesteNr
-search by gaards nr. To show all entries, empty all fields and press the 
SUBMIT button again   property        no      Søk etter GårdsNr
-search by location_code. To show all entries, empty all fields and press the 
SUBMIT button again       property        no      Søk etter lokaliseringskode
-Search by property     property        no      søk ved eiendom
-search by seksjon. To show all entries, empty all fields and press the SUBMIT 
button again     property        no      Søk etter Seksjon
+search by bruk. to show all entries, empty all fields and press the submit 
button again        property        no      Søk etter BruksNr
+search by feste. to show all entries, empty all fields and press the submit 
button again       property        no      Søk etter FesteNr
+search by gaards nr. to show all entries, empty all fields and press the 
submit button again   property        no      Søk etter GårdsNr
+search by location_code. to show all entries, empty all fields and press the 
submit button again       property        no      Søk etter lokaliseringskode
+search by property     property        no      søk ved eiendom
+search by seksjon. to show all entries, empty all fields and press the submit 
button again     property        no      Søk etter Seksjon
 search for history at this location    property        no      søk etter 
historikk for denne lokaliseringen
-Search for investment entries  property        no      søk etter 
investeringsposter
-Search for paid invoices       property        no      søk etter betalte bilag
-Search for voucher id  property        no      Søk etter bilagsnr
-Seksjons nr    property        no      Seksjons nr
+search for investment entries  property        no      søk etter 
investeringsposter
+search for paid invoices       property        no      søk etter betalte bilag
+search for voucher id  property        no      Søk etter bilagsnr
+seksjons nr    property        no      Seksjons nr
 select property        no      velg
-Select property        no      Velg
-Select a actor type    property        no      Velg en aktør-type
-Select a agreement type        property        no      Velg en avtale-type
-Select a custom function       property        no      Velg en egendefinert 
funsksjon
-Select a datatype      property        no      velg en datatype
-Select a entity type   property        no      velg en entitetstype
+select a actor type    property        no      Velg en aktør-type
+select a agreement type        property        no      Velg en avtale-type
+select a custom function       property        no      Velg en egendefinert 
funsksjon
+select a datatype      property        no      velg en datatype
+select a entity type   property        no      velg en entitetstype
 select agreement       property        no      Velg avtale
+select agreement group property        no      Velg en avtale-gruppe
 select agreement_group property        no      Velg avtalegruppe
-Select agreement group property        no      Velg en avtale-gruppe
-Select All     property        no      velg alle
+select all     property        no      velg alle
 select a location      property        no      vel en lokalisering
 select a location!     property        no      Velg en lokalisering
-Select a rental agreement type property        no      Velg en leieavtale-type
-Select a service agreement type        property        no      Velg en 
serviceavtale-type
-Select a standard-code from the norwegian standard     property        no      
velg en standard NS-kode
-Select a tenant        property        no      Velg en leietaker
-Select branch  property        no      velg fag
-Select B-Responsible   property        no      Velg budsjettansvarlig
-Select building part   property        no      velg bygningsdel
-Select category        property        no      Velg Kategori
-Select chapter property        no      velg kapittel
-Select Column  property        no      Velg kolonne
-Select conversion      property        no      velg filter
-Select coordinator     property        no      velg coordinator
-Select date    property        no      Velg dato
-Select date for the file to roll back  property        no      velg dato for 
fil som skal rulles tibake
-Select date the document was created   property        no      velg dat for 
opprettelse av dokumentet
-Select default vendor category property        no      Velg standard 
leverandør-kategori
+select a rental agreement type property        no      Velg en leieavtale-type
+select a service agreement type        property        no      Velg en 
serviceavtale-type
+select a standard-code from the norwegian standard     property        no      
velg en standard NS-kode
+select a tenant        property        no      Velg en leietaker
+select branch  property        no      velg fag
+select b-responsible   property        no      Velg budsjettansvarlig
+select building part   property        no      velg bygningsdel
+select category        property        no      Velg Kategori
+select chapter property        no      velg kapittel
+select column  property        no      Velg kolonne
+select conversion      property        no      velg filter
+select coordinator     property        no      velg coordinator
+select date    property        no      Velg dato
+select date for the file to roll back  property        no      velg dato for 
fil som skal rulles tibake
+select date the document was created   property        no      velg dat for 
opprettelse av dokumentet
+select default vendor category property        no      Velg standard 
leverandør-kategori
 select either a location or an entity  property        no      Velg enten en 
lokalisering eller en entitet
 select either a location or an equipment       property        no      velg 
enten en lokalisering eller ett utstyr
-Select email   property        no      velg e-post
-Select file to roll back       property        no      velg fil for 
tilbakerulling
-Select file to upload  property        no      Velg fil for opplasting
-Select grouping        property        no      velg gruppering
-Select Invoice Type    property        no      Velg Art
-Select key responsible property        no      velg nøkkelansvarlig
+select email   property        no      velg e-post
+select file to roll back       property        no      velg fil for 
tilbakerulling
+select file to upload  property        no      Velg fil for opplasting
+select grouping        property        no      velg gruppering
+select invoice type    property        no      Velg Art
+select key responsible property        no      velg nøkkelansvarlig
 select location level  property        no      Velg lokaliserings nivå
-Select nullable        property        no      Velg nullable
-Select owner   property        no      Velg eier
-Select per button !    property        no      Velg ved hjelp av knappen !
-Select rental type     property        no      Velg utleietype
-Select request property        no      Velg behov
-Select responsible     property        no      Velg ansvarlig
-Select status  property        no      velg status
-Select submodule       property        no      velg submodul
-Select the account class the selection belongs to      property        no      
velg kontoklasse
-Select the agreement_group the pricebook belongs to. To do not use a category 
select NO CATEGORY       property        no      Velg avtalegruppen denne 
prisboken tilhører
-Select the agreement group this activity belongs to.   property        no      
Velg avtalegruppen denne aktiviteten tilhører
-Select the agreement the pricebook belongs to. To do not use a category select 
NO CATEGORY     property        no      velg avtale denne prisboken tilhører
-Select the agreement this activity belongs to. property        no      velg 
avtale denne aktiviteten tilhører
-Select the appropriate condition degree        property        no      velg 
tilstandsgrad
-Select the appropriate consequence by breakdown of this component for this 
theme       property        no      velg konsekvens ved sammenbrudd av 
dennekomponenten for dette temaet
-Select the appropriate propability for worsening of the condition      
property        no      velg sansynlighet for forverring
+select nullable        property        no      Velg nullable
+select owner   property        no      Velg eier
+select per button !    property        no      Velg ved hjelp av knappen !
+select rental type     property        no      Velg utleietype
+select request property        no      Velg behov
+select responsible     property        no      Velg ansvarlig
+select status  property        no      velg status
+select submodule       property        no      velg submodul
+select the account class the selection belongs to      property        no      
velg kontoklasse
+select the agreement_group the pricebook belongs to. to do not use a category 
select no category       property        no      Velg avtalegruppen denne 
prisboken tilhører
+select the agreement group this activity belongs to.   property        no      
Velg avtalegruppen denne aktiviteten tilhører
+select the agreement the pricebook belongs to. to do not use a category select 
no category     property        no      velg avtale denne prisboken tilhører
+select the agreement this activity belongs to. property        no      velg 
avtale denne aktiviteten tilhører
+select the appropriate condition degree        property        no      velg 
tilstandsgrad
+select the appropriate consequence by breakdown of this component for this 
theme       property        no      velg konsekvens ved sammenbrudd av 
dennekomponenten for dette temaet
+select the appropriate propability for worsening of the condition      
property        no      velg sansynlighet for forverring
 select the appropriate tax code        property        no      velg mva-kode
-Select the branches for this project   property        no      velg fag for 
dette prosjektet
-Select the branches for this request   property        no      velg fag for 
denne anmodningen
-Select the branch for this activity.   property        no      velg fag for 
denne aktiviteten
-Select the branch for this document    property        no      velg fag for 
dette dokumentet
-Select the budget responsible  property        no      Velg budsjettansvarlig
-Select the building part for this activity.    property        no      velg 
bygningsdel for denne aktiviteten
-Select the category the actor belongs to. To do not use a category select NO 
CATEGORY  property        no      Velg kategorien denne aktøren tilhører
-Select the category the agreement belongs to. To do not use a category select 
NO CATEGORY      property        no      Velg kategorien denne avtalen tilhører
-Select the category the alarm belongs to. To do not use a category select NO 
CATEGORY  property        no      Velg kategorien denne alarmen tilhører
-Select the category the apartment belongs to. To do not use a category select 
NO CATEGORY      property        no      velg kategori leilighetene tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the building belongs to. To do not use a category select 
NO CATEGORY       property        no      velg kategori bygningene tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the claim belongs to. To do not use a category select NO 
CATEGORY  property        no      Velg kategorien dette kravet tilhører
-Select the category the custom belongs to. To do not use a category select NO 
CATEGORY property        no      Velg kategorien denne egentilpassede tilhører
-Select the category the document belongs to. To do not use a category select 
NO CATEGORY       property        no      velg kategori dokumentene tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the entrance belongs to. To do not use a category select 
NO CATEGORY       property        no      velg kategori inngang tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the equipment belongs to. To do not use a category select 
NO CATEGORY      property        no      velg kategori utstyr tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the investment belongs to. To do not use a category select 
NO CATEGORY     property        no      velg kategori investering tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the location belongs to. To do not use a category select 
NO CATEGORY       property        no      Velg kategorien denne lokaliseringen 
tilhører
-Select the category the meter belongs to. To do not use a category select NO 
CATEGORY  property        no      velg kategori måler tilhører. For ikke å 
bruke kategori velg KATEGORI IKKE VALGT
-Select the category the permissions belongs to. To do not use a category 
select NO CATEGORY    property        no      Velg kategorien denne rettigheten 
tilhører
-Select the category the pricebook belongs to. To do not use a category select 
NO CATEGORY      property        no      velg kategori prisbok tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the project belongs to. To do not use a category select NO 
CATEGORY        property        no      velg kategori prosjekt tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the property belongs to. To do not use a category select 
NO CATEGORY       property        no      velg kategori eiendom tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the r_agreement belongs to. To do not use a category 
select NO CATEGORY    property        no      Velg kategorien denne 
utleieavtalen tilhører
-Select the category the request belongs to. To do not use a category select NO 
CATEGORY        property        no      velg kategori anmodning tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category the s_agreement belongs to. To do not use a category 
select NO CATEGORY    property        no      Velg kategorien denne 
serviceavtalen tilhører
-Select the category the ticket belongs to. To do not use a category select NO 
CATEGORY property        no      velg kategori melding tilhører. For ikke å 
bruke kategori velg KATEGORI IKKE VALGT
-Select the category the workorder belongs to. To do not use a category select 
NO CATEGORY      property        no      velg kategori arbeidsordre tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
-Select the category. To do not use a category select NO CATEGORY       
property        no      Velg kategori
-Select the chapter (for tender) for this activity.     property        no      
velg tilbudskapittel for denne posten
-Select the coordinator the document belongs to. To do not use a category 
select NO USER        property        no      velg koordinator dokument 
tilhører. For ikke å bruke koordinator velg BRUKER IKKE VALG
-Select the coordinator the project belongs to. To do not use a category select 
NO USER property        no      velg koordinator prosjekt tilhører. For ikke å 
bruke koordinator velg BRUKER IKKE VALG
-Select the coordinator the request belongs to. To do not use a category select 
NO USER property        no      velg koordinator anmodning tilhører. For ikke å 
bruke koordinator velg BRUKER IKKE VALG
-Select the customer by clicking this link      property        no      Velg 
kunde
-Select the date for the first value    property        no      angi dato for 
første verdi
-Select the date for the update property        no      angi dato for 
oppdatering
-Select the Dim B for this invoice. To do not use Dim B -  select NO DIM B      
property        no      velg DIM B for bilag. For ikke å bruke DIM B - velg 
DIMB IKKE VALGT
-Select the Dim D for this activity. To do not use Dim D -  select NO DIM D     
property        no      velg DIM D for bilag. For ikke å bruke DIM D - velg 
DIMD IKKE VALGT
-Select the district the part of town belongs to.       property        no      
Velg hvilke distrikt denne bydelen tilhører
-Select the district the selection belongs to. To do not use a district select 
NO DISTRICT      property        no      velg distrikt utvalget tilhører. For 
ikke å bruke distrikt velg DISTRIKT IKKE VALGT
-Select the document type the document belongs to.      property        no      
Velg dokumenttype for dette dokumentet
-Select the equipment type the document belongs to. To do not use a type select 
NO equipment type       property        no      velg utstyrstype dokumenter 
tilhøre.rFor ikke å bruke utstyrstype velg TYPE IKKE VALGT
-Select the estimated end date for the agreement        property        no      
Angi estimert slutt-dato for avtalen
-Select the estimated end date for the Project  property        no      Angi 
estimert sluttdato for prosjektet
-Select the estimated end date for the request  property        no      Angi 
estimert sluttdato for anmodningen
-Select the estimated termination date  property        no      Angi estimert 
terminerings-dato
-Select the file to import from property        no      velg fil å importere
-Select the filter. To show all entries select SHOW ALL property        no      
Velg filter. For å vise alle - velg VIS ALLE
-Select the granting group. To do not use a granting group select NO GRANTING 
GROUP     property        no      Angi tildelings gruppe
-Select the grouping for this activity. property        no      velg gruppering 
for denne posten
-Select the janitor responsible for this invoice. To do not use janitor -  
select NO JANITOR    property        no      velg oppsynsmann bilaget tilhører. 
For ikke å tildele oppsynsmann velg OPPSYNSMANN IKKE VALG
-Select the key responsible for this project    property        no      velg 
nøkkelansvarlig
-Select the level for this information  property        no      Velg nivå for 
denne informasjonen
-Select the method for this times service       property        no      Velg 
metode
-Select the owner       property        no      Velg eier
-Select the owner type. To show all entries select SHOW ALL     property        
no      Velg eiertype
-Select the part of town the building belongs to. To do not use a part of town 
-  select NO PART OF TOWN        property        no      velg bydel bygg 
tilhører. For ikke å bruke bydel velg BYDEL IKKE VALGT
-Select the part of town the investment belongs to. To do not use a part of 
town -  select NO PART OF TOWN      property        no      velg bydel 
investeriong tilhører. For ikke å bruke bydel velg BYDEL IKKE VALGT
-Select the part of town the property belongs to. To do not use a part of town 
-  select NO PART OF TOWN        property        no      velg bydel eiendom 
tilhører. For ikke å bruke bydel velg BYDEL IKKE VALGT
-Select the part of town the selection belongs to. To do not use a part of town 
select NO PART OF TOWN  property        no      velg bydel
-Select the priority the selection belongs to.  property        no      velg 
prioritet
-Select the property by clicking this link      property        no      klikk 
her for å velge eiendom
-Select the status the agreement belongs to. To do not use a category select NO 
STATUS  property        no      velg status avtale tilhører. For ikke å bruke 
status velg STATUS IKKE VALGT
-Select the status the agreement group belongs to. To do not use a category 
select NO STATUS    property        no      Velg status
-Select the status the document belongs to. To do not use a category select NO 
STATUS   property        no      velg status dokument tilhører. For ikke å 
bruke status velg STATUS IKKE VALGT
-Select the status. To do not use a status select NO STATUS     property        
no      Velg status
-Select the street name property        no      velg gatenavn
-Select the supervisor responsible for this invoice. To do not use supervisor - 
 select NO SUPERVISOR   property        no      velg boligleder bilaget 
tilhører. For ikke å tildele oppsynsmann velg BOLIGLEDER IKKE VALG
-Select the template-chapter    property        no      velg kapittel
-Select the tolerance for this activity.        property        no      velg 
toleranse for denne posten
-Select the type  invoice. To do not use type -  select NO TYPE property        
no      velg type
-Select the type of conversion: property        no      Velg type import:
-Select the type of value       property        no      velg type verdi
-Select the unit for this activity.     property        no      velg enhet for 
post
-Select the users supervisor    property        no      Velg brukers overordnet
-Select the user the alarm belongs to.  property        no      Velg bruker
-Select the user the document belongs to. To do not use a category select NO 
USER       property        no      velg bruker dokument tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
-Select the user the project belongs to. To do not use a category select NO 
USER        property        no      velg bruker prosjekt tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
-Select the user the request belongs to. To do not use a category select NO 
USER        property        no      velg bruker anmodning tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
-Select the user the selection belongs to. To do not use a user select NO USER  
property        no      velg bruker utvalg tilhører. For ikke å bruke bruker 
velg BRUKER IKKE VALG
-Select the user the template belongs to. To do not use a category select NO 
USER       property        no      velg bruker mal tilhører. For ikke å bruke 
bruker velg BRUKER IKKE VALG
-Select the user the workorder belongs to. To do not use a category select NO 
USER      property        no      velg bruker arbeidsordre tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
-Select the user. To do not use a category select NO USER       property        
no      Velg bruker
-Select the user to edit email  property        no      Velg bruker for å rette 
epost
-Select the vendor by clicking the button       property        no      velg 
leverandør
-Select the vendor by clicking this button      property        no      velg 
leverandør
-Select the vendor by clicking this link        property        no      velg 
leverandør
-Select the vendor the agreement belongs to.    property        no      Velg 
leverandør for avtalen
-Select the vendor the r_agreement belongs to.  property        no      Velg 
leverandør
-Select the vendor the s_agreement belongs to.  property        no      Velg 
leverandør
-Select the workorder hour category     property        no      Velg 
post-kategori
-Select this budget account     property        no      velg budjettkonto
-Select this contact    property        no      Velg denne kontakten
-Select this dates      property        no      Velg dato
-Select this ns3420 - code      property        no      velg NS-kode
-Select this street     property        no      velg gate
-Select this template to view the details       property        no      velg 
mal for å liste detaljer
-Select this tenant     property        no      Velg leietaker
-Select this vendor     property        no      velg denne leverandøren
-Select tolerance       property        no      velg toleranse
-Select Unit    property        no      velg enhet
-Select user    property        no      velg bruker
-Select where to deliver the key        property        no      velg hvor 
nøkkel skal leveres
-Select where to fetch the key  property        no      velk hvor nøkkel kan 
hentes
+select the branches for this project   property        no      velg fag for 
dette prosjektet
+select the branches for this request   property        no      velg fag for 
denne anmodningen
+select the branch for this activity.   property        no      velg fag for 
denne aktiviteten
+select the branch for this document    property        no      velg fag for 
dette dokumentet
+select the budget responsible  property        no      Velg budsjettansvarlig
+select the building part for this activity.    property        no      velg 
bygningsdel for denne aktiviteten
+select the category the actor belongs to. to do not use a category select no 
category  property        no      Velg kategorien denne aktøren tilhører
+select the category the agreement belongs to. to do not use a category select 
no category      property        no      Velg kategorien denne avtalen tilhører
+select the category the alarm belongs to. to do not use a category select no 
category  property        no      Velg kategorien denne alarmen tilhører
+select the category the apartment belongs to. to do not use a category select 
no category      property        no      velg kategori leilighetene tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the building belongs to. to do not use a category select 
no category       property        no      velg kategori bygningene tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the claim belongs to. to do not use a category select no 
category  property        no      Velg kategorien dette kravet tilhører
+select the category the custom belongs to. to do not use a category select no 
category property        no      Velg kategorien denne egentilpassede tilhører
+select the category the data belong to. to do not use a category select no 
category    property        no      Velg kategorien dataen hører til
+select the category the document belongs to. to do not use a category select 
no category       property        no      velg kategori dokumentene tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the entrance belongs to. to do not use a category select 
no category       property        no      velg kategori inngang tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the equipment belongs to. to do not use a category select 
no category      property        no      velg kategori utstyr tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the investment belongs to. to do not use a category select 
no category     property        no      velg kategori investering tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the location belongs to. to do not use a category select 
no category       property        no      Velg kategorien denne lokaliseringen 
tilhører
+select the category the meter belongs to. to do not use a category select no 
category  property        no      velg kategori måler tilhører. For ikke å 
bruke kategori velg KATEGORI IKKE VALGT
+select the category the permissions belongs to. to do not use a category 
select no category    property        no      Velg kategorien denne rettigheten 
tilhører
+select the category the pricebook belongs to. to do not use a category select 
no category      property        no      velg kategori prisbok tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the project belongs to. to do not use a category select no 
category        property        no      velg kategori prosjekt tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the property belongs to. to do not use a category select 
no category       property        no      velg kategori eiendom tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the r_agreement belongs to. to do not use a category 
select no category    property        no      Velg kategorien denne 
utleieavtalen tilhører
+select the category the request belongs to. to do not use a category select no 
category        property        no      velg kategori anmodning tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the s_agreement belongs to. to do not use a category 
select no category    property        no      Velg kategorien denne 
serviceavtalen tilhører
+select the category the ticket belongs to. to do not use a category select no 
category property        no      velg kategori melding tilhører. For ikke å 
bruke kategori velg KATEGORI IKKE VALGT
+select the category the workorder belongs to. to do not use a category select 
no category      property        no      velg kategori arbeidsordre tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category. to do not use a category select no category       
property        no      Velg kategori
+select the chapter (for tender) for this activity.     property        no      
velg tilbudskapittel for denne posten
+select the coordinator the document belongs to. to do not use a category 
select no user        property        no      velg koordinator dokument 
tilhører. For ikke å bruke koordinator velg BRUKER IKKE VALG
+select the coordinator the project belongs to. to do not use a category select 
no user property        no      velg koordinator prosjekt tilhører. For ikke å 
bruke koordinator velg BRUKER IKKE VALG
+select the coordinator the request belongs to. to do not use a category select 
no user property        no      velg koordinator anmodning tilhører. For ikke å 
bruke koordinator velg BRUKER IKKE VALG
+select the customer by clicking this link      property        no      Velg 
kunde
+select the date for the first value    property        no      angi dato for 
første verdi
+select the date for the update property        no      angi dato for 
oppdatering
+select the dim b for this invoice. to do not use dim b -  select no dim b      
property        no      velg Kostnadssted for bilag. For ikke å bruke 
Kostnadssted - velg Kostnadssted IKKE VALGT
+select the dim d for this activity. to do not use dim d -  select no dim d     
property        no      velg DIM D for bilag. For ikke å bruke DIM D - velg 
DIMD IKKE VALGT
+select the district the part of town belongs to.       property        no      
Velg hvilke distrikt denne bydelen tilhører
+select the district the selection belongs to. to do not use a district select 
no district      property        no      velg distrikt utvalget tilhører. For 
ikke å bruke distrikt velg DISTRIKT IKKE VALGT
+select the document type the document belongs to.      property        no      
Velg dokumenttype for dette dokumentet
+select the equipment type the document belongs to. to do not use a type select 
no equipment type       property        no      velg utstyrstype dokumenter 
tilhøre.rFor ikke å bruke utstyrstype velg TYPE IKKE VALGT
+select the estimated date for closing the task property        no      Velg 
beregnet dato for lukking av oppgave
+select the estimated end date for the agreement        property        no      
Angi estimert slutt-dato for avtalen
+select the estimated end date for the project  property        no      Angi 
estimert sluttdato for prosjektet
+select the estimated end date for the request  property        no      Angi 
estimert sluttdato for anmodningen
+select the estimated termination date  property        no      Angi estimert 
terminerings-dato
+select the file to import from property        no      velg fil å importere
+select the filter. to show all entries select show all property        no      
Velg filter. For å vise alle - velg VIS ALLE
+select the granting group. to do not use a granting group select no granting 
group     property        no      Angi tildelings gruppe
+select the grouping for this activity. property        no      velg gruppering 
for denne posten
+select the grouping the selection belongs to   property        no      Velg 
gruppering utvelgelsen gjelder
+select the janitor responsible for this invoice. to do not use janitor -  
select no janitor    property        no      velg oppsynsmann bilaget tilhører. 
For ikke å tildele oppsynsmann velg OPPSYNSMANN IKKE VALG
+select the key responsible for this project    property        no      velg 
nøkkelansvarlig
+select the level for this information  property        no      Velg nivå for 
denne informasjonen
+select the method for this times service       property        no      Velg 
metode
+select the owner       property        no      Velg eier
+select the owner type. to show all entries select show all     property        
no      Velg eiertype
+select the part of town the building belongs to. to do not use a part of town 
-  select no part of town        property        no      velg bydel bygg 
tilhører. For ikke å bruke bydel velg BYDEL IKKE VALGT
+select the part of town the investment belongs to. to do not use a part of 
town -  select no part of town      property        no      velg bydel 
investeriong tilhører. For ikke å bruke bydel velg BYDEL IKKE VALGT
+select the part of town the property belongs to. to do not use a part of town 
-  select no part of town        property        no      velg bydel eiendom 
tilhører. For ikke å bruke bydel velg BYDEL IKKE VALGT
+select the part of town the selection belongs to. to do not use a part of town 
select no part of town  property        no      velg bydel
+select the priority the selection belongs to.  property        no      velg 
prioritet
+select the property by clicking this link      property        no      klikk 
her for å velge eiendom
+select the revision the selection belongs to   property        no      Velg 
revisjonen utvelgelsen gjelder
+select the status the agreement belongs to. to do not use a category select no 
status  property        no      velg status avtale tilhører. For ikke å bruke 
status velg STATUS IKKE VALGT
+select the status the agreement group belongs to. to do not use a category 
select no status    property        no      Velg status
+select the status the document belongs to. to do not use a category select no 
status   property        no      velg status dokument tilhører. For ikke å 
bruke status velg STATUS IKKE VALGT
+select the status. to do not use a status select no status     property        
no      Velg status
+select the street name property        no      velg gatenavn
+select the supervisor responsible for this invoice. to do not use supervisor - 
 select no supervisor   property        no      velg boligleder bilaget 
tilhører. For ikke å tildele oppsynsmann velg BOLIGLEDER IKKE VALG
+select the template-chapter    property        no      velg kapittel
+select the tolerance for this activity.        property        no      velg 
toleranse for denne posten
+select the type  invoice. to do not use type -  select no type property        
no      velg type
+select the type of conversion: property        no      Velg type import:
+select the type of value       property        no      velg type verdi
+select the unit for this activity.     property        no      velg enhet for 
post
+select the users supervisor    property        no      Velg brukers overordnet
+select the user the alarm belongs to.  property        no      Velg bruker
+select the user the document belongs to. to do not use a category select no 
user       property        no      velg bruker dokument tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
+select the user the project belongs to. to do not use a category select no 
user        property        no      velg bruker prosjekt tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
+select the user the request belongs to. to do not use a category select no 
user        property        no      velg bruker anmodning tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
+select the user the selection belongs to. to do not use a user select no user  
property        no      velg bruker utvalg tilhører. For ikke å bruke bruker 
velg BRUKER IKKE VALG
+select the user the template belongs to. to do not use a category select no 
user       property        no      velg bruker mal tilhører. For ikke å bruke 
bruker velg BRUKER IKKE VALG
+select the user the workorder belongs to. to do not use a category select no 
user      property        no      velg bruker arbeidsordre tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
+select the user. to do not use a category select no user       property        
no      Velg bruker
+select the user to edit email  property        no      Velg bruker for å rette 
epost
+select the vendor by clicking the button       property        no      velg 
leverandør
+select the vendor by clicking this button      property        no      velg 
leverandør
+select the vendor by clicking this link        property        no      velg 
leverandør
+select the vendor the agreement belongs to.    property        no      Velg 
leverandør for avtalen
+select the vendor the r_agreement belongs to.  property        no      Velg 
leverandør
+select the vendor the s_agreement belongs to.  property        no      Velg 
leverandør
+select the workorder hour category     property        no      Velg 
post-kategori
+select the year the selection belongs to       property        no      Velg år 
utvelgelsen gjelder
+select this budget account     property        no      velg budsjettkonto
+select this contact    property        no      Velg denne kontakten
+select this dates      property        no      Velg dato
+select this ns3420 - code      property        no      velg NS-kode
+select this street     property        no      velg gate
+select this template to view the details       property        no      velg 
mal for å liste detaljer
+select this tenant     property        no      Velg leietaker
+select this vendor     property        no      velg denne leverandøren
+select tolerance       property        no      velg toleranse
+select unit    property        no      velg enhet
+select user    property        no      velg bruker
+select where to deliver the key        property        no      velg hvor 
nøkkel skal leveres
+select where to fetch the key  property        no      velk hvor nøkkel kan 
hentes
 select year    property        no      Velg år
-Send e-mail    property        no      Send epost
-Send Order     property        no      send ordre
-Sendt by email to      property        no      send med e-post til
-Send the following SMS-message to %1 to update status for this order:  
property        no      Send følgende SMS-melding til %1 for å oppdatere status 
for denne ordren:
-Send this order by email       property        no      send denne ordren med 
e-post
-Send Workorder property        no      Send ordre
-Serious        property        no      Kraftig
-Serious Consequences   property        no      Store konsekvenser
-Service        property        no      Service
+send   property        no      Send
+send e-mail    property        no      Send epost
+send order     property        no      Send ordre
+sendt by email to      property        no      send med e-post til
+send the following sms-message to %1 to update status for this order:  
property        no      Send følgende SMS-melding til %1 for å oppdatere status 
for denne ordren:
+send this order by email       property        no      send denne ordren med 
e-post
+send workorder property        no      Send ordre
+serious        property        no      Kraftig
+serious consequences   property        no      Store konsekvenser
+service        property        no      Service
 service agreement      property        no      serviceavtale
+service agreement attributes   property        no      Serviceavtale 
attributter
+service agreement categories   property        no      Serviceavtale kategorier
+service agreement item attributes      property        no      Attributter for 
serviceavtaler - detaljer
 set grants     property        no      Sett tillatelser
+set new status property        no      Sett ny status
 set permission property        no      sett rettighet
-Set tax        property        no      Angi MVA
-Set the status of the ticket   property        no      sett status for 
meldingen
-Shared use     property        no      Delt bruk
+set tax        property        no      Angi MVA
+set tax during import  property        no      Registrer mva ifm import
+set the status of the ticket   property        no      sett status for 
meldingen
+shared use     property        no      Delt bruk
 shift down     property        no      Skift ned
 shift up       property        no      Skift opp
-Show all       property        no      vis alle
-Show calculated cost   property        no      Vis sum
-Show calculated cost on the printview  property        no      Vis sum på 
utskrift
-Show details   property        no      Vis detaljer
+show calculated cost   property        no      Vis sum
+show calculated cost on the printview  property        no      Vis sum på 
utskrift
+show details   property        no      Vis detaljer
 show in list   property        no      Vis i oversikt
 show in lookup forms   property        no      Vis i oppslagsskjema
-Small  property        no      Liten
+site configuration     property        no      Konfigurasjon nettsted
+small  property        no      Liten
+sms    sms     no      SMS
 sorting        property        no      Sortering
-Sorting        property        no      Sortering
-Sort the tickets by their ID   property        no      sorter meldinger etter 
ID
-Sort the tickets by their priority     property        no      sorter 
meldinger etter prioritet
+sort the tickets by their id   property        no      sorter meldinger etter 
ID
+sort the tickets by their priority     property        no      sorter 
meldinger etter prioritet
 space  property        no      Areal
 sql    property        no      SQL
-Standard       property        no      standard
+standard       property        no      standard
 standard description   property        no      NS 3420
 standard has been edited       property        no      standard er rettet
 standard has been saved        property        no      standard er lagret
-Standard has NOT been edited   property        no      standard er ikke rettet
+standard has not been edited   property        no      standard er ikke rettet
 standard id    property        no      standard ID
-Standard prefix        property        no      prefiks fo standard
+standard prefix        property        no      prefiks fo standard
 start  property        no      start
-start date     property        no      startdato
-Start date     property        no      Start dato
-Started        property        no      startet
+start date     property        no      start dato
+started        property        no      startet
 start project  property        no      Start prosjekt
-Start project  property        no      Start prosjekt
 start this entity      property        no      Start denne entiteten
-Start this entity from property        no      Start denne entiteten fra 
prosjekt
-Status property        no      Status
+start this entity from property        no      Start denne entiteten fra 
prosjekt
+status property        no      Status
+status changed property        no      Status er endret
 status code    property        no      Statuskode
-Status confirmed       property        no      Status bekreftet
-Status changed property        no      Status er endret
-Status for the entity category property        no      Status for 
entitets-kategorien
+status confirmed       property        no      Status bekreftet
+status for the entity category property        no      Status for 
entitets-kategorien
 status has been added  property        no      Status er lagt til
-Status has been edited property        no      Status er rettet
-Status has NOT been saved      property        no      Status er IKKE lagret!
-status ID      property        no      Status ID
-Statustext     property        no      Statustekst
-Statustext not entered!        property        no      Statustekst er ikke 
angitt!
-Street property        no      Gate
+status has been edited property        no      Status er rettet
+status has not been saved      property        no      Status er IKKE lagret!
+status id      property        no      Status ID
+statustext     property        no      Statustekst
+statustext not entered!        property        no      Statustekst er ikke 
angitt!
 street name    property        no      gate navn
-Street name    property        no      Gatenavn
 street number  property        no      gate nr
-Street number  property        no      GateNr
-Subject        property        no      Overskrift
-Subject changed        property        no      Emne er endret
-Subject has been updated       property        no      Overskrift er oppdatert
-submit property        no      Send
-Submit property        no      Send
-Submit the search string       property        no      Send søkestrengen
-Sum    property        no      Sum
-Sum calculation        property        no      Sum kalkulasjon
-Sum deviation  property        no      Sum avvik
-Summary        property        no      Sammendrag
-Sum of calculation     property        no      Sum kalkulasjon
-Sum tax        property        no      sum mva
-Sum workorder  property        no      Sum Arbeidsordre
-Supervisor     property        no      Saksbehandler
+subject        property        no      Overskrift
+subject changed        property        no      Emne er endret
+subject has been updated       property        no      Overskrift er oppdatert
+submit the search string       property        no      Send søkestrengen
+sum estimated cost     property        no      Sum estimert kostnad
+sum orders     property        no      Sum bestilling
+sum    property        no      Sum
+sum calculation        property        no      Sum kalkulasjon
+sum deviation  property        no      Sum avvik
+summary        property        no      Sammendrag
+sum of calculation     property        no      Sum kalkulasjon
+sum tax        property        no      sum mva
+sum workorder  property        no      Sum bestilling
+supervisor     property        no      Saksbehandler
+sync account-contact   common  no      Synkroniser Brukerer og Kontakter
 table could not be added       property        no      Tabell kunne ikke 
legges til i databasen
-Table has NOT been saved       property        no      Tabell er ikke lagret
-Table Name     property        no      Tabellnavn
-Tax code       property        no      MVA kode
+table has not been saved       property        no      Tabell er ikke lagret
+table name     property        no      Tabellnavn
+take over      property        no      Ta over
+take over the assignment for this ticket       property        no      Ta over 
ansvaret for denne saken
+tax code       property        no      MVA kode
 template       property        no      Mal
 template %1 is added   property        no      mal %1 er lagt til
-Template ID    property        no      Mal ID
-Tenant property        no      Leieboer
-Tenant claim   property        no      Leietaker krav
-Tenant claim is not issued for project in voucher %1   property        no      
Krav mot leietaker er ikke registert for prosjekt i bilag %1
-Tenant phone   property        no      Leieboer tlf
+template id    property        no      Mal ID
+tenant property        no      Leietaker
+tenant attributes      property        no      Leietaker attributter
+tenant categories      property        no      Leietaker kategorier
+.tenant_claim  property        no      Leietaker krav
+tenant claim   property        no      Leietaker krav
+tenant claim categories        property        no      Leietaker kategorier 
klager
+tenant claim is not issued for project in voucher %1   property        no      
Krav mot leietaker er ikke registert for prosjekt i bilag %1
+tenant global categories       property        no      Leietaker globale 
kategorier
+tenant_id      property        no      Leietaker ID
+tenant phone   property        no      Leietaker tlf
+tender chapter property        no      Beskrivelse kapittel
 termination date       property        no      oppsigelse dato
 test cron      property        no      Test cron
-Text   property        no      Tekst
-That Vendor ID is not valid !  property        no      Denne leverandør ID er 
ikke gyldig
-The address to which this order will be sendt  property        no      
Adressen ordren vil bli sendt til
-The apartment is private. If the apartment should be public, uncheck this box  
property        no      Leiligheter er ikke
-The apartment is public. If the apartment should be private, check this box    
property        no      leiligheten er merket public. Dersom den skulle være 
privat - kryss av denne boksen
-The building is private. If the building should be public, uncheck this box    
property        no      Bygningen er merket privat. Dersom den skulle være 
public - fjern krysset i denne boksen
-The building is public. If the building should be private, check this box      
property        no      Bygningen er merket public. Dersom den skulle være 
privat - kryss av denne boksen
-The entrance is private. If the entrance should be public, uncheck this box    
property        no      Inngangen er merket privat. Dersom den skulle være 
public - fjern krysset i denne boksen
-The entrance is public. If the entrance should be private, check this box      
property        no      Inngangen er merket public. Dersom den skulle være 
privat - kryss av denne boksen
-The file is already imported ! property        no      Fila er allerede 
importert
-The mail server returned       property        no      E-post serveren 
returnerte
+text   property        no      Tekst
+text_view      property        no      Vis tekst
+that vendor id is not valid !  property        no      Denne leverandør ID er 
ikke gyldig
+the address to which this order will be sendt  property        no      
Adressen ordren vil bli sendt til
+the apartment is private. if the apartment should be public, uncheck this box  
property        no      Leiligheter er ikke
+the apartment is public. if the apartment should be private, check this box    
property        no      leiligheten er merket public. Dersom den skulle være 
privat - kryss av denne boksen
+the building is private. if the building should be public, uncheck this box    
property        no      Bygningen er merket privat. Dersom den skulle være 
public - fjern krysset i denne boksen
+the building is public. if the building should be private, check this box      
property        no      Bygningen er merket public. Dersom den skulle være 
privat - kryss av denne boksen
+the entrance is private. if the entrance should be public, uncheck this box    
property        no      Inngangen er merket privat. Dersom den skulle være 
public - fjern krysset i denne boksen
+the entrance is public. if the entrance should be private, check this box      
property        no      Inngangen er merket public. Dersom den skulle være 
privat - kryss av denne boksen
+the file is already imported ! property        no      Fila er allerede 
importert
+the mail server returned       property        no      E-post serveren 
returnerte
 the number of %1 hour is added!        property        no      %1 poster er 
lagt til
 the project has not been saved property        no      Prosjektet er ikke 
lagret
-The property is private. If the property should be public, uncheck this box    
property        no      Eiendommen er merket privat. Dersom den skulle være 
public - fjern krysset i denne boksen
-The property is public. If the property should be private, check this box      
property        no      Eiendommen er merket public. Dersom den skulle være 
privat - kryss av denne boksen
-The recipient did not get the email:   property        no      Addressaten 
fikk ikke epost:
-The total amount to claim      property        no      Total sum for krav
+the property is private. if the property should be public, uncheck this box    
property        no      Eiendommen er merket privat. Dersom den skulle være 
public - fjern krysset i denne boksen
+the property is public. if the property should be private, check this box      
property        no      Eiendommen er merket public. Dersom den skulle være 
privat - kryss av denne boksen
+the recipient did not get the email:   property        no      Addressaten 
fikk ikke epost:
+the total amount to claim      property        no      Total sum for krav
 the workorder has not been saved       property        no      Arbeidsordren 
er ikke lagret
-This account is not valid:     property        no      Denne kontoen er ikke 
gyldig:
-This activity code is already registered!      property        no      denne 
aktivitetskoden er allrerede registert
-This agreement code is already registered!     property        no      denne 
avtalekoden er allrerede registert
-This agreement group code is already registered!       property        no      
Denne avtale-gruppe-koden er allerede registert!
-This apartment_id ID does not exist!   property        no      Denne leilighet 
ID eksisterer ikke
-This apartment is already registered!  property        no      denne 
leiligheten er allrerede registert
-This attribute turn up as disabled in the form property        no      Denne 
attributten vises som inaktivt i skjemaet
-This Building ID does not exist!       property        no      Denne bygnings 
ID eksisterer ikke
-This building_id ID does not exist!    property        no      Denne bygnings 
ID eksisterer ikke
-This building is already registered!   property        no      denne bygningen 
er allrerede registert
-This Dim A is not valid:       property        no      DIMA er ikke gyldig:
-This Dim D is not valid:       property        no      Denne Dim D er ikke 
gyldig:
-This Entrance ID does not exist!       property        no      Denne inngang 
ID eksisterer ikke
-This entrance_id ID does not exist!    property        no      Denne bygnings 
ID eksisterer ikke
-This entrance is already registered!   property        no      denne inngangen 
er allrerede registert
-This Equipment ID already exists!      property        no      denne 
utstyrskoden er allrerede registert
-This equipment_id ID does not exist!   property        no      Denne bygnings 
ID eksisterer ikke
-This file already exists !     property        no      denne filen finnes 
allrerede
-This location ID does not exist!       property        no      Denne 
lokaliserings ID finnes ikke!
-This location is already registered!   property        no      Denne 
lokaliseringen er allerede registert!
-This location parent ID does not exist!        property        no      Denne 
lokaliserings-forelder ID finnes ikke!
-This meter id is already registered!   property        no      denne måler ID 
er allrerede registert
-This property ID does not exist!       property        no      Denne eiendoms 
ID eksisterer ikke
-This user has not defined an email address !   property        no      Denne 
brukeren har ikke definert en epost adresse !
-This Vendor is already registered for this activity    property        no      
Denne leverandøren er allerede registert for denne aktiviteten
+this account is not valid:     property        no      Denne kontoen er ikke 
gyldig:
+this activity code is already registered!      property        no      denne 
aktivitetskoden er allrerede registert
+this agreement code is already registered!     property        no      denne 
avtalekoden er allrerede registert
+this agreement group code is already registered!       property        no      
Denne avtale-gruppe-koden er allerede registert!
+this apartment_id id does not exist!   property        no      Denne leilighet 
ID eksisterer ikke
+this apartment is already registered!  property        no      denne 
leiligheten er allrerede registert
+this attribute turn up as disabled in the form property        no      Denne 
attributten vises som inaktivt i skjemaet
+this building id does not exist!       property        no      Denne bygnings 
ID eksisterer ikke
+this building_id id does not exist!    property        no      Denne bygnings 
ID eksisterer ikke
+this building is already registered!   property        no      denne bygningen 
er allrerede registert
+this dim a is not valid:       property        no      DIMA er ikke gyldig:
+this dim d is not valid:       property        no      Denne Dim D er ikke 
gyldig:
+this entrance id does not exist!       property        no      Denne inngang 
ID eksisterer ikke
+this entrance_id id does not exist!    property        no      Denne bygnings 
ID eksisterer ikke
+this entrance is already registered!   property        no      denne inngangen 
er allrerede registert
+this equipment id already exists!      property        no      denne 
utstyrskoden er allrerede registert
+this equipment_id id does not exist!   property        no      Denne bygnings 
ID eksisterer ikke
+this file already exists !     property        no      denne filen finnes 
allrerede
+this location id does not exist!       property        no      Denne 
lokaliserings ID finnes ikke!
+this location is already registered!   property        no      Denne 
lokaliseringen er allerede registert!
+this location parent id does not exist!        property        no      Denne 
lokaliserings-forelder ID finnes ikke!
+this meter id is already registered!   property        no      denne måler ID 
er allrerede registert
+this property id does not exist!       property        no      Denne eiendoms 
ID eksisterer ikke
+this user has not defined an email address !   property        no      Denne 
brukeren har ikke definert en epost adresse !
+this vendor is already registered for this activity    property        no      
Denne leverandøren er allerede registert for denne aktiviteten
 ticket property        no      melding
-Ticket property        no      Melding
-Ticket has been saved  property        no      Melding er lagret
-Ticket has been updated        property        no      melding er oppdatert
-Ticket ID      property        no      Melding ID
-Time   property        no      Tid
-Time and budget        property        no      Budsjett og frister
+.ticket        property        no      Melding
+ticket categories      property        no      Meldinger kategorier
+ticket has been saved  property        no      Melding er lagret
+ticket has been updated        property        no      melding er oppdatert
+ticket id      property        no      Melding ID
+time and budget        property        no      Budsjett og frister
 time created   property        no      laget tid
-Times  property        no      Tider
+times  property        no      Tider
+timestampopened        property        no      Startet
 timing property        no      Timing
-Title  property        no      Tittel
-To     property        no      Til
-To alter the priority key      property        no      Endre nøkkel
+title  property        no      Tittel
+to     property        no      Til
+to alter the priority key      property        no      Endre nøkkel
 to date        property        no      Til dato
+todays date, eg. %1    property        no      Dagens dato, %1
 tolerance      property        no      Toleranse
-Total  property        no      Total
-Total Cost     property        no      Total
-Total records  property        no      Total historie
-Total sum      property        no      Total sum
+total cost     property        no      Total
+total sum      property        no      Total sum
 tracking       property        no      Sporing
-Transfer       property        no      Overfør
-True   property        no      True
+transfer       property        no      Overfør
+true   property        no      True
 tts    property        no      melding
 type   property        no      type
-Type   property        no      Type
-Type invoice II        property        no      Type
-Type of changes        property        no      Type av endring
-Uncheck to debug the result    property        no      Ta vekk avkryssning for 
debugging
-Unit   property        no      Enhet
+type invoice ii        property        no      Type
+type of changes        property        no      Type av endring
+uncheck to debug the result    property        no      Ta vekk avkryssning for 
debugging
+unit   property        no      Enhet
 up     property        no      Opp
-Up     property        no      opp
-Update property        no      Oppdater
-Update a single entry by passing the fields.   property        no      
Oppdater en enkelt post
-Update email   property        no      Oppdater e-post
-Update file    property        no      oppdater fil
-Update project property        no      Oppdater prosjekt
+update property        no      Oppdater
+update a single entry by passing the fields.   property        no      
Oppdater en enkelt post
+update email   property        no      Oppdater e-post
+update file    property        no      oppdater fil
+update location        property        no      Oppdater lokasjon
+update project property        no      Oppdater prosjekt
 update selected investments    property        no      opdater avmerkede 
investeringer
 update subject property        no      Oppdater overskrift
-Update the category to not active based on if there is only nonactive 
apartments       property        no      Oppdater kategori til utgått basert på 
om det bare finnes utgåtte leiligheter
-Update the not active category for locations   property        no      
Oppdater kategori til utgått for lokaliseringer
-Upload file    property        no      Last opp fil
-User   property        no      Bruker
-User contact info      property        no      Bruker kontaktinfo
+update the category to not active based on if there is only nonactive 
apartments       property        no      Oppdater kategori til utgått basert på 
om det bare finnes utgåtte leiligheter
+update the not active category for locations   property        no      
Oppdater kategori til utgått for lokaliseringer
+upload file    property        no      Last opp fil
+url    property        no      URL
+user   property        no      Bruker
+user contact info      property        no      Bruker kontaktinfo
 user gratification     property        no      Bruker tilfredsstillelse
-User gratification     property        no      Brukertilfredshet
-Username / Group       property        no      Brukernavn / Gruppe
+username / group       property        no      Brukernavn / Gruppe
 users  property        no      Brukere
-Users  property        no      Brukere
-Users email is updated property        no      Brukers epost er oppdatert
-Users phone is updated property        no      Brukers telefon er oppdatert
-Value  property        no      Verdi
+users email is updated property        no      Brukers epost er oppdatert
+users phone is updated property        no      Brukers telefon er oppdatert
+value  property        no      Verdi
 values property        no      Verdier
 varchar        property        no      varchar
 vendor property        no      leverandør
-Vendor property        no      Leverandør
-Vendor has been added  property        no      leverandør er lagt til
-Vendor ID      property        no      Lev ID
-Vendor Name    property        no      leverandør navn
-Version        property        no      versjon
-view   property        no      Vis
+vendor attributes      property        no      Leverandør attributter
+vendor categories      property        no      Leverandør kategorier
+vendor global categories       property        no      Globale leverandør 
kategorier
+vendor has been added  property        no      leverandør er lagt til
+vendor id      property        no      Lev ID
+vendor name    property        no      leverandør navn
+vendor reminder        property        no      Leverandør purringer
+version        property        no      versjon
 view apartment property        no      vis leilighet
 view building  property        no      vis bygning
 view document  property        no      vis dokument
 view documents for this location/entity        property        no      Vis 
dokumenter for denne lokaliseringen / entiteten
 view documents for this location/equipment     property        no      vis 
dokument for denne lokaliseringen/utstyret
-View/Edit the history  property        no      vis/oppdater historikk
+view/edit the history  property        no      vis/oppdater historikk
 view edit the prize for this activity  property        no      vis/oppdater 
pris for denne aktiviteten
 view entrance  property        no      vis inngang
 view equipment property        no      vis utstyr
-View gab       property        no      Vis GAB
-view gab detail        property        no      Vis GAB-detaljer
-View gab-info  property        no      Vis GAB info
+view error log common  no      Vis feilmeldings log
+view gab       property        no      Vis GrunnEiendom
+view gab detail        property        no      Vis GrunnEiendom-detaljer
+view gab-info  property        no      Vis GrunnEiendom
 view information about the document    property        no      vis informasjon 
om dokumentet
 view investment        property        no      vis investering
-View map       property        no      Vis kart
-View meter     property        no      vise måler
+view map       property        no      Vis kart
+view meter     property        no      vise måler
 view or edit prizing history of this element   property        no      vis 
eller oppdater pris-historikk for dette elementet
-View Project   property        no      vis prosjekt
+view project   property        no      vis prosjekt
 view property  property        no      vis eiendom
-View request   property        no      vis anmodning
+view request   property        no      vis anmodning
 view template detail   property        no      vis mal-detaljer
-View tender    property        no      Vis anbud
+view tender    property        no      Vis beskrivelse
 view the apartment     property        no      vis leilighet
 view the attrib        property        no      vis attributt
 view the budget account        property        no      Vis budsjettkonto
 view the building      property        no      vis bygning
 view the category      property        no      Vis kategorien
 view the claim property        no      Vis kravet
-View the complete workorder    property        no      vis komplett 
arbeidsordre
-View the complete workorder as a tender for bidding    property        no      
vis komplett arbeidsordre som anbud
+view the complete workorder    property        no      vis komplett 
arbeidsordre
+view the complete workorder as a tender for bidding    property        no      
vis komplett arbeidsordre som beskrivelse
 view the document      property        no      vis dokument
 view the entity        property        no      Vis entiteten
 view the entrance      property        no      vis inngang
 view the equipment     property        no      vis utstyr
-view the gab   property        no      Vis GABinfo
+view the gab   property        no      Vis GrunnEiendom
 view the location      property        no      Vis lokalisering
 view the meter property        no      vis måler
 view the method        property        no      Vis metoden
@@ -1579,55 +1702,57 @@
 view the ticket        property        no      vis melding
 view the vendor(s) for this activity   property        no      vis 
leverandør(er) for dette elementet
 view the workorder     property        no      vis arberidsordre
+view this entity       property        no      Vis denne entiteten
 view ticket detail     property        no      vis meldingsdetalj
-View Workorder property        no      Vis arbeidsordre
+view workorder property        no      Vis arbeidsordre
 voucher        property        no      Bilag
-Voucher Date   property        no      Bilags dato
-Voucher ID     property        no      Bilags nr
+voucher date   property        no      Bilags dato
+voucher id     property        no      Bilags nr
+voucher is updated     property        no      Bilag er oppdatert
 voucher is updated:    property        no      Bilag er oppdatert:
-Voucher is updated     property        no      Bilag er oppdatert
 voucher period is updated      property        no      bilags periode er 
oppdatert
+Warning: the record has to be saved in order to plan an event  property        
no      NB! posten må lagres før hendelse kan planlegges
 w_cost property        no      Arbeidskostnad
-Weight for prioritising        property        no      Vekting av prioritering
-What is the current status of this document ?  property        no      hva er 
status for dette dokumentet ?
-What is the current status of this equipment ? property        no      hva er 
status for dette utstyret ?
-What is the current status of this project ?   property        no      hva er 
status for dette prosjektet ?
-What is the current status of this request ?   property        no      hva er 
status for denne anmodningen ?
-What is the current status of this workorder ? property        no      hva er 
status for denne arbeidsordren ?
-Where to deliver the key       property        no      Nøkler leveres
-Where to fetch the key property        no      Nøkler hentes
-Where to pick up the key       property        no      Nøkler hentes
-Which entity type is to show up in location forms      property        no      
Hvilke Entitet-type skal vises i lokaliseringsskjema
+weekly property        no      Ukentlig
+weight for prioritising        property        no      Vekting av prioritering
+what is the current status of this document ?  property        no      hva er 
status for dette dokumentet ?
+what is the current status of this equipment ? property        no      hva er 
status for dette utstyret ?
+what is the current status of this project ?   property        no      hva er 
status for dette prosjektet ?
+what is the current status of this request ?   property        no      hva er 
status for denne anmodningen ?
+what is the current status of this workorder ? property        no      hva er 
status for denne arbeidsordren ?
+where to deliver the key       property        no      Nøkler leveres
+where to fetch the key property        no      Nøkler hentes
+where to pick up the key       property        no      Nøkler hentes
+which entity type is to show up in location forms      property        no      
Hvilke Entitet-type skal vises i lokaliseringsskjema
 work:____________      property        no      Arbeid:____________
-Workorder      property        no      Arbeidsordre
+workorder      property        no      Arbeidsordre
 workorder %1 has been edited   property        no      Arbeidsordre %1 er 
oppdatert
 workorder %1 has been saved    property        no      Arbeidsordre %1 er 
lagret
-Workorder end date     property        no      Arbeidsordre frist
-Workorder entry date   property        no      Registreringsdato
-Workorder ID   property        no      Arbeidsordre
-Workorder is sent by email!    property        no      Arbeidsordre er sendt 
pr e-post!
-Workorder start date   property        no      Arbeidsordre start dato
-Workorder status       property        no      Status
-Workorder template     property        no      Arbeidsordre mal
-Workorder title        property        no      Arbeidsordre tittel
-Workorder User property        no      Bruker
-Write off      property        no      avskrivning
-Write off period       property        no      avskrivningsperiode
-Year   property        no      Ã…r
-yes    property        no      Ja
-You have entered an invalid end date ! property        no      Du har angitt 
en ugyldig slutt dato
-You have entered an invalid start date !       property        no      Du har 
angitt en ugyldig start dato
-You have no edit right for this project        property        no      Du har 
ikke editeringsrettigheter for dette prosjektet
-You have to select a budget responsible for this invoice in order to add the 
invoice   property        no      Du må velge en budsjettansvarlig for å kunne 
legge til en faktura
-You have to select a budget responsible for this invoice in order to make the 
import   property        no      Du må velge en budsjettansvarlig for å 
importere
-You have to select the Conversion for this import      property        no      
Du må velge importformat
-You have to select type of invoice     property        no      Du må velge art
-Your message could not be sent!        property        no      Din melding 
kunne ikke sendes
-Your message could not be sent by mail!        property        no      Din 
melding kunne ikke sendes med epost!
-obligations    property        no      forpliktelser
-contractual obligations        property        no      forpliktelser
-.project       property        no      Prosjekt
-.project.workorder     property        no      Arbeidsordre
-.project.request       property        no      Behov
-.tenant_claim  property        no      Leietaker krav
-.ticket        property        no      Melding
+workorder %1 needs approval    property        no      Bestilling %1 venter på 
godkjenning
+workorder detail categories    property        no      Detaljering av 
arbeidsordre/bestilling
+workorder end date     property        no      Arbeidsordre frist
+workorder entry date   property        no      Registreringsdato
+workorder id   property        no      Arbeidsordre
+workorder is sent by email!    property        no      Arbeidsordre er sendt 
pr e-post!
+workorders status      property        no      Status arbeidsordre/bestilling
+workorder start date   property        no      Arbeidsordre start dato
+workorder status       property        no      Status
+workorder template     property        no      Arbeidsordre mal
+workorder title        property        no      Arbeidsordre tittel
+workorder user property        no      Bruker
+write off      property        no      avskrivning
+write off period       property        no      avskrivningsperiode
+year   property        no      Ã…r
+yearly property        no      Ã…rlig
+you have entered an invalid end date ! property        no      Du har angitt 
en ugyldig slutt dato
+you have entered an invalid start date !       property        no      Du har 
angitt en ugyldig start dato
+you have no edit right for this project        property        no      Du har 
ikke editeringsrettigheter for dette prosjektet
+you have to select a budget responsible for this invoice in order to add the 
invoice   property        no      Du må velge en budsjettansvarlig for å kunne 
legge til en faktura
+you have to select a budget responsible for this invoice in order to make the 
import   property        no      Du må velge en budsjettansvarlig for å 
importere
+you have to select the conversion for this import      property        no      
Du må velge importformat
+you have to select type of invoice     property        no      Du må velge art
+your message could not be sent!        property        no      Din melding 
kunne ikke sendes
+your message could not be sent by mail!        property        no      Din 
melding kunne ikke sendes med epost!
+usertype       common  no      Brukertype
+tenant common  no      Leietaker
+internal       common  no      Intern

Modified: people/sigurdne/modules/property/trunk/setup/setup.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/setup.inc.php  2009-11-20 
10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/setup/setup.inc.php  2009-11-20 
10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']         = 'property';
-       $setup_info['property']['version']      = '0.9.17.546';
+       $setup_info['property']['version']              = '0.9.17.576';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']       = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -119,8 +119,10 @@
                'fm_template_hours',
                'fm_chapter',
                'fm_ns3420',
+               'fm_project_status',
                'fm_project',
                'fm_projectbranch',
+               'fm_project_group',
                'fm_project_history',
                'fm_tts_status',
                'fm_tts_tickets',
@@ -137,12 +139,14 @@
                'fm_ecologg',
                'fm_ecomva',
                'fm_ecouser',
+               'fm_event',
+               'fm_event_action',
+               'fm_event_exception',
                'fm_investment',
                'fm_investment_value',
                'fm_event_receipt',
                'fm_idgenerator',
                'fm_document',
-               'fm_document_category',
                'fm_document_history',
                'fm_document_status',
                'fm_standard_unit',
@@ -162,6 +166,7 @@
                'fm_custom_cols',
                'fm_orders',
                'fm_s_agreement',
+               'fm_s_agreement_budget',
                'fm_s_agreement_category',
                'fm_s_agreement_detail',
                'fm_s_agreement_pricing',
@@ -181,18 +186,21 @@
                'fm_budget_period',
                'fm_budget_cost',
                'fm_responsibility',
-               'fm_responsibility_contact'
+               'fm_responsibility_contact',
+               'fm_action_pending',
+               'fm_action_pending_category'
        );
 
        /* The hooks this app includes, needed for hooks registration */
        $setup_info['property']['hooks'] = array
        (
-               'add_def_pref',
                'deleteaccount',
                'manual',
                'settings',
                'help',
-               'menu'  => 'property.menu.get_menu'
+               'menu'  => 'property.menu.get_menu',
+               'config',
+               'home'
        );
 
        /* Dependencies for this app to work */

Modified: people/sigurdne/modules/property/trunk/setup/tables_current.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/tables_current.inc.php 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/setup/tables_current.inc.php 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -64,6 +64,7 @@
                                'first_name' => array('type' => 
'varchar','precision' => '30','nullable' => True),
                                'last_name' => array('type' => 
'varchar','precision' => '30','nullable' => True),
                                'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'contact_email' => array('type' => 
'varchar','precision' => '64','nullable' => True),
                                'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'phpgw_account_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'account_lid' => array('type' => 
'varchar','precision' => '25','nullable' => True),
@@ -190,7 +191,10 @@
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'kostra_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
+                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
                        ),
                        'pk' => array('loc1'),
                        'fk' => array('fm_location1_category' => 
array('category' => 'id')),
@@ -213,6 +217,9 @@
                                'kostra_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'exp_date' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp')
                        ),
                        'pk' => array(),
@@ -242,7 +249,10 @@
                                'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
+                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
                        ),
                        'pk' => array('loc1','loc2'),
                        'fk' => array(
@@ -265,6 +275,9 @@
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'exp_date' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp')
                        ),
                        'pk' => array(),
@@ -295,7 +308,10 @@
                                'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
+                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
                        ),
                        'pk' => array('loc1','loc2','loc3'),
                        'fk' => array(
@@ -319,6 +335,9 @@
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'exp_date' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp')
                        ),
                        'pk' => array(),
@@ -354,7 +373,10 @@
                                'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
+                               'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
                        ),
                        'pk' => array('loc1','loc2','loc3','loc4'),
                        'fk' => array(
@@ -382,6 +404,9 @@
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'change_type' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'rental_area' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_gross' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_net' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'area_usable' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
                                'exp_date' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp')
                        ),
                        'pk' => array(),
@@ -477,7 +502,17 @@
                                'integration' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'charge_tenant' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'claim_issued' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'paid' => array('type' => 'int','precision' => 
'2','nullable' => True,'default' => '1')
+                               'paid' => array('type' => 'int','precision' => 
'2','nullable' => True,'default' => '1'),
+                               'ecodimb'=> array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'paid_percent' => array('type' => 
'int','precision' => 4,'nullable' => True,'default' => 0),
+                               'event_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -487,7 +522,11 @@
                'fm_workorder_status' => array(
                        'fd' => array(
                                'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'approved' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'in_progress' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'delivered' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'closed' => array('type' => 'int','precision' 
=> '2','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -707,7 +746,7 @@
                'fm_request' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'title' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'title' => array('type' => 
'varchar','precision' => '100','nullable' => True),
                                'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
                                'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
@@ -787,7 +826,11 @@
                        'fd' => array(
                                'id' => array('type' => 'auto','nullable' => 
False),
                                'name' => array('type' => 'varchar','precision' 
=> '50','nullable' => False),
-                               'color' => array('type' => 
'varchar','precision' => '10','nullable' => True)
+                               'color' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'closed' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'approved' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'in_progress' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'delivered' => array('type' => 
'int','precision' => '2','nullable' => True),
                        ),
                        'pk' => array('id'),
                        'ix' => array(),
@@ -818,10 +861,19 @@
                                'floor' => array('type' => 
'varchar','precision' => '6','nullable' => True),
                                'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
                                'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'contact_email' => array('type' => 
'varchar','precision' => '64','nullable' => True),
                                'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'finnish_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'finnish_date2' => array('type' => 
'int','precision' => '4','nullable' => True)
+                               'finnish_date2' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'order_id' => array('type' => 'int','precision' 
=> 8,'nullable' => True),
+                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'order_descr' => array('type' => 
'text','nullable' => True),
+                               'b_account_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'ecodimb' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'budget' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'actual_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
                        ),
                        'pk' => array('id'),
                        'ix' => array(),
@@ -857,7 +909,7 @@
                                'forfallsdato' => array('type' => 
'timestamp','nullable' => False),
                                'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
                                'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'spvend_code' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'oppsynsmannid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
                                'saksbehandlerid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
                                'budsjettansvarligid' => array('type' => 
'varchar','precision' => '12','nullable' => False),
@@ -892,7 +944,7 @@
                                'regtid' => array('type' => 
'timestamp','nullable' => False),
                                'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
                                'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'spvend_code' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'dima' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
                                'loc1' => array('type' => 'varchar','precision' 
=> '10','nullable' => True),
                                'dimb' => array('type' => 'int','precision' => 
'2','nullable' => True),
@@ -911,7 +963,8 @@
                                'kreditnota' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'pre_transfer' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'item_type' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'item_id' => array('type' => 
'varchar','precision' => '20','nullable' => True)
+                               'item_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'external_ref' => array('type' => 
'varchar','precision' => '30','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'ix' => array(),
@@ -937,7 +990,7 @@
                                'regtid' => array('type' => 
'timestamp','nullable' => False),
                                'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
                                'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'spvend_code' => array('type' => 
'int','precision' => 4,'nullable' => True),
                                'dima' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
                                'loc1' => array('type' => 'varchar','precision' 
=> '10','nullable' => True),
                                'dimb' => array('type' => 'int','precision' => 
'2','nullable' => True),
@@ -958,7 +1011,8 @@
                                'filnavn' => array('type' => 
'varchar','precision' => '255','nullable' => False),
                                'kreditnota' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'item_type' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'item_id' => array('type' => 
'varchar','precision' => '20','nullable' => True)
+                               'item_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'external_ref' => array('type' => 
'varchar','precision' => '30','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'ix' => array(),
@@ -1040,6 +1094,60 @@
                        'fk' => array(),
                        'uc' => array()
                ),
+               'fm_event_action' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
4,'nullable' => False),
+                               'name' =>  array('type' => 
'varchar','precision' => 100,'nullable' => False),
+                               'action' =>  array('type' => 
'varchar','precision' => 100,'nullable' => False),
+                               'data' => array('type' => 'text','nullable' => 
True),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'user_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       ),
+               'fm_event' =>array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'location_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                               'location_item_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                               'attrib_id' => array('type' => 
'varchar','precision' => 50,'default' => '0','nullable' => true),
+                               'responsible_id' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                               'action_id' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'start_date' => array('type' => 
'int','precision' => 4,'nullable' => false),
+                               'end_date' => array('type' => 'int','precision' 
=> 4,'nullable' => true),
+                               'repeat_type' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                               'repeat_day' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                               'repeat_interval' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                               'enabled' => array('type' => 'int','precision' 
=> 2,'nullable' => true),
+                               'user_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array('location_id', 'location_item_id', 
'attrib_id')
+               ),
+               'fm_event_exception' => array(
+                       'fd' => array(
+                               'event_id' => array('type' => 'int','precision' 
=> 4,'nullable' => False),
+                               'exception_time' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'user_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                       ),
+                       'pk' => array('event_id', 'exception_time'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_request_condition_type' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
@@ -1061,6 +1169,18 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_project_status' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'approved' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'closed' => array('type' => 'int','precision' 
=> '2','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_project' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
@@ -1090,13 +1210,28 @@
                                'key_fetch' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'key_deliver' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'other_branch' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'key_responsible' => array('type' => 
'int','precision' => '4','nullable' => True)
+                               'key_responsible' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'project_group' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'planned_cost' => array('type' => 
'int','precision' => '4','nullable' => True, 'default' => '0'),
+                               'account_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'ecodimb' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'contact_id' => array('type' => 
'int','precision' => 4,'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
                        'ix' => array('location_code'),
                        'uc' => array()
                ),
+               'fm_project_group' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_event_receipt' => array(
                        'fd' => array(
                                'cal_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
@@ -1164,7 +1299,7 @@
                'fm_document' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'title' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'title' => array('type' => 
'varchar','precision' => '100','nullable' => True),
                                'document_name' => array('type' => 
'varchar','precision' => '50','nullable' => True),
                                'link' => array('type' => 'text','nullable' => 
True),
                                'descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
@@ -1193,16 +1328,6 @@
                        'ix' => array('location_code'),
                        'uc' => array()
                ),
-               'fm_document_category' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
                'fm_document_status' => array(
                        'fd' => array(
                                'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
@@ -1221,6 +1346,7 @@
                                'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
                                'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
                                'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
                        ),
                        'pk' => array('history_id'),
@@ -1236,6 +1362,7 @@
                                'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
                                'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
                                'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
                        ),
                        'pk' => array('history_id'),
@@ -1251,6 +1378,7 @@
                                'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
                                'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
                                'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
                        ),
                        'pk' => array('history_id'),
@@ -1264,8 +1392,9 @@
                                'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
                                'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_status' => array('type' => 
'varchar','precision' => '3','nullable' => False),
                                'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
                                'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
                        ),
                        'pk' => array('history_id'),
@@ -1281,6 +1410,7 @@
                                'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
                                'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
                                'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
                        ),
                        'pk' => array('history_id'),
@@ -1345,8 +1475,8 @@
                        'fd' => array(
                                'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => True),
+                               'descr' => array('type' => 'text','nullable' => 
True),
                                'prefix' => array('type' => 
'varchar','precision' => '50','nullable' => True),
                                'lookup_tenant' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'tracking' => array('type' => 'int','precision' 
=> '4','nullable' => True),
@@ -1354,7 +1484,8 @@
                                'fileupload' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'loc_link' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'start_project' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'start_ticket' => array('type' => 
'int','precision' => '2','nullable' => True)
+                               'start_ticket' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'jasperupload' => array('type' => 
'int','precision' => '2','nullable' => True)
                        ),
                        'pk' => array('entity_id','id'),
                        'fk' => array(),
@@ -1381,6 +1512,7 @@
                                'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
                                'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
                                'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
                        ),
                        'pk' => array('history_id'),
@@ -1592,6 +1724,25 @@
                        'uc' => array()
                ),
 
+               'fm_s_agreement_budget' => array(
+                       'fd' => array(
+                               'agreement_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                               'year' => array('type' => 'int','precision' => 
4,'nullable' => False),
+                               'budget_account' =>  array('type' => 
'varchar','precision' => 15,'nullable' => False),
+                               'ecodimb' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'actual_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'user_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                       ),
+                       'pk' => array('agreement_id','year'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
                'fm_s_agreement_category' => array(
                        'fd' => array(
                                'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
@@ -1655,6 +1806,7 @@
                                'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
                                'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
                                'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
                        ),
                        'pk' => array('history_id'),
@@ -1739,8 +1891,6 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-
-
                'fm_r_agreement_category' => array(
                        'fd' => array(
                                'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
@@ -1751,7 +1901,6 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-
                'fm_r_agreement_item' => array(
                        'fd' => array(
                                'agreement_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
@@ -1844,7 +1993,9 @@
                                'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'budget_cost' => array('type' => 'int', 
'precision' => 4,'default' => '0','nullable' => True),
                                'remark' => array('type' => 'text','nullable' 
=> True),
-                               'distribute_year' => array('type' => 
'text','nullable' => True)
+                               'distribute_year' => array('type' => 
'text','nullable' => True),
+                               'ecodimb'=> array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'category'=> array('type' => 'int','precision' 
=> 4,'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -1856,13 +2007,15 @@
                                'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False),
                                'year' => array('type' => 'int', 'precision' => 
4,'nullable' => False),
                                'b_account_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'district_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'district_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'revision' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
                                'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
                                'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'budget_cost' => array('type' => 'int', 
'precision' => 4,'default' => '0','nullable' => True),
-                               'remark' => array('type' => 'text','nullable' 
=> True)
+                               'remark' => array('type' => 'text','nullable' 
=> True),
+                               'ecodimb'=> array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'category'=> array('type' => 'int','precision' 
=> 4,'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -1903,14 +2056,13 @@
                                'name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'descr' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
                                'active' => array('type' => 'int','precision' 
=> 2,'nullable' => True),
-                               'cat_id' => array('type' => 'int','precision' 
=> 4,'nullable' => False),
+                               'location_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'cat_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
                                'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                        ),
                        'pk' => array('id'),
-                       'fk' => array(
-                               'phpgw_categories' => array('cat_id' => 
'cat_id')
-                       ),
+                       'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
                ),
@@ -1930,7 +2082,8 @@
                                'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'expired_on' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'expired_by' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'remark' => array('type' => 'text','nullable' 
=> True),
+                               'ecodimb' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'remark' => array('type' => 'text','nullable' 
=> True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(
@@ -1939,5 +2092,40 @@
                        ),
                        'ix' => array('location_code'),
                        'uc' => array()
+               ),
+               'fm_action_pending' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'item_id' => array('type' => 'int','precision' 
=> 8,'nullable' => False),
+                               'location_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'responsible' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                               'responsible_type' => array('type' => 
'varchar','precision' => 20,'nullable' => False),
+                               'action_category'       => array('type' => 
'int','precision' => 4,'nullable' => False),
+                               'action_requested' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                               'action_deadline' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                               'action_performed' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                               'reminder' => array('type' => 'int','precision' 
=> 4,'nullable' => True,'default' => '1'),
+                               'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),//timestamp
+                               'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'expired_on' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                               'expired_by' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'remark' => array('type' => 'text','nullable' 
=> True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_action_pending_category' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar', 'precision' 
=> 25,'nullable' => True),
+                               'name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => True),
+                               'descr' => array('type' => 'text','nullable' => 
True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array('num')
                )
        );

Modified: people/sigurdne/modules/property/trunk/setup/tables_update.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/tables_update.inc.php  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/setup/tables_update.inc.php  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
@@ -2720,6 +2720,7 @@
                }
 
                $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_acl set 
acl_grantor = -1 WHERE acl_grantor IS NULL",__LINE__,__FILE__);
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_cache_user",__LINE__,__FILE__);
 
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
@@ -2727,3 +2728,1149 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.546 to 0.9.17.547
+       * Udate missing information on table for custom fields for owner, 
tenant and vendor
+       */
+
+       $test[] = '0.9.17.546';
+       function property_upgrade0_9_17_546()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', '.owner');
+               $sql = "UPDATE phpgw_locations SET allow_c_attrib = 1, 
c_attrib_table = 'fm_owner' WHERE location_id = {$location_id}";
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', '.tenant');
+               $sql = "UPDATE phpgw_locations SET allow_c_attrib = 1, 
c_attrib_table = 'fm_tenant' WHERE location_id = {$location_id}";
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               $location_id    = 
$GLOBALS['phpgw']->locations->get_id('property', '.vendor');
+               $sql = "UPDATE phpgw_locations SET allow_c_attrib = 1, 
c_attrib_table = 'fm_vendor' WHERE location_id = {$location_id}";
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.547';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.547 to 0.9.17.548
+       * Drop some old tables and add custom attribute groups if this was 
missed during api-upgrade
+       */
+
+       $test[] = '0.9.17.547';
+       function property_upgrade0_9_17_547()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $metadata = 
$GLOBALS['phpgw_setup']->db->metadata('fm_equipment');
+               if($metadata)
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_equipment');
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_equipment_attrib');
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_equipment_status');
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_equipment_type');
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_equipment_type_attrib');
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_equipment_type_choice');
+               }
+
+               $metadata = $GLOBALS['phpgw_setup']->db->metadata('fm_meter');
+               if($metadata)
+               {
+                       $GLOBALS['phpgw_setup']->oProc->DropTable('fm_meter');
+                       
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_meter_category');
+               }
+
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("SELECT count(*) 
as found_some FROM phpgw_cust_attribute_group");
+               $GLOBALS['phpgw_setup']->oProc->m_odb->next_record();
+               if( !$GLOBALS['phpgw_setup']->oProc->f('found_some') )
+               {
+                       $GLOBALS['phpgw_setup']->oProc->m_odb->query("SELECT 
DISTINCT location_id FROM phpgw_cust_attribute");
+                       $locations = array();
+                       while 
($GLOBALS['phpgw_setup']->oProc->m_odb->next_record())
+                       {
+                               $locations[] = 
$GLOBALS['phpgw_setup']->oProc->f('location_id');
+                       }
+
+                       foreach ($locations as $location_id)
+                       {
+                               
$GLOBALS['phpgw_setup']->oProc->m_odb->query("INSERT INTO 
phpgw_cust_attribute_group (location_id, id, name, group_sort, descr)"
+                               ." VALUES ({$location_id}, 1, 'Default group', 
1, 'Auto created from db-update')", __LINE__, __FILE__);
+                       }
+               }
+
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.548';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.548 to 0.9.17.549
+       * Add new table for project_group
+       */
+
+       $test[] = '0.9.17.548';
+       function property_upgrade0_9_17_548()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_project_group', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project','project_group',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.549';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.549 to 0.9.17.550
+       * FIXME: Figure out the correct conversion of categories that comply 
with interlink
+       */
+
+       $test[] = '0.9.17.549';
+       function property_upgrade0_9_17_549()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               // Need account_repository, accounts, acl and hooks to use 
categories
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT config_value FROM 
phpgw_config WHERE config_app = 'phpgwapi' AND config_name = 
'account_repository'");
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $GLOBALS['phpgw_info']['server']['account_repository'] = 
$GLOBALS['phpgw_setup']->oProc->f('config_value');
+
+               $GLOBALS['phpgw']->accounts             = 
createObject('phpgwapi.accounts');
+
+               $GLOBALS['phpgw']->db = & $GLOBALS['phpgw_setup']->oProc->m_odb;
+               $GLOBALS['phpgw']->acl = CreateObject('phpgwapi.acl');
+               $GLOBALS['phpgw']->hooks = CreateObject('phpgwapi.hooks', 
$GLOBALS['phpgw_setup']->oProc->m_odb);
+               $cats = CreateObject('phpgwapi.categories', -1, 
'property.document');
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_document_category");
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       
$categories[$GLOBALS['phpgw_setup']->oProc->f('id')]=array(
+                               'name'  => 
$GLOBALS['phpgw_setup']->oProc->f('descr', true),
+                               'descr' => 
$GLOBALS['phpgw_setup']->oProc->f('descr', true),
+                               'parent' => 'none',
+                               'old_parent' => 0,
+                               'access' => 'public'
+                       );
+               }
+
+               foreach ($categories as $old => $values)
+               {
+                       $cat_id = $cats->add($values);
+                       $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
fm_document SET category = $cat_id WHERE category = $old");
+               }
+
+               
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_document_category');
+
+               unset($GLOBALS['phpgw']->accounts);
+               unset($GLOBALS['phpgw']->acl);
+               unset($GLOBALS['phpgw']->hooks);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.550';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+
+       /**
+       * Update property version from 0.9.17.550 to 0.9.17.551
+       */
+
+       $test[] = '0.9.17.550';
+       function property_upgrade0_9_17_550()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request_history','history_old_value',array('type'
 => 'text','nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder_history','history_old_value',array('type'
 => 'text','nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project_history','history_old_value',array('type'
 => 'text','nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_history','history_old_value',array('type'
 => 'text','nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_document_history','history_old_value',array('type'
 => 'text','nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_entity_history','history_old_value',array('type'
 => 'text','nullable' => true));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_s_agreement_history','history_old_value',array('type'
 => 'text','nullable' => true));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.551';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.551 to 0.9.17.552
+       * Reorganise documents
+       */
+
+       $test[] = '0.9.17.551';
+       function property_upgrade0_9_17_551()
+       {
+               set_time_limit(1800);
+               $next_version = '0.9.17.552';
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_document");
+               $files = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $files[]=array
+                       (
+                               'document_name' => 
$GLOBALS['phpgw_setup']->oProc->f('document_name'),
+                               'location_code' => 
$GLOBALS['phpgw_setup']->oProc->f('location_code'),
+                               'loc1'                  => 
$GLOBALS['phpgw_setup']->oProc->f('loc1'),
+                               'category'              => 
$GLOBALS['phpgw_setup']->oProc->f('category'),
+                               'p_num'                 => 
$GLOBALS['phpgw_setup']->oProc->f('p_num'),
+                               'p_entity_id'   => 
$GLOBALS['phpgw_setup']->oProc->f('p_entity_id'),
+                               'p_cat_id'              => 
$GLOBALS['phpgw_setup']->oProc->f('p_cat_id'),
+                       );
+               }
+
+               $sql = 'SELECT config_name,config_value FROM phpgw_config'
+                                       . " WHERE config_name = 'files_dir'"
+                                       . " OR config_name = 'file_repository'";
+
+               $GLOBALS['phpgw_setup']->oProc->query($sql, __LINE__, __FILE__);
+               while ( $GLOBALS['phpgw_setup']->oProc->next_record() )
+               {
+                       
$GLOBALS['phpgw_info']['server'][$GLOBALS['phpgw_setup']->oProc->f('config_name',
 true)] = $GLOBALS['phpgw_setup']->oProc->f('config_value', true);
+               }
+               $GLOBALS['phpgw']->db = & $GLOBALS['phpgw_setup']->oProc->m_odb;
+               $acl = CreateObject('phpgwapi.acl');
+
+               $admins = $acl->get_ids_for_location('run', 1, 'admin');
+               $GLOBALS['phpgw_info']['user']['account_id'] = $admins[0];
+
+               //used in vfs
+               define('PHPGW_ACL_READ',1);
+               define('PHPGW_ACL_ADD',2);
+               define('PHPGW_ACL_EDIT',4);
+               define('PHPGW_ACL_DELETE',8);
+
+               $GLOBALS['phpgw']->session              = 
createObject('phpgwapi.sessions');
+               $vfs                    = CreateObject('phpgwapi.vfs');
+               $vfs->fakebase  = '/property';
+               $vfs->override_acl = 1;
+
+
+               if(!is_dir("{$vfs->basedir}{$vfs->fakebase}"))
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_abort();
+                       $GLOBALS['setup_info']['property']['currentver'] = 
$next_version;
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+
+
+               $to_dir = array();
+               foreach ($files as $entry)
+               {
+                        if($entry['p_num'])
+                        {
+                               continue;
+                        }
+                        else
+                        {
+                               
$to_dir["{$vfs->basedir}{$vfs->fakebase}/document/{$entry['location_code']}"] = 
true;
+                               
$to_dir["{$vfs->basedir}{$vfs->fakebase}/document/{$entry['location_code']}/{$entry['category']}"]
 = true;
+                        }
+               }
+
+               foreach ($to_dir as $dir => $dummy)
+               {
+                       if(!is_dir($dir))
+                       {
+                               mkdir($dir, 0770);
+                       }
+               }
+
+               reset($files);
+               $error = array();
+               foreach ($files as $entry)
+               {
+                        if($entry['p_num'])
+                        {
+                               continue;
+                        }
+                        else
+                        {
+                               $from_file = 
"{$vfs->fakebase}/document/{$entry['loc1']}/{$entry['document_name']}";
+                               $to_file = 
"{$vfs->fakebase}/document/{$entry['location_code']}/{$entry['category']}/{$entry['document_name']}";
+                        }
+
+                       if(!$vfs->mv (array (
+                               'from'          => $from_file,
+                               'to'            => $to_file,
+                               'relatives'     => array (RELATIVE_ALL, 
RELATIVE_ALL))))
+                       {
+                               $error[] = lang('Failed to move file') . " 
{$from_file}";
+                       }
+               }
+
+               $vfs->override_acl = 0;
+               if($error)
+               {
+                       _debug_array($error);
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
$next_version;
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.552 to 0.9.17.553
+       * 
+       */
+
+       $test[] = '0.9.17.552';
+       function property_upgrade0_9_17_552()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw']->locations->add('.invoice.dimb', 'A dimension 
for accounting', 'property');
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','ecodimb',array('type' 
=> 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_budget','ecodimb',array('type' => 
'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_budget_basis','ecodimb',array('type'
 => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_budget','category',array('type' 
=> 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_budget_basis','category',array('type'
 => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_entity_category','name',array('type'
 => 'varchar','precision' => '100','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_entity_category','descr',array('type'
 => 'text','nullable' => True));
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_budget','district_id',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','p_num', array('type' 
=> 'varchar','precision' => 15,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','p_entity_id', 
array('type' => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','p_cat_id', 
array('type' => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','location_code', 
array('type' => 'varchar','precision' => 20,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','address', 
array('type' => 'varchar','precision' => 150,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','tenant_id', 
array('type' => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','contact_phone', 
array('type' => 'varchar','precision' => 20,'nullable' => True));
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project','planned_cost', 
array('type' => 'int','precision' => 4,'nullable' => True, 'default' => '0'));
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_s_agreement_budget', array(
+                               'fd' => array(
+                                       'agreement_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'year' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'budget_account' =>  array('type' => 
'varchar','precision' => 15,'nullable' => False),
+                                       'ecodimb' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'category' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                                       'actual_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                                       'user_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                               ),
+                               'pk' => array('agreement_id','year'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.553';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.553 to 0.9.17.554
+       * 
+       */
+
+       $test[] = '0.9.17.553';
+       function property_upgrade0_9_17_553()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $metadata = 
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata('fm_workorder');
+
+               if(!isset($metadata['paid_percent']))
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','paid_percent', 
array('type' => 'int','precision' => 4,'nullable' => True,'default' => 0));
+               }
+
+               if(!isset($metadata['category']))
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','category', 
array('type' => 'int','precision' => 4,'nullable' => True));
+               }
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project','account_id', 
array('type' => 'varchar','precision' => '20','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project','ecodimb', array('type' 
=> 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.554';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.554 to 0.9.17.555
+       * 
+       */
+
+       $test[] = '0.9.17.554';
+       function property_upgrade0_9_17_554()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM fm_cache');
+               $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM 
phpgw_cache_user');
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_responsibility_contact','ecodimb',
 array('type' => 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.555';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.555 to 0.9.17.556
+       * Scheduling capabilities by custom fields and asyncservice
+       * 
+       */
+
+       $test[] = '0.9.17.555';
+       function property_upgrade0_9_17_555()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_event_action', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'name' =>  array('type' => 
'varchar','precision' => 100,'nullable' => False),
+                                       'action' =>  array('type' => 
'varchar','precision' => 100,'nullable' => False),
+                                       'data' => array('type' => 
'text','nullable' => True),
+                                       'descr' => array('type' => 
'text','nullable' => True),
+                                       'user_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_event', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','precision' => 4,'nullable' => False),
+                                       'location_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'location_item_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'attrib_id' => array('type' => 
'int','precision' => 4,'default' => '0','nullable' => true),
+                                       'responsible_id' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                                       'action_id' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                                       'descr' => array('type' => 
'text','nullable' => True),
+                                       'start_date' => array('type' => 
'int','precision' => 4,'nullable' => false),
+                                       'end_date' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                                       'repeat_type' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                                       'repeat_day' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                                       'repeat_interval' => array('type' => 
'int','precision' => 4,'nullable' => true),
+                                       'enabled' => array('type' => 
'int','precision' => 2,'nullable' => true),
+                                       'user_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array('location_id', 
'location_item_id', 'attrib_id')
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->DropTable('fm_responsibility');
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_responsibility', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                                       'descr' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
+                                       'active' => array('type' => 
'int','precision' => 2,'nullable' => True),
+                                       'cat_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'location_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                                       'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.556';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+       /**
+       * Update property version from 0.9.17.556 to 0.9.17.557
+       * Scheduling capabilities by custom fields and asyncservice
+       * 
+       */
+
+       $test[] = '0.9.17.556';
+       function property_upgrade0_9_17_556()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_event_exception', array(
+                               'fd' => array(
+                                       'event_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'exception_time' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'descr' => array('type' => 
'text','nullable' => True),
+                                       'user_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)
+                               ),
+                               'pk' => array('event_id', 'exception_time'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.557';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.557 to 0.9.17.558
+       * Rename reserved fieldname (mysql)
+       * 
+       */
+
+       $test[] = '0.9.17.557';
+       function property_upgrade0_9_17_557()
+       {
+               $metadata = 
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata('fm_event');
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               if(isset($metadata['interval']))
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_event','interval','repeat_interval');
+               }
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.558';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.558 to 0.9.17.559
+       * change the priority for the helpdest (from 10-1 to 1-3)
+       * 
+       */
+
+       $test[] = '0.9.17.558';
+       function property_upgrade0_9_17_558()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_tts_tickets 
SET priority = 11 WHERE priority IN (8,9,10)");
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_tts_tickets 
SET priority = 12 WHERE priority IN (4,5,6,7)");
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_tts_tickets 
SET priority = 13 WHERE priority IN (1,2,3)");
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_tts_tickets 
SET priority = 1 WHERE priority = 11");
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_tts_tickets 
SET priority = 2 WHERE priority = 12");
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_tts_tickets 
SET priority = 3 WHERE priority = 13");
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.559';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.559 to 0.9.17.560
+       * Add location to the budget.basis
+       * 
+       */
+
+       $test[] = '0.9.17.559';
+       function property_upgrade0_9_17_559()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw']->locations->add('.budget.basis', 'Basis for 
high level lazy budgeting', 'property');
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.560';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.560 to 0.9.17.561
+       * Add ability to upload jasper reports
+       * 
+       */
+
+       $test[] = '0.9.17.560';
+       function property_upgrade0_9_17_560()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_entity_category','jasperupload',array('type'
 => 'int','precision' => 2,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.561';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.561 to 0.9.17.562
+       * Add variants of closed-status for tickets
+       * 
+       */
+
+       $test[] = '0.9.17.561';
+       function property_upgrade0_9_17_561()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_status','closed',array('type' 
=> 'int','precision' => 2,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.562';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.562 to 0.9.17.563
+       * Separate project status from workorder status
+       * 
+       */
+
+       $test[] = '0.9.17.562';
+       function property_upgrade0_9_17_562()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_project_status', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                                       'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_workorder_status");
+               $status = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $status[] = array
+                       (
+                               'id'    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                               'descr' => 
$GLOBALS['phpgw_setup']->oProc->f('descr')
+                       );
+               }
+
+               foreach($status as $entry)
+               {
+                       $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
fm_project_status (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.563';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.563 to 0.9.17.564
+       * Add area information as standard fields to each level in the location 
hierarchy
+       * 
+       */
+
+       $test[] = '0.9.17.563';
+       function property_upgrade0_9_17_563()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $db =& $GLOBALS['phpgw_setup']->oProc->m_odb;
+
+               $db->query('DELETE FROM fm_cache');
+
+               $cust = array
+               (
+                       'datatype'              => 'N',
+                       'precision_'    => 20,
+                       'scale'                 => 2,
+                       'default_value' => '0.00',
+                       'nullable'              => 'True',
+                       'custom'                => 1
+               );
+
+               $area_fields = array();
+
+               $area_fields[] = array
+               (
+                       'name' => 'area_gross',
+                       'descr'=> 'gross area',
+                       'statustext' => 'Sum of the areas included within the 
outside face of the exterior walls of a building.',
+                       'cust'  => $cust
+               );
+               $area_fields[] = array
+               (
+                       'name' => 'area_net',
+                       'descr'=> 'net area',
+                       'statustext' => 'The wall-to-wall floor area of a 
room.',
+                       'cust'  => $cust
+               );
+               $area_fields[] = array
+               (
+                       'name' => 'area_usable',
+                       'descr'=> 'usable area',
+                       'statustext'=> 'generally measured from "paint to 
paint" inside the permanent walls and to the middle of partitions separating 
rooms',
+                       'cust'  => $cust
+               );
+
+               $db->query("SELECT count(*) as levels FROM fm_location_type");
+
+               $db->next_record();
+               $levels = $db->f('levels');
+
+               for($i = 1; $i < $levels +1; $i++)
+               {
+                       $metadata = 
$GLOBALS['phpgw_setup']->db->metadata("fm_location{$i}");
+                       foreach($area_fields as & $field )
+                       {
+                               if(!isset($metadata[$field['name']]))
+                               {
+                                       
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_location{$i}", $field['name'], 
array('type' => 'decimal','precision' => '20','scale' => '2','nullable' => 
True,'default' => '0.00'));
+                                       
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_location{$i}_history", 
$field['name'], array('type' => 'decimal','precision' => '20','scale' => 
'2','nullable' => True,'default' => '0.00'));
+                               }
+
+                               $field['cust']['location_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$i}");
+                               $db->query("SELECT max(id) as id FROM 
phpgw_cust_attribute WHERE location_id = {$field['cust']['location_id']}");
+                               $db->next_record();
+                               $id = (int)$db->f('id');
+                               $db->query("SELECT max(attrib_sort) as 
attrib_sort FROM phpgw_cust_attribute WHERE id = {$id} AND location_id = 
{$field['cust']['location_id']}");
+                               $db->next_record();
+
+                               $field['cust']['id']                    = $id + 
1;
+                               $field['cust']['attrib_sort']   = 
$db->f('attrib_sort') +1;
+                               $field['cust']['column_name']   = 
$field['name'];
+                               $field['cust']['input_text']    = 
$field['descr'];
+                               $field['cust']['statustext']    = 
$field['statustext'];
+
+                               $sql = 'INSERT INTO phpgw_cust_attribute(' . 
implode(',',array_keys($field['cust'])) . ') '
+                                        . ' VALUES (' . 
$db->validate_insert($field['cust']) . ')';
+                               $db->query($sql, __LINE__, __FILE__);
+                       }
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.564';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.564 to 0.9.17.565
+       * alter datatype for spvend_code
+       * 
+       */
+
+       $test[] = '0.9.17.564';
+       function property_upgrade0_9_17_564()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $db =& $GLOBALS['phpgw_setup']->oProc->m_odb;
+
+               $metadata = 
$GLOBALS['phpgw_setup']->db->metadata('fm_ecobilag');
+
+               if($metadata['spvend_code']->type == 'varchar')
+               {
+                       echo 'oppdaterer..</br>';
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilag','spvend_code_tmp',array('type'
 => 'int','precision' => 4,'nullable' => True));
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilagoverf','spvend_code_tmp',array('type'
 => 'int','precision' => 4,'nullable' => True));
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecoavvik','spvend_code_tmp',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+                       $db->query('UPDATE fm_ecobilag SET spvend_code_tmp = 
CAST ( spvend_code AS integer )',__LINE__,__FILE__);
+                       $db->query('UPDATE fm_ecobilagoverf SET spvend_code_tmp 
= CAST ( spvend_code AS integer )',__LINE__,__FILE__);
+                       $db->query('UPDATE fm_ecoavvik SET spvend_code_tmp = 
CAST ( spvend_code AS integer )',__LINE__,__FILE__);
+
+                       
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_ecobilag',array(),'spvend_code');
+                       
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_ecobilagoverf',array(),'spvend_code');
+                       
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_ecoavvik',array(),'spvend_code');
+
+                       
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_ecobilag','spvend_code_tmp','spvend_code');
+                       
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_ecobilagoverf','spvend_code_tmp','spvend_code');
+                       
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_ecoavvik','spvend_code_tmp','spvend_code');
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.565';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+       /**
+       * Update property version from 0.9.17.565 to 0.9.17.566
+       * Add field to reference origin of invoices if imported from external 
system
+       * 
+       */
+
+       $test[] = '0.9.17.565';
+       function property_upgrade0_9_17_565()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilag', 
'external_ref', array('type' => 'varchar','precision' => '30','nullable' => 
True));
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilagoverf',  
'external_ref', array('type' => 'varchar','precision' => '30','nullable' => 
True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.566';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.566 to 0.9.17.567
+       * Add a general approval scheme for items across the system
+       * 
+       */
+
+       $test[] = '0.9.17.566';
+       function property_upgrade0_9_17_566()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_approval', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'int','precision' => 8,'nullable' => False),
+                                       'location_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                                       'account_id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'requested' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                                       'approved' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                                       'reminder' => array('type' => 
'int','precision' => 4,'nullable' => True,'default' => '1'),
+                                       'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                                       'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                                       'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'modified_by' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               ),
+                               'pk' => array('id', 'location_id', 
'account_id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.567';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.567 to 0.9.17.568
+       * Extend the approval scheme to include general actions
+       * 
+       */
+
+       $test[] = '0.9.17.567';
+       function property_upgrade0_9_17_567()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->DropTable('fm_approval');
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_action_pending', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                                       'item_id' => array('type' => 
'int','precision' => 8,'nullable' => False),
+                                       'location_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                                       'responsible' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'responsible_type' => array('type' => 
'varchar','precision' => 20,'nullable' => False),
+                                       'action_category'       => array('type' 
=> 'int','precision' => 4,'nullable' => False),
+                                       'action_requested' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                                       'action_deadline' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                                       'action_performed' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                                       'reminder' => array('type' => 
'int','precision' => 4,'nullable' => True,'default' => '1'),
+                                       'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),//timestamp
+                                       'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                                       'expired_on' => array('type' => 
'int','precision' => 4,'nullable' => True),//timestamp
+                                       'expired_by' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'remark' => array('type' => 
'text','nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_action_pending_category', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                                       'num' => array('type' => 'varchar', 
'precision' => 25,'nullable' => True),
+                                       'name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => True),
+                                       'descr' => array('type' => 
'text','nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array('num')
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_action_pending_category (num, name, descr) VALUES ('approval', 'Approval', 
'Please approve the item requested')");
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_action_pending_category (num, name, descr) VALUES ('remind', 'Remind', 'This 
is a reminder of task assigned')");
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_action_pending_category (num, name, descr) VALUES ('accept_delivery', 
'Accept delivery', 'Please accept delivery on this item')");
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.568';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.568 to 0.9.17.569
+       * Add variants of closed and approved-status for projects and workorders
+       * 
+       */
+
+       $test[] = '0.9.17.568';
+       function property_upgrade0_9_17_568()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project_status','approved',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project_status','closed',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder_status','approved',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder_status','in_progress',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder_status','delivered',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder_status','closed',array('type'
 => 'int','precision' => 2,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.569';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.569 to 0.9.17.570
+       * Add custom fields to projects, workorders and tickets
+       * 
+       */
+
+       $test[] = '0.9.17.569';
+       function property_upgrade0_9_17_569()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $location_id_project = 
$GLOBALS['phpgw']->locations->get_id('property', '.project');
+               $location_id_workorder = 
$GLOBALS['phpgw']->locations->get_id('property', '.project.workorder');
+               $location_id_ticket = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
+
+               $sql = "UPDATE phpgw_locations SET allow_c_function = 1, 
allow_c_attrib = 1, c_attrib_table = 'fm_project' WHERE location_id = 
{$location_id_project}";
+               $GLOBALS['phpgw_setup']->oProc->query($sql);
+               $sql = "UPDATE phpgw_locations SET allow_c_function = 1, 
allow_c_attrib = 1, c_attrib_table = 'fm_workorder' WHERE location_id = 
{$location_id_workorder}";
+               $GLOBALS['phpgw_setup']->oProc->query($sql);
+               $sql = "UPDATE phpgw_locations SET allow_c_function = 1, 
allow_c_attrib = 1, c_attrib_table = 'fm_tts_tickets' WHERE location_id = 
{$location_id_ticket}";
+               $GLOBALS['phpgw_setup']->oProc->query($sql);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.570';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.570 to 0.9.17.571
+       * Add custom fields to projects, workorders and tickets
+       * 
+       */
+
+       $test[] = '0.9.17.570';
+       function property_upgrade0_9_17_570()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project','contact_id',array('type'
 => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','contact_id',array('type'
 => 'int','precision' => 4,'nullable' => True));
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.571';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.571 to 0.9.17.572
+       * Add event workorders
+       * 
+       */
+
+       $test[] = '0.9.17.571';
+       function property_upgrade0_9_17_571()
+       {
+               $metadata = 
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata('fm_workorder');
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               if(!isset($metadata['event_id']))
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','event_id',array('type'
 => 'int','precision' => 4,'nullable' => True));
+               }
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_event','attrib_id_', array('type' 
=> 'varchar','precision' => 50,'default' => '0','nullable' => true));
+               $GLOBALS['phpgw_setup']->oProc->query('UPDATE fm_event SET 
attrib_id_ = attrib_id');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_event',array(),'attrib_id');
+               
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_event','attrib_id_','attrib_id');
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.572';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.572 to 0.9.17.573
+       * Add ticket order - an ad hock order without using the project module
+       * 
+       */
+
+       $test[] = '0.9.17.572';
+       function property_upgrade0_9_17_572()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw']->locations->add('.ticket.order', 'Helpdesk ad 
hock order', 'property');
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','order_id',array('type'
 => 'int','precision' => 8,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','vendor_id',array('type'
 => 'int','precision' => '4','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','order_descr',array('type'
 => 'text','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','b_account_id',array('type'
 => 'varchar','precision' => '20','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','ecodimb',array('type'
 => 'int','precision' => 4,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','budget',array('type'
 => 'int','precision' => '4','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','actual_cost',array('type'
 => 'decimal','precision' => '20','scale' => '2','nullable' => True,'default' 
=> '0.00'));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.573';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.573 to 0.9.17.574
+       * Alter field definition
+       * 
+       */
+
+       $test[] = '0.9.17.573';
+       function property_upgrade0_9_17_573()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_tts_history','history_status',array('type'
 => 'varchar','precision' => '3','nullable' => False));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','title',array('type' 
=> 'varchar','precision' => '100','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_document','title',array('type' 
=> 'varchar','precision' => '100','nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.574';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+
+       /**
+       * Update property version from 0.9.17.574 to 0.9.17.575
+       * Add variants of closed and approved-status for tickets
+       * 
+       */
+
+       $test[] = '0.9.17.574';
+       function property_upgrade0_9_17_574()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_tts_tickets','status',array('type'
 => 'varchar','precision' => '3','nullable' => False));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_status','approved',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_status','in_progress',array('type'
 => 'int','precision' => 2,'nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_status','delivered',array('type'
 => 'int','precision' => 2,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.575';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.575 to 0.9.17.576
+       * Add variants of closed and approved-status for tickets
+       * 
+       */
+
+       $test[] = '0.9.17.575';
+       function property_upgrade0_9_17_575()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tenant','contact_email',array('type'
 => 'varchar','precision' => '64','nullable' => True));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','contact_email',array('type'
 => 'varchar','precision' => '64','nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.576';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: people/sigurdne/modules/property/trunk/templates/base/actor.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/actor.xsl     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/actor.xsl     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -152,9 +152,13 @@
                        self.name="first_Window";
                        <xsl:value-of select="lookup_functions"/>
                </script>
+               <div class="yui-navset" id="actor_edit_tabview">
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
-               <div align="left">
                <form name="form" method="post" action="{$edit_url}">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <div class="yui-content">               
+                               <div id="general">
+
                <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -197,11 +201,6 @@
                                        <xsl:call-template name="cat_select"/>
                                </td>
                        </tr>
-                       <tr>
-                               <td colspan="2" width="50%" align="left">       
                        
-                                       <xsl:call-template 
name="attributes_form"/>
-                               </td>
-                       </tr>
                        <xsl:choose>
                                <xsl:when test="member_of_list != ''">
                                <tr>
@@ -217,6 +216,12 @@
                                </tr>
                                </xsl:when>
                        </xsl:choose>
+               </table>
+               </div>
+               
+               <xsl:call-template name="attributes_values"/>
+
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr height="50">
                                <td valign="bottom">
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
@@ -250,6 +255,7 @@
                                </td>
                        </tr>
                </table>
+               </div>
                </form>
                </div>
        </xsl:template>

Modified: people/sigurdne/modules/property/trunk/templates/base/admin.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/admin.xsl     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/admin.xsl     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -57,7 +57,7 @@
                                <td valign="top" align="left">
                                        <xsl:value-of 
select="lang_enable_inheritance"/>
                                        <xsl:text>: </xsl:text>
-                                       <input type="checkbox" 
name="enable_inheritance" value="true" 
title="{lang_enable_inheritance_statustext}" style="cursor:help"></input>
+                                       <input type="checkbox" 
name="enable_inheritance" value="true" 
title="{lang_enable_inheritance_statustext}"></input>
                                </td>
                        </tr>
                        <tr class="th">
@@ -880,7 +880,7 @@
                                        <xsl:value-of select="lang_email"/>
                                </td>
                                <td>
-                                       <input type="hidden" name="filter" 
value="{value_user_id}"></input>
+                                       <input type="hidden" name="user_id" 
value="{value_user_id}"></input>
                                        <input type="hidden" 
name="values[old_email]" value="{value_old_email}"></input>
                                        <input type="text" size = "30" 
name="values[email]" value="{value_email}" onMouseout="window.status='';return 
true;">
                                                <xsl:attribute 
name="onMouseover">
@@ -938,7 +938,7 @@
                                </td>
                                <td align="left">
                                        <input type="hidden" 
name="values[old_default_tts_category]" 
value="{value_old_default_tts_category}"></input>
-                                       <select 
name="values[default_tts_category]" class="forms" 
title="{lang_default_tts_category_statustext}" style="cursor:help">
+                                       <select 
name="values[default_tts_category]" class="forms" 
title="{lang_default_tts_category_statustext}">
                                                <option value=""><xsl:value-of 
select="lang_no_cat"/></option>
                                                <xsl:apply-templates 
select="tts_category"/>
                                        </select>

Modified: people/sigurdne/modules/property/trunk/templates/base/admin_entity.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/admin_entity.xsl      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/admin_entity.xsl      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -8,6 +8,12 @@
                        <xsl:when test="list_attribute">
                                <xsl:apply-templates select="list_attribute"/>
                        </xsl:when>
+                       <xsl:when test="list_attribute_group">
+                               <xsl:apply-templates 
select="list_attribute_group"/>
+                       </xsl:when>
+                       <xsl:when test="edit_attrib_group">
+                               <xsl:apply-templates 
select="edit_attrib_group"/>
+                       </xsl:when>
                        <xsl:when test="edit_attrib">
                                <xsl:apply-templates select="edit_attrib"/>
                        </xsl:when>
@@ -167,6 +173,9 @@
                                <xsl:value-of select="lang_prefix"/>
                        </td>
                        <td class="th_text" width="5%" align="center">
+                               <xsl:value-of select="lang_attribute_group"/>
+                       </td>
+                       <td class="th_text" width="5%" align="center">
                                <xsl:value-of select="lang_attribute"/>
                        </td>
                        <td class="th_text" width="5%" align="center">
@@ -214,6 +223,10 @@
                                        <xsl:value-of select="prefix"/>
                                </td>
                                <td align="center">
+                                       <xsl:variable 
name="link_attribute_group"><xsl:value-of 
select="link_attribute_group"/></xsl:variable>
+                                       <a href="{$link_attribute_group}" 
onMouseover="window.status='';return true;" onMouseout="window.status='';return 
true;"><xsl:value-of select="text_attribute_group"/></a>
+                               </td>
+                               <td align="center">
                                        <xsl:variable 
name="link_attribute"><xsl:value-of select="link_attribute"/></xsl:variable>
                                        <a href="{$link_attribute}" 
onMouseover="window.status='{$lang_attribute_standardtext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_attribute"/></a>
                                </td>
@@ -332,7 +345,7 @@
        </xsl:template>
 
 <!-- add / edit  -->
-       <xsl:template match="edit">
+       <xsl:template match="edit" xmlns:php="http://php.net/xsl";>
                <div align="left">
                
                <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
@@ -580,20 +593,16 @@
                                                <td>
                                                        <xsl:choose>
                                                                        
<xsl:when test="value_fileupload = 1">
-                                                                               
<input type="checkbox" name="values[fileupload]" value="1" checked="checked" 
onMouseout="window.status='';return true;">
-                                                                               
        <xsl:attribute name="onMouseover">
-                                                                               
                <xsl:text>window.status='</xsl:text>
-                                                                               
                        <xsl:value-of select="lang_fileupload_statustext"/>
-                                                                               
                <xsl:text>'; return true;</xsl:text>
+                                                                               
<input type="checkbox" name="values[fileupload]" value="1" checked="checked">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="php:function('lang', 'If files can be 
uploaded for this category')"/>
                                                                                
        </xsl:attribute>
                                                                                
</input>
                                                                        
</xsl:when>
                                                                        
<xsl:otherwise>
-                                                                               
<input type="checkbox" name="values[fileupload]" value="1" 
onMouseout="window.status='';return true;">
-                                                                               
        <xsl:attribute name="onMouseover">
-                                                                               
                <xsl:text>window.status='</xsl:text>
-                                                                               
                        <xsl:value-of select="lang_fileupload_statustext"/>
-                                                                               
                <xsl:text>'; return true;</xsl:text>
+                                                                               
<input type="checkbox" name="values[fileupload]" value="1">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="php:function('lang', 'If files can be 
uploaded for this category')"/>
                                                                                
        </xsl:attribute>
                                                                                
</input>
                                                                        
</xsl:otherwise>
@@ -603,6 +612,33 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:choose>
+                               <xsl:when test="jasperupload != ''">
+                                       <tr>
+                                               <td>
+                                                       <xsl:value-of 
select="php:function('lang', 'jasper upload')"/>
+                                               </td>
+                                               <td>
+                                                       <xsl:choose>
+                                                                       
<xsl:when test="value_jasperupload = 1">
+                                                                               
<input type="checkbox" name="values[jasperupload]" value="1" checked="checked">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="php:function('lang', 'allow to upload 
definition of jasper reports')"/>
+                                                                               
        </xsl:attribute>
+                                                                               
</input>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<input type="checkbox" name="values[jasperupload]" value="1">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="php:function('lang', 'allow to upload 
definition of jasper reports')"/>
+                                                                               
        </xsl:attribute>
+                                                                               
</input>
+                                                                       
</xsl:otherwise>
+                                                       </xsl:choose>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+                       <xsl:choose>
                                <xsl:when test="lang_loc_link != ''">
                                        <tr>
                                                <td>
@@ -794,6 +830,9 @@
                        <td class="th_text" width="1%" align="left">
                                <xsl:value-of select="lang_datatype"/>
                        </td>
+                       <td class="th_text" width="1%" align="left">
+                               <xsl:value-of select="lang_attrib_group"/>
+                       </td>
                        <td class="th_text" width="5%" align="center">
                                <a href="{$sort_sorting}"><xsl:value-of 
select="lang_sorting"/></a>
                        </td>
@@ -838,6 +877,9 @@
                                        <xsl:value-of select="datatype"/>
                                </td>
                                <td>
+                                       <xsl:value-of select="attrib_group"/>
+                               </td>
+                               <td>
                                        <table align="left">
                                                <tr>
                                                        <td>
@@ -870,6 +912,242 @@
        </xsl:template>
 
 
+<!-- list attribute_group -->
+
+       <xsl:template match="list_attribute_group">
+               
+               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
+                       <tr>
+                               <td align="right">
+                                       <xsl:call-template name="search_field"/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td class="th_text" align="left">
+                                       <xsl:value-of select="lang_entity"/>
+                                       <xsl:text>: </xsl:text>
+                                       <xsl:value-of select="entity_name"/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td class="th_text" align="left">
+                                       <xsl:value-of select="lang_category"/>
+                                       <xsl:text>: </xsl:text>
+                                       <xsl:value-of select="category_name"/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan="3" width="100%">
+                                       <xsl:call-template name="nextmatchs"/>
+                               </td>
+                       </tr>
+               </table>
+               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
+                               <xsl:apply-templates 
select="table_header_attrib_group"/>
+                               <xsl:apply-templates 
select="values_attrib_group"/>
+                               <xsl:apply-templates select="table_add"/>
+               </table>
+       </xsl:template>
+
+       <xsl:template match="table_header_attrib_group">
+               <xsl:variable name="sort_sorting"><xsl:value-of 
select="sort_sorting"/></xsl:variable>
+               <xsl:variable name="sort_name"><xsl:value-of 
select="sort_name"/></xsl:variable>
+               <tr class="th">
+                       <td class="th_text" width="10%" align="left">
+                               <a href="{$sort_name}"><xsl:value-of 
select="lang_name"/></a>
+                       </td>
+                       <td class="th_text" width="20%" align="left">
+                               <xsl:value-of select="lang_descr"/>
+                       </td>
+                       <td class="th_text" width="5%" align="center">
+                               <a href="{$sort_sorting}"><xsl:value-of 
select="lang_sorting"/></a>
+                       </td>
+                       <td class="th_text" width="5%" align="center">
+                               <xsl:value-of select="lang_edit"/>
+                       </td>
+                       <td class="th_text" width="5%" align="center">
+                               <xsl:value-of select="lang_delete"/>
+                       </td>
+               </tr>
+       </xsl:template>
+
+       <xsl:template match="values_attrib_group"> 
+               <xsl:variable name="lang_up_text"><xsl:value-of 
select="lang_up_text"/></xsl:variable>
+               <xsl:variable name="lang_down_text"><xsl:value-of 
select="lang_down_text"/></xsl:variable>
+               <xsl:variable name="lang_edit_text"><xsl:value-of 
select="lang_edit_text"/></xsl:variable>
+               <xsl:variable name="lang_delete_text"><xsl:value-of 
select="lang_delete_text"/></xsl:variable>
+                       <tr>
+                               <xsl:attribute name="class">
+                                       <xsl:choose>
+                                               <xsl:when test="@class">
+                                                       <xsl:value-of 
select="@class"/>
+                                               </xsl:when>
+                                               <xsl:when test="position() mod 
2 = 0">
+                                                       
<xsl:text>row_off</xsl:text>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       
<xsl:text>row_on</xsl:text>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               <td align="left">
+                                       <xsl:value-of select="name"/>
+                               </td>
+                               <td>
+                                       <xsl:value-of select="descr"/>
+                               </td>
+                               <td>
+                                       <table align="left">
+                                               <tr>
+                                                       <td>
+                                                               <xsl:value-of 
select="sorting"/>
+                                                       </td>
+
+                                                       <td align="left">
+                                                               <xsl:variable 
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
+                                                               <a 
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
+                                                               <xsl:text> | 
</xsl:text>
+                                                               <xsl:variable 
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
+                                                               <a 
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return 
true;" onMouseout="window.status='';return true;"><xsl:value-of 
select="text_down"/></a>
+                                                       </td>
+
+                                               </tr>
+                                       </table>
+                               </td>
+                               <td align="center">
+                                       <xsl:variable 
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+                                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_edit"/></a>
+                               </td>
+                               <td align="center">
+                                       <xsl:variable 
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+                                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_delete"/></a>
+                               </td>
+                       </tr>
+       </xsl:template>
+
+
+<!-- add attribute group / edit attribute group -->
+
+       <xsl:template match="edit_attrib_group">
+               <div align="left">
+               
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                       <xsl:choose>
+                               <xsl:when test="msgbox_data != ''">
+                                       <tr>
+                                               <td align="left" colspan="3">
+                                                       <xsl:call-template 
name="msgbox"/>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+                       
+                       <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
+                       <form method="post" action="{$form_action}">
+
+                       <tr>
+                               <td class="th_text" align="left">
+                                       <xsl:value-of select="lang_entity"/>
+                               </td>
+                               <td class="th_text" align="left">
+                                       <xsl:value-of select="entity_name"/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td class="th_text" align="left">
+                                       <xsl:value-of select="lang_category"/>
+                               </td>
+                               <td class="th_text" align="left">
+                                       <xsl:value-of select="category_name"/>
+                               </td>
+                       </tr>
+                       <xsl:choose>
+                               <xsl:when test="value_id != ''">
+                                       <tr>
+                                               <td valign="top">
+                                                       <xsl:value-of 
select="lang_id"/>
+                                               </td>
+                                               <td>
+                                                       <xsl:value-of 
select="value_id"/>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_group_name"/>
+                               </td>
+                               <td>
+                                       <input type="text" 
name="values[group_name]" value="{value_group_name}" maxlength="20" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_group_name_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_descr"/>
+                               </td>
+                               <td>
+                                       <input type="text" name="values[descr]" 
value="{value_descr}" size ="60" maxlength="50" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_descr_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_remark"/>
+                               </td>
+                               <td>
+                                       <textarea cols="60" rows="10" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_remark_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:value-of 
select="value_remark"/>           
+                                       </textarea>
+                               </td>
+                       </tr>
+                       <tr height="50">
+                               <td>
+                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_save_attribtext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+
+                       </form>
+                       <tr>
+                               <td>
+                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+                                       <form method="post" 
action="{$done_action}">
+                                               <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+                                                       <xsl:attribute 
name="onMouseover">
+                                                               
<xsl:text>window.status='</xsl:text>
+                                                                       
<xsl:value-of select="lang_done_attribtext"/>
+                                                               <xsl:text>'; 
return true;</xsl:text>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </form>
+                               </td>
+                       </tr>
+               </table>
+               </div>
+       </xsl:template>
 <!-- add attribute / edit attribute -->
 
        <xsl:template match="edit_attrib">
@@ -922,7 +1200,7 @@
                                        <xsl:value-of 
select="lang_column_name"/>
                                </td>
                                <td>
-                                       <input type="text" 
name="values[column_name]" value="{value_column_name}" maxlength="20" 
onMouseout="window.status='';return true;">
+                                       <input type="text" 
name="values[column_name]" value="{value_column_name}" maxlength="50" 
onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>
                                                                <xsl:value-of 
select="lang_column_name_statustext"/>
@@ -962,6 +1240,18 @@
                        </tr>
                        <tr>
                                <td valign="top">
+                                       <xsl:value-of select="lang_group"/>
+                               </td>
+                               <td valign="top">
+                                       <xsl:variable 
name="lang_group_statustext"><xsl:value-of 
select="lang_group_statustext"/></xsl:variable>
+                                       <select name="values[group_id]" 
class="forms" onMouseover="window.status='{$lang_group_statustext}'; return 
true;" onMouseout="window.status='';return true;">
+                                               <option value=""><xsl:value-of 
select="lang_no_group"/></option>
+                                               <xsl:apply-templates 
select="attrib_group_list"/>
+                                       </select>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
                                        <xsl:value-of select="lang_datatype"/>
                                </td>
                                <td valign="top">
@@ -1472,6 +1762,20 @@
                </xsl:choose>
        </xsl:template>
 
+<!-- attrib_group_list -->     
+
+       <xsl:template match="attrib_group_list">
+       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+               <xsl:choose>
+                       <xsl:when test="selected">
+                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
 <!-- datatype_list --> 
 
        <xsl:template match="datatype_list">

Modified: 
people/sigurdne/modules/property/trunk/templates/base/admin_location.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/admin_location.xsl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/admin_location.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -70,6 +70,9 @@
                        <td class="th_text" width="5%" align="center">
                                <xsl:value-of select="lang_categories"/>
                        </td>
+'                      <td class="th_text" width="5%" align="center">
+                               <xsl:value-of select="lang_attribute_group"/>
+                       </td>
                        <td class="th_text" width="5%" align="center">
                                <xsl:value-of select="lang_attribute"/>
                        </td>
@@ -115,6 +118,10 @@
                                        <a href="{$link_categories}" 
onMouseover="window.status='{lang_category_text}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_categories"/></a>
                                </td>
                                <td align="center">
+                                       <xsl:variable 
name="link_attribute_group"><xsl:value-of 
select="link_attribute_group"/></xsl:variable>
+                                       <a href="{$link_attribute_group}" 
onMouseover="window.status='';return true;" onMouseout="window.status='';return 
true;"><xsl:value-of select="text_attribute_group"/></a>
+                               </td>
+                               <td align="center">
                                        <xsl:variable 
name="link_attribute"><xsl:value-of select="link_attribute"/></xsl:variable>
                                        <a href="{$link_attribute}" 
onMouseover="window.status='{$lang_attribute_standardtext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_attribute"/></a>
                                </td>
@@ -660,6 +667,19 @@
                        </tr>
                        <tr>
                                <td valign="top">
+                                       <xsl:value-of select="lang_group"/>
+                               </td>
+                               <td valign="top">
+                                       <xsl:variable 
name="lang_group_statustext"><xsl:value-of 
select="lang_group_statustext"/></xsl:variable>
+                                       <select name="values[group_id]" 
class="forms" onMouseover="window.status='{$lang_group_statustext}'; return 
true;" onMouseout="window.status='';return true;">
+                                               <option value=""><xsl:value-of 
select="lang_no_group"/></option>
+                                               <xsl:apply-templates 
select="attrib_group_list"/>
+                                       </select>
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td valign="top">
                                        <xsl:value-of select="lang_datatype"/>
                                </td>
                                <td valign="top">
@@ -837,6 +857,20 @@
                </xsl:choose>
        </xsl:template>
 
+<!-- attrib_group_list -->     
+
+       <xsl:template match="attrib_group_list">
+       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+               <xsl:choose>
+                       <xsl:when test="selected">
+                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+
 <!-- datatype_list --> 
 
        <xsl:template match="datatype_list">

Modified: people/sigurdne/modules/property/trunk/templates/base/agreement.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/agreement.xsl 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/agreement.xsl 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -1,4 +1,5 @@
 
+
        <xsl:template name="app_data">
                <xsl:choose>
                        <xsl:when test="edit">
@@ -469,12 +470,16 @@
                        self.name="first_Window";
                        <xsl:value-of select="lookup_functions"/>
                </script>
-               <div align="left">
+               <div class="yui-navset" id="edit_tabview">
+               <xsl:value-of disable-output-escaping="yes" select="tabs" />
+                       <div class="yui-content">               
+
+                               <div id="general">
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
-               <table cellpadding="2" cellspacing="2" align="center">
+               <table cellpadding="2" cellspacing="2" align="center" 
width="79%" >
                        <tr><td>
                <form ENCTYPE="multipart/form-data" method="post" name="form" 
action="{$edit_url}">
-               <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
+               <table cellpadding="2" cellspacing="2" width="100%" 
align="center" border="0">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -603,7 +608,16 @@
                        
                        <xsl:choose>
                                <xsl:when test="files!=''">
-                                       <xsl:call-template name="file_list"/>
+                                       <!-- <xsl:call-template 
name="file_list"/> -->
+                                       <tr>
+                                               <td width="19%" align="left" 
valign="top">
+                                                       <xsl:value-of 
select="//lang_files"/>
+                                               </td>
+                                               <td>
+                                               <!-- DataTable 2 EDIT-->
+                                                       <div 
id="datatable-container_2"></div>
+                                               </td>
+                                       </tr>
                                </xsl:when>
                        </xsl:choose>
 
@@ -614,15 +628,6 @@
                        </xsl:choose>
 
                        <xsl:choose>
-                               <xsl:when test="attributes_values != ''">
-                                       <tr>
-                                               <td colspan="2" width="50%" 
align="left">                               
-                                                       <xsl:call-template 
name="attributes_form"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:choose>
                                <xsl:when test="member_of_list != ''">
                                <tr>
                                        <td valign="top">
@@ -637,6 +642,12 @@
                                </tr>
                                </xsl:when>
                        </xsl:choose>
+                       <xsl:choose>
+                               <xsl:when test="attributes_group != ''">
+                                       <xsl:call-template 
name="attributes_values"/>
+                               </xsl:when>
+                       </xsl:choose>
+
                        <tr height="50">
                                <td valign="bottom">
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
@@ -647,8 +658,7 @@
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
-                               </td>
-                               <td valign="bottom">
+                               <!-- </td><td valign="bottom">  -->
                                        <xsl:variable 
name="lang_apply"><xsl:value-of select="lang_apply"/></xsl:variable>
                                        <input type="submit" 
name="values[apply]" value="{$lang_apply}" onMouseout="window.status='';return 
true;">
                                                <xsl:attribute 
name="onMouseover">
@@ -657,8 +667,7 @@
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
-                               </td>
-                               <td align="right" valign="bottom">
+                               <!-- </td><td align="right" valign="bottom">-->
                                        <xsl:variable 
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
                                        <input type="submit" 
name="values[cancel]" value="{$lang_cancel}" 
onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
@@ -672,33 +681,40 @@
                </table>
                </form>
                </td></tr>
-               <tr><td>
+               <tr><td><br/><br/></td></tr>
+               <tr><td align="right" valign="bottom">
                <form method="post" name="alarm" action="{$edit_url}">
                        <input type="hidden" name="values[entity_id]" 
value="{value_agreement_id}" ></input>
-                       <table>
-                               <tr>
-                                       <td class="th_text" align="left" 
colspan="5">
-                                               <xsl:value-of 
select="lang_alarm"/>
-                                       </td>
-                               </tr>
-                               <xsl:call-template name="alarm_form"/>
+                       <table cellpadding="2" cellspacing="2" width="79%" 
align="center" border="0">
+                               <tr><td class="center" 
align="left"><xsl:value-of select="lang_alarm"/></td></tr>
+                                               
+                                               <!-- DataTable 0  EDIT-->
+                                                       <tr><td class="center" 
align="left" colspan="10"><div id="datatable-container_0"></div></td></tr>
+                                                       <tr><td class="center" 
align="right" colspan="10"><div id="datatable-buttons_0"></div></td></tr>
+                                                       <tr><td class="center" 
align="left" colspan="10"><xsl:value-of 
select="alarm_data/add_alarm/lang_add_alarm"/><xsl:text> : 
</xsl:text><xsl:value-of 
select="alarm_data/add_alarm/lang_day_statustext"/><xsl:value-of 
select="alarm_data/add_alarm/lang_hour_statustext"/><xsl:value-of 
select="alarm_data/add_alarm/lang_minute_statustext"/><xsl:value-of 
select="alarm_data/add_alarm/lang_user"/></td></tr>
+                                                       <tr><td class="center" 
align="left" colspan="10"><div id="datatable-buttons_1"></div></td></tr>
+                                               <!-- <xsl:call-template 
name="alarm_form"/>  -->
                        </table>
                </form>
                </td>
                </tr>
                </table>
+               </div>
+               
+<div id="items">
 
                <xsl:choose>
                        <xsl:when test="table_update!=''">
                        <xsl:variable name="update_action"><xsl:value-of 
select="update_action"/></xsl:variable>
+                                       
                                <form method="post" name="form2" 
action="{$update_action}">
                                        <input type="hidden" 
name="values[agreement_id]" value="{value_agreement_id}" ></input>
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                               <table width="100%" 
cellpadding="2" cellspacing="2" align="center" border="0">
                                                <tr>
                                                        <xsl:for-each 
select="set_column" >
                                                                <td></td>
                                                        </xsl:for-each>
-                                                       <td class="small_text" 
valign="bottom" align="center">
+                                                               <td 
colspan="15" width="100%" class="small_text" valign="bottom" align="right">
                                                                <xsl:variable 
name="link_download"><xsl:value-of select="link_download"/></xsl:variable>
                                                                <xsl:variable 
name="lang_download_help"><xsl:value-of 
select="lang_download_help"/></xsl:variable>
                                                                <xsl:variable 
name="lang_download"><xsl:value-of select="lang_download"/></xsl:variable>
@@ -708,25 +724,37 @@
                                                                <xsl:value-of 
select="lang_download"/></a>
                                                        </td>
                                                </tr>
-                                               <tr>
-                                                       <td colspan="15" 
width="100%">
-                                                               
<xsl:call-template name="nextmatchs"/>
-                                                       </td>
-                                               </tr>
+                                                       <!-- DataTable 1 
EDIT_ITEMS-->
+                                                       <tr><td colspan="15" 
width="100%">
+                                                               <div 
id="paging_1"> </div>
+                                                               <div 
id="datatable-container_1"></div>
+                                                               <div 
id="contextmenu_1"></div>
+                                                       </td></tr>      
+                                                                               
                                
+                                                       <!--
+                                                       <tr><td colspan="15" 
width="100%"><xsl:call-template name="nextmatchs"/></td></tr>
                                                <xsl:call-template 
name="table_header"/>
                                                <xsl:call-template 
name="values3"/>
-                                               <tr>
-                                                       <xsl:for-each 
select="set_column" >
-                                                               <td></td>
-                                                       </xsl:for-each>
-                                                       <td align="center">
-                                                               <xsl:variable 
name="img_check"><xsl:value-of select="img_check"/></xsl:variable>
-                                                                <a 
href="javascript:check_all_checkbox2('values[select]')"><img src="{$img_check}" 
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
-                                                       </td>
-                                               </tr>
+                                                       <tr><xsl:for-each 
select="set_column" ><td></td></xsl:for-each><td align="center"><xsl:variable 
name="img_check"><xsl:value-of select="img_check"/></xsl:variable><a 
href="javascript:check_all_checkbox2('values[select]')"><img src="{$img_check}" 
border="0" height="16" width="21" alt="{lang_select_all}"/></a></td></tr>
+                                                       -->
                                        </table>
-                                       <table width="70%" cellpadding="2" 
cellspacing="2" align="center">
-                                               <xsl:apply-templates 
select="table_update"/>
+                                               <br/>
+                                               <table width="70%" 
cellpadding="2" cellspacing="2" >
+                                                       <!-- Buttons 2 -->
+                                                               <div 
id="datatable-buttons_2" class="div-buttons">
+                                                               
+                                                               <input 
class="mybottonsUpdates calendar-opt" type="text" id="values_date" 
name="values[date]" size="10" value="{date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                                               <xsl:attribute 
name="onMouseover">
+                                                                       
<xsl:text>window.status='</xsl:text>
+                                                                               
<xsl:value-of select="lang_date_statustext"/>
+                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                               </xsl:attribute>
+                                                               </input>
+                                                               <img 
id="values_date-trigger" class="calendar-opt" src="{img_cal}" 
alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; 
cursor:hand;"  />
+                                                               <div 
style="width:25px;height:15px;position:relative;float:left;"></div>
+                                                       </div>
+                                                               
+                                                       <!-- 
<xsl:apply-templates select="table_update"/>  -->
                                        </table>
                                </form>
                        </xsl:when>
@@ -738,7 +766,59 @@
                                </table>
                        </xsl:when>
                </xsl:choose>                                           
+       
+               </div>  
                </div>
+               </div>
+               
+               <!--  DATATABLE DEFINITIONS-->
+               <style type="text/css">
+                       .calendar-opt
+                       {
+                               position:relative;
+                               float:left;
+                       }
+                       .index-opt
+                       {
+                               position:relative;
+                               float:left;
+                               margin-top:2px;
+                       }
+                       .div-buttons
+                       {
+                               position:relative;
+                               float:left;
+                               width:750px;
+                               height:100px;
+                       }
+               </style> 
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+                       var myButtons = new Array();
+       
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       permission              :       
<xsl:value-of select="permission"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myButtons">
+                               myButtons[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>                       
        </xsl:template>
 
 <!-- add item / edit item -->
@@ -748,6 +828,33 @@
                        self.name="first_Window";
                        <xsl:value-of select="lookup_functions"/>
                </script>
+               <!--  DATATABLE DEFINITIONS-->
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+                       var myButtons = new Array();
+       
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myButtons">
+                               myButtons[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>               
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
                <div align="left">
                <form name="form" method="post" action="{$edit_url}">
@@ -755,7 +862,7 @@
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
-                                               <td align="left" colspan="3">
+                                               <td align="left" colspan="2">
                                                        <xsl:call-template 
name="msgbox"/>
                                                </td>
                                        </tr>
@@ -763,7 +870,7 @@
                        </xsl:choose>
                        <xsl:choose>
                                <xsl:when test="value_agreement_id!=''">
-                                       <tr >
+                                       <tr>
                                                <td align="left">
                                                        <xsl:value-of 
select="lang_agreement"/>
                                                </td>
@@ -847,7 +954,7 @@
                                </xsl:when>
                        </xsl:choose>
                        <tr height="50">
-                               <td valign="bottom">
+                               <td valign="bottom" colspan="2" width="30%">
                                        <input type="hidden" 
name="values[index_count]" value="{index_count}" ></input>
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
                                        <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
@@ -857,8 +964,8 @@
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
-                               </td>
-                               <td valign="bottom">
+                               <!-- </td>
+                               <td valign="bottom"> -->
                                        <xsl:variable 
name="lang_apply"><xsl:value-of select="lang_apply"/></xsl:variable>
                                        <input type="submit" 
name="values[apply]" value="{$lang_apply}" onMouseout="window.status='';return 
true;">
                                                <xsl:attribute 
name="onMouseover">
@@ -867,8 +974,8 @@
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
-                               </td>
-                               <td align="right" valign="bottom">
+                               <!--</td>
+                               <td align="right" valign="bottom"> -->
                                        <xsl:variable 
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
                                        <input type="submit" 
name="values[cancel]" value="{$lang_cancel}" 
onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
@@ -886,8 +993,52 @@
                        <xsl:when test="values != ''">
                
                                <xsl:variable 
name="update_action"><xsl:value-of select="update_action"/></xsl:variable>
+                               
                                <form method="post" name="form2" 
action="{$update_action}">
+                               
                                        <input type="hidden" 
name="values[agreement_id]" value="{value_agreement_id}" ></input>
+                                  <style type="text/css">
+                                               .calendar-opt
+                                               {
+                                                       position:relative;
+                                                       float:left;
+                                               }
+                                               .index-opt
+                                               {
+                                                       position:relative;
+                                                       float:left;
+                                                       margin-top:2px;
+                                               }
+                                               .div-buttons
+                                               {
+                                                       position:relative;
+                                                       float:left;
+                                                       width:750px;
+                                                       height:100px;
+                                               }
+                                       </style>
+
+                                  <table cellpadding="2" cellspacing="2" 
width="79%" align="center" border="0">
+                                         <tr><td><br/></td></tr>
+                                     <!-- DataTable 0 EDIT_ITEM-->
+                                      <tr><td class="center" align="left" 
colspan="10"><div id="datatable-container_0"></div></td></tr>
+                                      <tr><td><br/></td></tr>
+                                      <tr><td class="center" align="left" 
colspan="10">
+                                                       <div 
id="datatable-buttons_0" class="div-buttons">
+                                                               <input 
type="text" id="values_date" class="calendar-opt" name="values[date]" size="10" 
value="{date}" readonly="readonly" onMouseout="window.status='';return true;" >
+                                                               <xsl:attribute 
name="onMouseover">
+                                                                       
<xsl:text>window.status='</xsl:text>
+                                                                               
<xsl:value-of select="lang_date_statustext"/>
+                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                               </xsl:attribute>
+                                                               </input>
+                                                               <img 
id="values_date-trigger" class="calendar-opt" src="{img_cal}" 
alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; 
cursor:hand;" />
+                                                               <div 
style="width:25px;height:15px;position:relative;float:left;"></div>
+                                                       </div>  
+                                               </td></tr>
+                                   </table>
+                                                                       
+                                       <!--
                                        <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
                                                <xsl:call-template 
name="table_header"/>
                                                <xsl:call-template 
name="values2"/>
@@ -906,6 +1057,7 @@
                                                </tr>
 
                                        </table>
+                                       -->
                                </form>
                        </xsl:when>
                </xsl:choose>
@@ -1055,11 +1207,23 @@
                                                <input type="text" 
id="termination_date" name="termination_date" size="10" 
value="{value_termination_date}" readonly="readonly" 
onMouseout="window.status='';return true;" ></input>
                                        </td>
                                </tr>
+                               
                                <xsl:choose>
                                        <xsl:when test="files!=''">
-                                               <xsl:call-template 
name="file_list_view"/>
+                                               <!-- <xsl:call-template 
name="file_list_view"/> -->
+                                               <tr>
+                                                       <td width="19%" 
align="left" valign="top">
+                                                               <xsl:value-of 
select="//lang_files"/>
+                                                       </td>
+                                                       <td>
+                                                       <!-- DataTable 2 VIEW-->
+                                                               <div 
id="datatable-container_2"></div>
+                                                       </td>
+                                               </tr>
                                        </xsl:when>
                                </xsl:choose>                           
+                               
+                                                               
                                <xsl:choose>
                                        <xsl:when test="attributes_view != ''">
                                                <tr>
@@ -1069,6 +1233,7 @@
                                                </tr>
                                        </xsl:when>
                                </xsl:choose>
+                               
                                <xsl:choose>
                                        <xsl:when test="member_of_list != ''">
                                        <tr>
@@ -1100,22 +1265,51 @@
                                                <xsl:value-of 
select="lang_alarm"/>
                                        </td>
                                </tr>
-                               <xsl:call-template name="alarm_view"/>
+                               <tr>
+                                       <td class="th_text" align="left" 
colspan="4">
+                                       
+                                               <!--  DataTable 0 VIEW -->
+                                               <div 
id="datatable-container_0"></div>
+                                               <!-- <xsl:call-template 
name="alarm_view"/>  -->
+                                       </td>
+                               </tr>
+
+
                        </table>
                        </td>
                        </tr>
                        </table>
+                       <br/><br/>
                        <xsl:choose>
                                <xsl:when test="values!=''">
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                       <table align="center">
                                                <tr>
+                                                       <td align="center">
+                                                               <xsl:value-of 
select="lang_total_records"/>
+                                                               <xsl:text> 
</xsl:text>
+                                                               <xsl:value-of 
select="num_records"/>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <!--  DataTable 
1 VIEW-->       
+                                                               <div 
id="paging_1"/>
+                                                               <div 
id="datatable-container_1"></div>
+                                                       </td>
+                                               </tr>
+                                       <!--
+                                               <tr>
                                                        <td colspan="12" 
width="100%">
                                                                
<xsl:call-template name="nextmatchs"/>
                                                        </td>
                                                </tr>
-                                               <xsl:call-template 
name="table_header"/>
-                                               <xsl:call-template 
name="values"/>
+                                               <tr>
+                                                       <td colspan="12" 
width="100%">
+                                                               
<xsl:call-template name="table_header"/><xsl:call-template name="values"/>
+                                                       </td>
+                                               </tr> -->
                                        </table>
+
                                </xsl:when>
                        </xsl:choose>                                           
                        <table width="80%" cellpadding="2" cellspacing="2" 
align="center">
@@ -1137,6 +1331,30 @@
                        </form>
                        </table>
                </div>
+               
+               <!--  DATATABLE DEFINITIONS--> 
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+       
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+
+               </script>                       
        </xsl:template>
 
 <!-- view item -->
@@ -1226,17 +1444,28 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-               </table>
+               
                <xsl:choose>
                        <xsl:when test="values != ''">
+                               <xsl:variable 
name="update_action"><xsl:value-of select="update_action"/></xsl:variable><br/>
+                               <!-- DataTable 0  VIEW_ITEMS-->
+                               <tr>
+                                               <td colspan="2" width="50%" 
align="left">                               
+                                                       <br/>
+                                                       <div 
id="datatable-container_0"></div>
+                                               </td>
+                                       </tr>
                
-                               <xsl:variable 
name="update_action"><xsl:value-of select="update_action"/></xsl:variable>
+                               <!--  
                                        <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
                                                <xsl:call-template 
name="table_header"/>
                                                <xsl:call-template 
name="values2"/>
                                        </table>
+                               -->                                     
+                                                               
                        </xsl:when>
                </xsl:choose>
+               </table>
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
                <form name="form" method="post" action="{$edit_url}">
                <table width="80%" cellpadding="2" cellspacing="2" 
align="center">
@@ -1256,6 +1485,30 @@
                </form>
                
                </div>
+               
+               <!--  DATATABLE DEFINITIONS-->
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+       
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+
+               </script>                       
        </xsl:template>
 
 

Modified: people/sigurdne/modules/property/trunk/templates/base/alarm_form.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/alarm_form.xsl        
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/alarm_form.xsl        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -199,17 +199,6 @@
                </xsl:choose>
        </xsl:template>
 
-<!-- user_list -->     
+<!-- user_list is loaded separately -->
 
-       <xsl:template match="user_list">
-       <xsl:variable name="user_id"><xsl:value-of 
select="user_id"/></xsl:variable>
-               <xsl:choose>
-                       <xsl:when test="selected">
-                               <option value="{$user_id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <option value="{$user_id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
 

Modified: 
people/sigurdne/modules/property/trunk/templates/base/attrib_history.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/attrib_history.xsl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/attrib_history.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -1,5 +1,37 @@
 <!-- attrib_history -->
        <xsl:template match="attrib_history">
+       <div><br/></div>
+       <!--  DATATABLE -->     
+       <div align="left" id="paging_0"> </div>
+       <div id="datatable-container_0"></div>
+       <div id="contextmenu_0"></div>
+       <div><br/></div>
+       <!--  DATATABLE DEFINITIONS-->
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+       
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       permission      : <xsl:value-of 
select="permission"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+                       
+               </script>                       
+               
+               <!--  
                <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -73,4 +105,5 @@
                                        <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_delete"/></a>
                                </td>
                        </tr>
+       -->
        </xsl:template>

Modified: 
people/sigurdne/modules/property/trunk/templates/base/attributes_form.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/attributes_form.xsl   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/attributes_form.xsl   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -1,28 +1,18 @@
 <!-- $Id$ -->
-
        <xsl:template name="attributes_form">
                <xsl:apply-templates select="attributes_values"/>
        </xsl:template>
 
-       <xsl:template match="attributes_values">
+
+       <xsl:template name="attributes_values">
+               <xsl:for-each select="attributes_group" >
+                       <div id="{link}">
+                               <table cellpadding="2" cellspacing="2" 
width="100%" align="center" border="0">
+                                       <xsl:for-each select="attributes" >
                <xsl:variable name="statustext"><xsl:value-of 
select="statustext"/></xsl:variable>
                        <tr>
-                               <xsl:attribute name="class">
+                                                       <td align="left" 
width="19%" valign="top" title="{$statustext}">
                                        <xsl:choose>
-                                               <xsl:when test="@class">
-                                                       <xsl:value-of 
select="@class"/>
-                                               </xsl:when>
-                                               <xsl:when test="position() mod 
2 = 0">
-                                                       
<xsl:text>row_off</xsl:text>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       
<xsl:text>row_on</xsl:text>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </xsl:attribute>
-
-                               <td class="{class}" align="left" valign="top" 
title="{$statustext}" style="cursor:help">
-                                       <xsl:choose>
                                                <xsl:when test="helpmsg=1">
                                                        <xsl:variable 
name="help_url"><xsl:value-of select="help_url"/></xsl:variable>
                                                        <a href="javascript:var 
w=window.open('{$help_url}','','width=550,height=400,scrollbars')">
@@ -66,7 +56,7 @@
                                                                        
<xsl:call-template name="choice"/>
                                                                </xsl:when>
                                                                <xsl:when 
test="datatype='LB'">
-                                                                       <select 
name="values_attribute[{counter}][value]" class="forms" 
onMouseover="window.status='{statustext}'; return true;" 
onMouseout="window.status='';return true;">
+                                                                               
                <select name="values_attribute[{counter}][value]" class="forms">
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="disabled!=''">
                                                                                
                <xsl:attribute name="disabled">
@@ -89,9 +79,12 @@
                                                                        
</select>
                                                                </xsl:when>
                                                                <xsl:when 
test="datatype='AB'">
+                                                                               
                <table>
+                                                                               
                        <tr>
+                                                                               
                                <td>
                                                                        
<xsl:variable name="contact_name"><xsl:value-of 
select="name"/><xsl:text>_name</xsl:text></xsl:variable>
                                                                        
<xsl:variable name="lookup_function"><xsl:text>lookup_</xsl:text><xsl:value-of 
select="name"/><xsl:text>();</xsl:text></xsl:variable>
-                                                                       <input 
type="text" name="{name}" value="{value}" onClick="{$lookup_function}" 
readonly="readonly" size="5" onMouseout="window.status='';return true;" >
+                                                                               
                                        <input type="hidden" name="{name}" 
value="{value}" onClick="{$lookup_function}" readonly="readonly" size="5">
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="disabled!=''">
                                                                                
                <xsl:attribute name="disabled">
@@ -99,11 +92,6 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                        </input>
                                                                        <input  
size="30" type="text" name="{$contact_name}" value="{contact_name}"  
onClick="{$lookup_function}" readonly="readonly"> 
                                                                                
<xsl:choose>
@@ -113,17 +101,33 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                        </input>
+                                                                               
                                </td>
+                                                                               
                        </tr>
+                                                                               
                        <xsl:choose>
+                                                                               
                                <xsl:when test="contact_tel!=''">
+                                                                               
                                        <tr>
+                                                                               
                                                <td>
+                                                                               
                                                        <xsl:value-of 
select="contact_tel"/>
+                                                                               
                                                </td>
+                                                                               
                                        </tr>
+                                                                               
                                </xsl:when>
+                                                                               
                        </xsl:choose>
+                                                                               
                        <xsl:choose>
+                                                                               
                                <xsl:when test="contact_email!=''">
+                                                                               
                                        <tr>
+                                                                               
                                                <td>
+                                                                               
                                                        <a 
href="mailto:{contact_email}";><xsl:value-of select="contact_email"/></a>
+                                                                               
                                                </td>
+                                                                               
                                        </tr>
+                                                                               
                                </xsl:when>
+                                                                               
                        </xsl:choose>
+                                                                               
                </table>
                                                                </xsl:when>
                                                                <xsl:when 
test="datatype='VENDOR'">
                                                                        
<xsl:variable name="vendor_name"><xsl:value-of 
select="name"/><xsl:text>_org_name</xsl:text></xsl:variable>
                                                                        
<xsl:variable name="lookup_function"><xsl:text>lookup_</xsl:text><xsl:value-of 
select="name"/><xsl:text>();</xsl:text></xsl:variable>
-                                                                       <input 
type="text" name="{name}" value="{value}" onClick="{$lookup_function}" 
readonly="readonly" size="6" onMouseout="window.status='';return true;" >
+                                                                               
                <input type="text" name="{name}" value="{value}" 
onClick="{$lookup_function}" readonly="readonly" size="6">
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="disabled!=''">
                                                                                
                <xsl:attribute name="disabled">
@@ -131,11 +135,6 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                        </input>
                                                                        <input  
size="30" type="text" name="{$vendor_name}" value="{vendor_name}"  
onClick="{$lookup_function}" readonly="readonly"> 
                                                                                
<xsl:choose>
@@ -145,17 +144,12 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                        </input>
                                                                </xsl:when>     
                                                                <xsl:when 
test="datatype='user'">
                                                                        
<xsl:variable name="user_name"><xsl:value-of 
select="name"/><xsl:text>_user_name</xsl:text></xsl:variable>
                                                                        
<xsl:variable name="lookup_function"><xsl:text>lookup_</xsl:text><xsl:value-of 
select="name"/><xsl:text>();</xsl:text></xsl:variable>
-                                                                       <input 
type="text" name="{name}" value="{value}" onClick="{$lookup_function}" 
readonly="readonly" size="6" onMouseout="window.status='';return true;" >
+                                                                               
                <input type="text" name="{name}" value="{value}" 
onClick="{$lookup_function}" readonly="readonly" size="6">
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="disabled!=''">
                                                                                
                <xsl:attribute name="disabled">
@@ -163,11 +157,6 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                        </input>
                                                                        <input  
size="30" type="text" name="{$user_name}" value="{user_name}"  
onClick="{$lookup_function}" readonly="readonly"> 
                                                                                
<xsl:choose>
@@ -177,40 +166,13 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>'; return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                        </input>
                                                                </xsl:when>
-                                       <!--                    <xsl:when 
test="datatype='D'">
-                                                                       <input 
type="text" name="values_attribute[{counter}][value]" value="{value}" 
onFocus="{//dateformat_validate}" onKeyUp="{//onKeyUp}" onBlur="{//onBlur}" 
size="12" maxlength="10"  onMouseout="window.status='';return true;" >
-                                                                               
<xsl:choose>
-                                                                               
        <xsl:when test="disabled!=''">
-                                                                               
                <xsl:attribute name="disabled">
-                                                                               
                        <xsl:text> disabled</xsl:text>
-                                                                               
                </xsl:attribute>
-                                                                               
        </xsl:when>
-                                                                               
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>';return true;</xsl:text>
-                                                                               
</xsl:attribute>
-                                                                       </input>
-                                                               </xsl:when>
-                                       -->
                                                                <xsl:when 
test="datatype='D'">
-                                                                       <input 
type="text" id="values_attribute_{counter}" 
name="values_attribute[{counter}][value]" value="{value}"  size="12" 
maxlength="12"  onMouseout="window.status='';return true;" >
+                                                                               
                <input type="text" id="values_attribute_{counter}" 
name="values_attribute[{counter}][value]" value="{value}"  size="12" 
maxlength="12" >
                                                                                
<xsl:attribute name="readonly">
                                                                                
        <xsl:text> readonly</xsl:text>
                                                                                
</xsl:attribute>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>';return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="disabled!=''">
                                                                                
                <xsl:attribute name="disabled">
@@ -221,10 +183,8 @@
                                                                        </input>
                                                                        <img 
id="values_attribute_{counter}-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
                                                                </xsl:when>
-
-
                                                                <xsl:when 
test="datatype='T'">
-                                                                       
<textarea cols="{//textareacols}" rows="{//textarearows}" 
name="values_attribute[{counter}][value]" wrap="virtual" 
onMouseout="window.status='';return true;">
+                                                                               
                <textarea cols="{//textareacols}" rows="{//textarearows}" 
name="values_attribute[{counter}][value]" wrap="virtual">
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="disabled!=''">
                                                                                
                <xsl:attribute name="disabled">
@@ -232,11 +192,6 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
        <xsl:text>';return true;</xsl:text>
-                                                                               
</xsl:attribute>
                                                                                
<xsl:value-of select="value"/>          
                                                                        
</textarea>
                                                                </xsl:when>
@@ -244,7 +199,7 @@
                                                                        <table>
                                                                                
<tr>
                                                                                
        <td>
-                                                                               
                <input type="password" 
name="values_attribute[{counter}][value]"  size="30" 
onMouseout="window.status='';return true;" >
+                                                                               
                                        <input type="password" 
name="values_attribute[{counter}][value]"  size="30">
                                                                                
                        <xsl:choose>
                                                                                
                                <xsl:when test="disabled!=''">
                                                                                
                                        <xsl:attribute name="disabled">
@@ -252,19 +207,12 @@
                                                                                
                                        </xsl:attribute>
                                                                                
                                </xsl:when>
                                                                                
                        </xsl:choose>
-                                                                               
                        <xsl:attribute name="onMouseover">
-                                                                               
                                <xsl:text>window.status='</xsl:text>
-                                                                               
                                        <xsl:value-of select="statustext"/>
-                                                                               
                                        <xsl:text> - </xsl:text>
-                                                                               
                                        <xsl:value-of select="datatype_text"/>
-                                                                               
                                <xsl:text>';return true;</xsl:text>
-                                                                               
                        </xsl:attribute>
                                                                                
                </input>
                                                                                
        </td>
                                                                                
</tr>
                                                                                
<tr>
                                                                                
        <td>
-                                                                               
                <input type="password" 
name="values_attribute[{counter}][value2]"  size="30" 
onMouseout="window.status='';return true;" >
+                                                                               
                                        <input type="password" 
name="values_attribute[{counter}][value2]"  size="30">
                                                                                
                        <xsl:choose>
                                                                                
                                <xsl:when test="disabled!=''">
                                                                                
                                        <xsl:attribute name="disabled">
@@ -272,20 +220,24 @@
                                                                                
                                        </xsl:attribute>
                                                                                
                                </xsl:when>
                                                                                
                        </xsl:choose>
-                                                                               
                        <xsl:attribute name="onMouseover">
-                                                                               
                                <xsl:text>window.status='</xsl:text>
-                                                                               
                                        <xsl:value-of select="statustext"/>
-                                                                               
                                        <xsl:text> - </xsl:text>
-                                                                               
                                        <xsl:value-of select="datatype_text"/>
-                                                                               
                                <xsl:text>';return true;</xsl:text>
-                                                                               
                        </xsl:attribute>
                                                                                
                </input>
                                                                                
        </td>
                                                                                
</tr>
                                                                        </table>
                                                                </xsl:when>
+                                                                               
        <xsl:when test="datatype='event'">
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="warning!=''">
+                                                                               
                                <xsl:value-of select="warning"/>
+                                                                               
                        </xsl:when>
                                                                <xsl:otherwise>
-                                                                       <input 
type="text" name="values_attribute[{counter}][value]" value="{value}" size="30" 
onMouseout="window.status='';return true;" >
+                                                                               
                                <xsl:variable name="event_descr"><xsl:value-of 
select="name"/><xsl:text>_descr</xsl:text></xsl:variable>
+                                                                               
                                <xsl:variable 
name="lookup_function"><xsl:text>lookup_</xsl:text><xsl:value-of 
select="name"/><xsl:text>();</xsl:text></xsl:variable>
+                                                                               
                                <table>
+                                                                               
                                        <tr>
+                                                                               
                                                <td>
+                                                                               
                                                        <input type="text" 
name="{name}" value="{value}" onClick="{$lookup_function}" readonly="readonly" 
size="6"></input>
+                                                                               
                                                        <input  size="30" 
type="text" name="{$event_descr}" value="{descr}"  onClick="{$lookup_function}" 
readonly="readonly"> 
                                                                                
<xsl:choose>
                                                                                
        <xsl:when test="disabled!=''">
                                                                                
                <xsl:attribute name="disabled">
@@ -293,26 +245,47 @@
                                                                                
                </xsl:attribute>
                                                                                
        </xsl:when>
                                                                                
</xsl:choose>
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="statustext"/>
-                                                                               
                <xsl:text> - </xsl:text>
-                                                                               
                <xsl:value-of select="datatype_text"/>
-                                                                               
        <xsl:text>';return true;</xsl:text>
+                                                                               
                                                        </input>
+                                                                               
                                                </td>
+                                                                               
                                        </tr>
+                                                                               
                                        <xsl:choose>
+                                                                               
                                                <xsl:when test="next!=''">
+                                                                               
                                                        <tr>
+                                                                               
                                                                <td>
+                                                                               
                                                                        
<xsl:value-of select="lang_next_run"/>
+                                                                               
                                                                        
<xsl:text>: </xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="next"/>
+                                                                               
                                                                </td>
+                                                                               
                                                        </tr>
+                                                                               
                                                        <tr>
+                                                                               
                                                                <td>
+                                                                               
                                                                        
<xsl:value-of select="lang_enabled"/>
+                                                                               
                                                                        
<xsl:text>: </xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="enabled"/>
+                                                                               
                                                                </td>
+                                                                               
                                                        </tr>
+                                                                               
                                                </xsl:when>
+                                                                               
                                        </xsl:choose>
+                                                                               
                                </table>
+                                                                               
                        </xsl:otherwise>
+                                                                               
                </xsl:choose>
+                                                                               
        </xsl:when>     
+                                                                               
        <xsl:otherwise>
+                                                                               
                <input type="text" name="values_attribute[{counter}][value]" 
value="{value}" size="30">
+                                                                               
                        <xsl:choose>
+                                                                               
                                <xsl:when test="disabled!=''">
+                                                                               
                                        <xsl:attribute name="disabled">
+                                                                               
                                                <xsl:text> disabled</xsl:text>
                                                                                
</xsl:attribute>
+                                                                               
                                </xsl:when>
+                                                                               
                        </xsl:choose>
                                                                        </input>
                                                                </xsl:otherwise>
                                                        </xsl:choose>
                                                        <xsl:choose>
                                                                <xsl:when 
test="history=1">
-                                                                       <input 
type="text" name="values_attribute[{counter}][date]" value="" 
onFocus="{//dateformat_validate}" onKeyUp="{//onKeyUp}" onBlur="{//onBlur}" 
size="12" maxlength="10"  onMouseout="window.status='';return true;" >
-                                                                               
<xsl:attribute name="onMouseover">
-                                                                               
        <xsl:text>window.status='</xsl:text>
-                                                                               
                <xsl:value-of select="//lang_history_date_statustext"/>
-                                                                               
        <xsl:text>';return true;</xsl:text>
-                                                                               
</xsl:attribute>
+                                                                               
                <input type="text" name="values_attribute[{counter}][date]" 
value="" onFocus="{//dateformat_validate}" onKeyUp="{//onKeyUp}" 
onBlur="{//onBlur}" size="12" maxlength="10" >
                                                                        </input>
-                                                                       
                                                                        
<xsl:variable name="link_history"><xsl:value-of 
select="link_history"/></xsl:variable>
                                                                        
<xsl:variable name="lang_history_help"><xsl:value-of 
select="//lang_history_help"/></xsl:variable>
                                                                        
<xsl:variable name="lang_history"><xsl:value-of 
select="//lang_history"/></xsl:variable>
@@ -320,13 +293,16 @@
                                                                        
onMouseOver="overlib('{$lang_history_help}', CAPTION, '{$lang_history}')"
                                                                        
onMouseOut="nd()">
                                                                        
<xsl:value-of select="//lang_history"/></a>                                     
-
                                                                </xsl:when>
                                                        </xsl:choose>
                                                </xsl:when>
                                        </xsl:choose>
                                </td>
                        </tr>
+                                       </xsl:for-each>
+                               </table>
+                       </div>
+               </xsl:for-each>
        </xsl:template>
 
        <xsl:template name="choice">

Modified: 
people/sigurdne/modules/property/trunk/templates/base/b_account_form.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/b_account_form.xsl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/b_account_form.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -13,26 +13,38 @@
                        }               
                </script>
 
+               <xsl:choose>
+                       <xsl:when test="disabled='1'">
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_b_account"/>
+                                       </td>
+                                       <td>
+                                               <input size="9" type="text" 
value="{value_b_account_id}" readonly="readonly"></input>
+                                               <input  size="30" type="text" 
value="{value_b_account_name}" readonly="readonly"></input>
+                                               <input size="9" type="hidden" 
name="b_account_id" value="{value_b_account_id}" readonly="readonly"></input>
+                                               <input  size="30" type="hidden" 
name="b_account_name" value="{value_b_account_name}" 
readonly="readonly"></input>
+                                       </td>
+                               </tr>
+                       </xsl:when>
+                       <xsl:otherwise>
                        <tr>
                                <td valign="top">
                                        <a href="javascript:b_account_lookup()" 
onMouseover="window.status='{lang_select_b_account_help}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="lang_b_account"/></a>
                                </td>
                                <td>
                                        <input size="9" type="text" 
name="b_account_id" value="{value_b_account_id}" >
-                                       <xsl:attribute name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_select_b_account_help"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                <input  size="30" type="text" 
name="b_account_name" value="{value_b_account_name}"  
onClick="b_account_lookup();" readonly="readonly"> 
-                                       <xsl:attribute name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_select_b_account_help"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
                        </tr>
-
+                       </xsl:otherwise>
+               </xsl:choose>
        </xsl:template>

Modified: people/sigurdne/modules/property/trunk/templates/base/budget.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/budget.xsl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/budget.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -426,8 +426,17 @@
                                        </xsl:otherwise>
                                </xsl:choose>
                        </tr>
+                       <xsl:call-template name="ecodimb_form"/>
+                       <tr>
+                       <tr>
+                               <td>
+                                       <xsl:value-of select="lang_category"/>
+                               </td>
+                               <td>
+                                       <xsl:call-template name="categories"/>
+                               </td>
+                       </tr>
 
-                       <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_b_group"/>
                                </td>
@@ -634,6 +643,17 @@
                                </xsl:choose>
                        </tr>
 
+                       <xsl:call-template name="ecodimb_form"/>
+                       <tr>
+                               <td>
+                                       <xsl:value-of select="lang_category"/>
+                               </td>
+                               <td>
+                                       <xsl:call-template name="categories"/>
+                               </td>
+                       </tr>
+
+
        <!--            <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_b_group"/>
@@ -882,7 +902,7 @@
                                        </xsl:choose>
                                </xsl:attribute>
                                <td>
-                                       <xsl:value-of select="grouping"/>
+                                       <a href="{link_b_account}" 
><xsl:value-of select="b_account"/></a>
                                </td>
 
                                <td>

Added: people/sigurdne/modules/property/trunk/templates/base/cat_sub_select.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/cat_sub_select.xsl    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/cat_sub_select.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,21 @@
+<!-- $Id$ -->
+
+       <xsl:template name="cat_sub_select">
+       <xsl:variable name="lang_cat_sub_statustext"><xsl:value-of 
select="lang_cat_sub_statustext"/></xsl:variable>
+       <xsl:variable name="cat_sub_name"><xsl:value-of 
select="cat_sub_name"/></xsl:variable>
+               <select name="{$cat_sub_name}" class="forms" 
title='{$lang_cat_sub_statustext}'>
+                               <xsl:apply-templates select="cat_sub_list"/>
+               </select>
+       </xsl:template>
+
+       <xsl:template match="cat_sub_list">
+       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+               <xsl:choose>
+                       <xsl:when test="selected">
+                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/cat_sub_select.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/templates/base/category.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/category.xsl  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/category.xsl  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -5,140 +5,35 @@
                        <xsl:when test="edit">
                                <xsl:apply-templates select="edit"/>
                        </xsl:when>
-                       <xsl:otherwise>
-                               <xsl:apply-templates select="list"/>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
-       
-       <xsl:template match="list">
-               
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <tr>
-                               <td align="right">
-                                       <xsl:call-template name="search_field"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td colspan="3" width="100%">
-                                       <xsl:call-template name="nextmatchs"/>
-                                       <!--    <xsl:with-param 
name="nextmatchs_params"/>
-                                       </xsl:call-template> -->
-                               </td>
-                       </tr>
-               </table>
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                               <xsl:apply-templates select="table_header"/>
-                               <xsl:apply-templates select="values"/>
-                               <xsl:apply-templates select="table_add"/>
-               </table>
-       </xsl:template>
-
-       <xsl:template match="table_header">
-               <xsl:variable name="sort_id"><xsl:value-of 
select="sort_id"/></xsl:variable>
-               <xsl:variable name="sort_name"><xsl:value-of 
select="sort_name"/></xsl:variable>
-               <tr class="th">
-                       <td class="th_text" width="10%" align="right">
-                               <a href="{$sort_id}"><xsl:value-of 
select="lang_id"/></a>
-                       </td>
-                       <td class="th_text" width="20%" align="center">
-                               <xsl:value-of select="lang_descr"/>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_edit"/>
-                       </td>
-                       <td class="th_text" width="5%" align="center">
-                               <xsl:value-of select="lang_delete"/>
-                       </td>
-               </tr>
-       </xsl:template>
-
-       <xsl:template match="values">
-               <xsl:variable name="lang_view_categorytext"><xsl:value-of 
select="lang_view_categorytext"/></xsl:variable>
-               <xsl:variable name="lang_edit_categorytext"><xsl:value-of 
select="lang_edit_categorytext"/></xsl:variable>
-               <xsl:variable name="lang_delete_categorytext"><xsl:value-of 
select="lang_delete_categorytext"/></xsl:variable>
-                       <tr>
-                               <xsl:attribute name="class">
-                                       <xsl:choose>
-                                               <xsl:when test="@class">
-                                                       <xsl:value-of 
select="@class"/>
-                                               </xsl:when>
-                                               <xsl:when test="position() mod 
2 = 0">
-                                                       
<xsl:text>row_off</xsl:text>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       
<xsl:text>row_on</xsl:text>
-                                               </xsl:otherwise>
                                        </xsl:choose>
-                               </xsl:attribute>
-
-                               <td align="right">
-                                       <xsl:value-of select="id"/>
-                               </td>
-                               <td align="left">
-                                       <xsl:value-of select="first"/>
-                               </td>
-                               <td align="center">
-                                       <xsl:variable 
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
-                                       <a href="{$link_edit}" 
onMouseover="window.status='{$lang_edit_categorytext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_edit"/></a>
-                               </td>
-                               <td align="center">
-                                       <xsl:variable 
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
-                                       <a href="{$link_delete}" 
onMouseover="window.status='{$lang_delete_categorytext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_delete"/></a>
-                               </td>
-                       </tr>
        </xsl:template>
 
-       <xsl:template match="table_add">
-                       <tr>
-                               <td height="50">
-                                       <xsl:variable 
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
-                                       <form method="post" 
action="{$add_action}">
-                                               <input type="submit" name="add" 
value="{$lang_add}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_add_categorytext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </form>
-                               </td>
-                               <td height="50">
-                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
-                                       <form method="post" 
action="{$done_action}">
-                                               <input type="submit" name="add" 
value="{$lang_done}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_add_categorytext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
-                                                       </xsl:attribute>
-                                               </input>
-                                       </form>
-                               </td>
-                       </tr>
-       </xsl:template>
-
 <!-- add / edit  -->
-       <xsl:template match="edit">
-               <div align="left">
+       <xsl:template match="edit" xmlns:php="http://php.net/xsl";>
+               <script language="JavaScript">
+                       self.name="first_Window";
+                       <xsl:value-of select="lookup_functions"/>
+               </script>
                
-               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
-                                       <tr>
-                                               <td align="left" colspan="3">
                                                        <xsl:call-template 
name="msgbox"/>
-                                               </td>
-                                       </tr>
                                </xsl:when>
                        </xsl:choose>
+
+               <div class="yui-navset" id="general_edit_tabview">
+
                        <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
                        <form method="post" action="{$form_action}">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <div class="yui-content">               
+                               <div id="general">
+               <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
+                       <xsl:choose>
+                               <xsl:when test="id_type != 'auto'">
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_id"/>
+                                                       <xsl:value-of 
select="php:function('lang', 'id')"/>
                                </td>
                                <td>
                                        <xsl:choose>
@@ -146,61 +41,104 @@
                                                        <xsl:value-of 
select="value_id"/>
                                                </xsl:when>
                                                <xsl:otherwise>
-                                                       <input type="text" 
name="values[id]" value="{value_id}" onMouseout="window.status='';return true;">
-                                                               <xsl:attribute 
name="onMouseover">
-                                                                       
<xsl:text>window.status='</xsl:text>
-                                                                               
<xsl:value-of select="lang_id_categorytext"/>
-                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                                       <input 
type="text" name="values[{id_name}]" value="{value_id}" 
onMouseout="window.status='';return true;">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Enter the ID')"/>
                                                                </xsl:attribute>
                                                        </input>
                                                </xsl:otherwise>
                                        </xsl:choose>   
                                </td>
                        </tr>
+                               </xsl:when>
+                               <xsl:otherwise>
+
+                                       <xsl:choose>
+                                               <xsl:when test="value_id != ''">
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_descr"/>
+                                                                       
<xsl:value-of select="php:function('lang', 'id')"/>
                                </td>
                                <td>
-                                       <textarea cols="60" rows="10" 
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_descr_categorytext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_descr"/>            
-                                       </textarea>
+                                                                       
<xsl:value-of select="value_id"/>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:when>
+                                       </xsl:choose>   
+                               </xsl:otherwise>
+                       </xsl:choose>
 
+               <xsl:for-each select="fields" >
+                       <xsl:variable name="name"><xsl:value-of 
select="name"/></xsl:variable>
+                       <tr>
+                               <td align="left" width="19%" valign="top" 
title="{descr}">
+                                       <xsl:value-of select="descr"/>
                                </td>
+                               <td align="left">
+                                       <xsl:choose>
+                                               <xsl:when test="type='text'">
+                                                       <textarea 
cols="{//textareacols}" rows="{//textarearows}" name="values[{name}]" 
wrap="virtual">
+                                                               <xsl:value-of 
select="value"/>          
+                                                       </textarea>
+                                               </xsl:when>
+                                               <xsl:when test="type='varchar'">
+                                                       <input type="text" 
name="values[{name}]" value="{value}" onMouseout="window.status='';return 
true;">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="descr"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </xsl:when>
+                                               <xsl:when 
test="type='checkbox'">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="value = 1">
+                                                                       <input 
type="checkbox" name="values[{name}]" value="1" checked="checked">
+                                                                               
<xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="descr"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       <input 
type="checkbox" name="values[{name}]" value="1">
+                                                                               
<xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="descr"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </td>
                        </tr>
+               </xsl:for-each>
+               </table>
+               </div>
+               <xsl:call-template name="attributes_values"/>
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr height="50">
-                               <td>
-                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
-                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_save_categorytext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                               <td valign="bottom">
+                                       <input type="submit" 
name="values[save]" value="{lang_save}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Save the record and return to the list')"/>
                                                </xsl:attribute>
                                        </input>
                                </td>
-                       </tr>
-                       </form>
-                       <tr>
-                               <td>
-                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
-                                       <form method="post" 
action="{$done_action}">
-                                               <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_done_categorytext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
+                               <td valign="bottom">
+                                       <input type="submit" 
name="values[apply]" value="{lang_apply}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Apply the values')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                               <td align="right" valign="bottom">
+                                       <input type="submit" 
name="values[cancel]" value="{lang_cancel}" onMouseout="window.status='';return 
true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'Leave the record untouched and return to the 
list')"/>
                                                        </xsl:attribute>
                                                </input>
-                                       </form>
                                </td>
                        </tr>
                </table>
                </div>
+               </form>
+               </div>
        </xsl:template>

Modified: people/sigurdne/modules/property/trunk/templates/base/columns.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/columns.xsl   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/columns.xsl   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -25,25 +25,16 @@
                        <form method="post" name="form" action="{$form_action}">
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_columns"/>
+                                       <b><xsl:value-of 
select="lang_columns"/></b>
                                </td>
-                               <td>
-                                       <xsl:variable 
name="lang_columns_statustext"><xsl:value-of 
select="lang_columns_statustext"/></xsl:variable>
-                                               <select 
name="values[columns][]" class="forms" multiple="multiple" 
onMouseover="window.status='{$lang_columns_statustext}'; return true;" 
onMouseout="window.status='';return true;">
-                                                       <option 
value=""><xsl:value-of select="lang_none"/></option>
-                                                       <xsl:apply-templates 
select="column_list"/>
-                                               </select>
-                                               
-                               </td>
                        </tr>
+                       <xsl:apply-templates select="column_list"/>
                        <tr height="50">
                                <td>
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
-                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                       <input type="submit" 
name="values[save]" value="{$lang_save}">
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_save_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
@@ -57,14 +48,18 @@
 
        <xsl:template match="column_list">
        <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+               <tr>
+                       <td>
                <xsl:choose>
                        <xsl:when test="selected">
-                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
+                                               <input id="column{$id}" 
name="values[columns][]" value="{$id}" checked="checked" 
type="checkbox"></input>
                        </xsl:when>
                        <xsl:otherwise>
-                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
+                                               <input id="column{$id}" 
name="values[columns][]" value="{$id}" type="checkbox"></input>
                        </xsl:otherwise>
                </xsl:choose>
-       </xsl:template>
 
-
+                               <xsl:value-of select="name"/>
+                       </td>
+               </tr>
+       </xsl:template>

Modified: people/sigurdne/modules/property/trunk/templates/base/config.tpl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/config.tpl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/config.tpl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -10,7 +10,7 @@
     <td colspan="2">&nbsp;</td>
    </tr>
    <tr class="row_off">
-    <td 
colspan="2">&nbsp;<b>{lang_Workorder}/{lang_FM_settings}</b></font></td>
+    <td colspan="2">&nbsp;<b>{lang_Workorder}/{lang_FM_settings}</b></td>
    </tr>
    <tr class="row_on">
     <td>{lang_organisation}:</td>
@@ -80,6 +80,28 @@
     <td><input name="newsettings[gab_url]" value="{value_gab_url}"></td>
    </tr>
    <tr class="row_off">
+    <td>{lang_suppress_old_tenant}:</td>
+    <td>
+     <select name="newsettings[suppress_tenant]">
+      <option value="" {selected_suppress_tenant_}>NO</option>
+      <option value="1" {selected_suppress_tenant_1}>YES</option>
+     </select>
+    </td>
+   </tr>
+   <tr class="row_off">
+    <td colspan="2">&nbsp;<b>{lang_TTS}::{lang_settings}</b></td>
+   </tr>
+   <tr class="row_on">
+    <td valign = 'top'>{lang_TTS_simplified_group}:</td>
+    <td>
+       <!--to be able to blank the setting - need an empty value-->
+       <input type = 'hidden' name="newsettings[fmttssimple_group][]" value="">
+     <table>
+{hook_fmttssimple_group}
+        </table>
+    </td>
+   </tr>
+   <tr class="row_off">
     <td>{lang_TTS_file_upload}:</td>
     <td>
      <select name="newsettings[fmttsfileupload]">
@@ -125,25 +147,86 @@
     </td>
    </tr>
    <tr class="row_on">
+    <td>{lang_priority_levels_(TTS)}.</td>
+    <td>
+     <select name="newsettings[prioritylevels]">
+      <option value="" {selected_prioritylevels_}>3</option>
+      <option value="4" {selected_prioritylevels_4}>4</option>
+      <option value="5" {selected_prioritylevels_5}>5</option>
+     </select>
+    </td>
+   </tr>
+   <tr class="row_off">
+    <td>{lang_mandatory_title_(TTS)}.</td>
+    <td>
+     <select name="newsettings[tts_mandatory_title]">
+      <option value="" {selected_tts_mandatory_title_}>NO</option>
+      <option value="1" {selected_tts_mandatory_title_1}>YES</option>
+     </select>
+    </td>
+   </tr>
+
+   <tr class="row_on">
+    <td valign = 'top'>{lang_TTS_finnish_date}:</td>
+    <td>
+       <!--to be able to blank the setting - need an empty value-->
+       <input type = 'hidden' name="newsettings[fmtts_group_finnish_date][]" 
value="">
+     <table>
+{hook_fmtts_group_finnish_date}
+        </table>
+    </td>
+   </tr>
+
+   <tr class="row_off">
     <td>{lang_Ask_for_workorder_approval_by_e-mail}.</td>
     <td>
      <select name="newsettings[workorder_approval]">
-       <option value="no" {selected_workorder_approval_no}>NO</option>
-     <option value="yes" {selected_workorder_approval_yes}>YES</option>
+       <option value="" {selected_workorder_approval_}>NO</option>
+     <option value="1" {selected_workorder_approval_1}>YES</option>
      </select>
     </td>
    </tr>
+
    <tr class="row_off">
+    <td>{lang_Ask_for_project_approval_by_e-mail}.</td>
+    <td>
+     <select name="newsettings[project_approval]">
+       <option value="" {selected_project_approval_}>NO</option>
+     <option value="1" {selected_project_approval_1}>YES</option>
+     </select>
+    </td>
+   </tr>
+
+   <tr class="row_on">
+    <td>{lang_project_suppress_meter}.</td>
+    <td>
+     <select name="newsettings[project_suppressmeter]">
+      <option value="" {selected_project_suppressmeter_}>NO</option>
+      <option value="1" {selected_project_suppressmeter_1}>YES</option>
+     </select>
+    </td>
+   </tr>
+   <tr class="row_off">
+    <td>{lang_project_suppress_coordination}.</td>
+    <td>
+     <select name="newsettings[project_suppresscoordination]">
+      <option value="" {selected_project_suppresscoordination_}>NO</option>
+      <option value="1" {selected_project_suppresscoordination_1}>YES</option>
+     </select>
+    </td>
+   </tr>
+
+   <tr class="row_on">
     <td>{lang_meter_table}:</td>
     <td><input name="newsettings[meter_table]" 
value="{value_meter_table}"></td>
    </tr>
-   <tr class="row_on">
+   <tr class="row_off">
     
<td>{lang_email_addresses_(comma-separated)_to_be_notified_about_tenant_claim_(empty_for_no_notify)}:</td>
     <td>
      <input name="newsettings[tenant_claim_notify_mails]" 
value="{value_tenant_claim_notify_mails}" size="40">
     </td>
    </tr>
-   <tr class="row_off">
+   <tr class="row_on">
     <td>{lang_Receive_workorder_status_by_SMS}.</td>
     <td>
      <select name="newsettings[wo_status_sms]">
@@ -152,7 +235,7 @@
      </select>
     </td>
    </tr>
-   <tr class="row_on">
+   <tr class="row_off">
     <td>{lang_Use_ACL_for_accessing_location_based_information}.</td>
     <td>
      <select name="newsettings[acl_at_location]">
@@ -161,7 +244,24 @@
      </select>
     </td>
    </tr>
-
+   <tr class="row_on">
+    <td>{lang_Use_location_at_workorder}.</td>
+    <td>
+     <select name="newsettings[location_at_workorder]">
+      <option value="" {selected_location_at_workorder_}>NO</option>
+      <option value="1" {selected_location_at_workorder_1}>YES</option>
+     </select>
+    </td>
+   </tr>
+   <tr class="row_off">
+    <td>{lang_budget_at_project_level}.</td>
+    <td>
+     <select name="newsettings[budget_at_project]">
+      <option value="" {selected_budget_at_project_}>NO</option>
+      <option value="1" {selected_budget_at_project_1}>YES</option>
+     </select>
+    </td>
+   </tr>
 <!--
 groupnotification
 -->

Added: people/sigurdne/modules/property/trunk/templates/base/contact_form.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/contact_form.xsl      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/contact_form.xsl      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,54 @@
+<!-- $Id$ -->
+
+       <xsl:template name="contact_form">
+               <xsl:apply-templates select="contact_data"/>
+       </xsl:template>
+
+       <xsl:template match="contact_data">
+               <script language="JavaScript">
+                       self.name="first_Window";
+                       function <xsl:value-of select="field"/>_contact_lookup()
+                       {
+                               Window1=window.open('<xsl:value-of 
select="contact_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+                       }               
+               </script>
+
+               <tr>
+                       <td valign="top">
+                               <a href="javascript:{field}_contact_lookup()" 
title="{lang_select_contact_help}"><xsl:value-of select="lang_contact"/></a>
+                       </td>
+                       <td>
+                               <table>
+                                       <tr>
+                                               <td>
+                                                       <input type="hidden" 
name="{field}" value="{value_contact_id}" >
+                                                       </input>
+                                                       <input  size="30" 
type="text" name="{field}_name" value="{value_contact_name}"  
onClick="{field}_contact_lookup();" readonly="readonly"> 
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="lang_select_contact_help"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                       </tr>
+                                       <xsl:choose>
+                                               <xsl:when 
test="value_contact_tel!=''">
+                                                       <tr>
+                                                               <td>
+                                                                       
<xsl:value-of select="value_contact_tel"/>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:when>
+                                       </xsl:choose>
+                                       <xsl:choose>
+                                               <xsl:when 
test="value_contact_email!=''">
+                                                       <tr>
+                                                               <td>
+                                                                       <a 
href="mailto:{value_contact_email}";><xsl:value-of 
select="value_contact_email"/></a>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </table>
+                       </td>
+               </tr>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/contact_form.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/templates/base/contact_view.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/contact_view.xsl      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/contact_view.xsl      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,40 @@
+<!-- $Id$ -->
+
+       <xsl:template name="contact_form">
+               <xsl:apply-templates select="contact_data"/>
+       </xsl:template>
+
+       <xsl:template match="contact_data">
+               <tr>
+                       <td valign="top">
+                               <xsl:value-of select="lang_contact"/>
+                       </td>
+                       <td>
+                               <table>
+                                       <tr>
+                                               <td>
+                                                       <xsl:value-of 
select="value_contact_name"/>
+                                               </td>
+                                       </tr>
+                                       <xsl:choose>
+                                               <xsl:when 
test="value_contact_tel!=''">
+                                                       <tr>
+                                                               <td>
+                                                                       
<xsl:value-of select="value_contact_tel"/>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:when>
+                                       </xsl:choose>
+                                       <xsl:choose>
+                                               <xsl:when 
test="value_contact_email!=''">
+                                                       <tr>
+                                                               <td>
+                                                                       <a 
href="mailto:{value_contact_email}";><xsl:value-of 
select="value_contact_email"/></a>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </table>
+                       </td>
+               </tr>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/contact_view.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/templates/base/css/base.css
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/css/base.css  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/css/base.css  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -73,3 +73,40 @@
        font-weight: bold;
        text-align: center;
 }
+.yui-dt .yui-dt-hidden
+{
+       border-right:0px solid #ff0 !important;
+}
+.yui-tt .bd
+{
+       background-color:#fffbeb !important;
+       border-color:#D4C237 #A6982B #A6982B;
+       border-width:0px !important;
+       color:#000000 !important;
+       left:0 !important;
+       padding:0 !important;
+       font-family: tahoma !important;
+       font-size: 11px !important;
+}
+.tooltip-table
+{
+       width:200px !important;
+}
+.tooltip
+{
+       background-color:#0066cc !important;
+       color:#FFFFFF !important;
+       font-weight: bold !important;
+       font-family: tahoma !important;
+       font-size: 11px !important;
+}
+.nolink a
+{
+       color:#FFFFFF !important;
+       text-decoration: none !important;
+}
+.nolink a visited
+{
+       color:#FFFFFF !important;
+       text-decoration: none !important;
+}
\ No newline at end of file

Added: people/sigurdne/modules/property/trunk/templates/base/css/property.css
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/css/property.css      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/css/property.css      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,47 @@
+
+.yui-button-focus {
+    /* Styles for all focused Buttons here. */
+}
+
+tfoot {
+       background:#D8D8DA 
url(../../../../phpgwapi/js/yahoo/assets/skins/sam/sprite.png) repeat-x scroll 
0 0;
+}
+
+#paging a {
+       color: #0000de;
+}
+
+/* using for hidden the first column in datatable */
+.hide_field
+{
+       overflow:hidden;
+       display:none;
+}
+
+/* use for combo box */
+span.yui-menu-button  {
+    outline: none;
+}
+/* use for combo box filter */
+span.yui-menu-button em {
+    font-style: normal;
+    display: block;
+    text-align: left;
+    white-space: nowrap;
+       width: 6em;  /*  Restrict the width of the label to 10em. */
+       overflow: hidden; /* Hide the overflow if the text label exceeds 10em 
in width. */
+       text-overflow: ellipsis; /* IE and Safari support the ability to add 
ellipsis when the text label exceeds 10em in width.*/
+}
+/* use for combo box PERIOD in INVOICE */
+span.yui-menu-button en {
+    font-style: normal;
+    display: block;
+    text-align: left;
+    white-space: nowrap;
+       width: 1.2em;  /*  Restrict the width of the label to 10em. */
+       overflow: hidden; /* Hide the overflow if the text label exceeds 10em 
in width. */
+       text-overflow: ellipsis; /* IE and Safari support the ability to add 
ellipsis when the text label exceeds 10em in width.*/
+}
+
+.rightClasss {text-align: right!important;}
+.centerClasss {text-align: center!important;}

Modified: people/sigurdne/modules/property/trunk/templates/base/date_search.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/date_search.xsl       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/date_search.xsl       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -8,8 +8,24 @@
                <script LANGUAGE="JavaScript">
                        function ExchangeDate(thisform)
                        {
-                               opener.document.search.start_date.value = 
thisform.elements[0].value;
-                               opener.document.search.end_date.value = 
thisform.elements[1].value;
+                   //opener.document.search.start_date.value = 
thisform.elements[0].value;
+                   //opener.document.search.end_date.value = 
thisform.elements[1].value;
+
+                   //cramirez: modifying this seccion for use in datatable YUI
+                   if(thisform.elements[0].value)
+                   {
+                   opener.document.forms[0].start_date.value = 
thisform.elements[0].value;
+                   opener.document.forms[0].end_date.value = 
thisform.elements[1].value;
+                   opener.document.getElementById("txt_start_date").innerHTML 
= thisform.elements[0].value;
+                   opener.document.getElementById("txt_end_date").innerHTML = 
thisform.elements[1].value;
+                   }
+                   else
+                   {
+                   opener.document.forms[0].start_date.value = '';
+                   opener.document.forms[0].end_date.value = '';
+                   opener.document.getElementById("txt_start_date").innerHTML 
= '';
+                   opener.document.getElementById("txt_end_date").innerHTML = 
'';
+                   }
                                window.close()
                        }
                </script>

Modified: people/sigurdne/modules/property/trunk/templates/base/document.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/document.xsl  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/document.xsl  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -145,7 +145,7 @@
                        <xsl:call-template name="location_view"/>
                        <tr>
                                <td>
-                                       <xsl:call-template name="cat_filter"/>
+                                       <xsl:call-template name="categories"/>
                                </td>
                                <td align="center">
                                        <xsl:call-template 
name="user_id_filter"/>
@@ -397,7 +397,7 @@
                                        <xsl:value-of select="lang_category"/>
                                </td>
                                <td>
-                                       <xsl:call-template name="cat_select"/>  
                                                
+                                       <xsl:call-template name="categories"/>
                                </td>
                        </tr>
                        <xsl:choose>
@@ -496,13 +496,37 @@
                                                        <xsl:value-of 
select="lang_history"/>
                                                </td>
                                        </tr>
-                                       <xsl:apply-templates 
select="table_header_history"/>
-                                       <xsl:apply-templates 
select="record_history"/>
+                               <!--  DATATABLE 0-->
+                                       <!--  <xsl:apply-templates 
select="table_header_history"/><xsl:apply-templates select="record_history"/> 
-->
+                                       <tr><td class="th_text"  
colspan="3"><div id="paging_0"></div><div 
id="datatable-container_0"></div></td></tr>  
+                                       
                                </xsl:otherwise>
                        </xsl:choose>
                </table>
                </div>
                <hr noshade="noshade" width="100%" align="center" size="1"/>
+               
+               <!--  DATATABLE DEFINITIONS-->
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+       
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>                       
        </xsl:template>
 
 
@@ -610,7 +634,7 @@
                                </td>
                                        <xsl:for-each select="cat_list" >
                                                <xsl:choose>
-                                                       <xsl:when 
test="selected">
+                                               <xsl:when 
test="selected='selected'">
                                                                <td>
                                                                        
<xsl:value-of select="name"/>
                                                                </td>

Added: people/sigurdne/modules/property/trunk/templates/base/ecodimb_form.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/ecodimb_form.xsl      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/ecodimb_form.xsl      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,51 @@
+<!-- $Id$ -->
+
+       <xsl:template name="ecodimb_form">
+               <xsl:apply-templates select="ecodimb_data"/>
+       </xsl:template>
+
+       <xsl:template match="ecodimb_data">
+               <script language="JavaScript">
+                       self.name="first_Window";
+                       function ecodimb_lookup()
+                       {
+                               Window1=window.open('<xsl:value-of 
select="ecodimb_url"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+                       }               
+               </script>
+
+               <xsl:choose>
+                       <xsl:when test="disabled='1'">
+                               <tr>
+                                       <td valign="top">
+                                               <xsl:value-of 
select="lang_ecodimb"/>
+                                       </td>
+                                       <td>
+                                               <input size="9" type="text" 
value="{value_ecodimb}" readonly="readonly"></input>
+                                               <input  size="30" type="text" 
value="{value_ecodimb_descr}" readonly="readonly"></input>
+                                               <input size="9" type="hidden" 
name="ecodimb" value="{value_ecodimb}" readonly="readonly"></input>
+                                               <input  size="30" type="hidden" 
name="ecodimb_descr" value="{value_ecodimb_descr}" readonly="readonly"></input>
+                                       </td>
+                               </tr>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <tr>
+                                       <td valign="top">
+                                               <a 
href="javascript:ecodimb_lookup()" title="{lang_select_ecodimb_help}" 
><xsl:value-of select="lang_ecodimb"/>
+                                               </a>
+                                       </td>
+                                       <td>
+                                               <input size="9" type="text" 
name="ecodimb" value="{value_ecodimb}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_select_ecodimb_help"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                               <input  size="30" type="text" 
name="ecodimb_descr" value="{value_ecodimb_descr}"  onClick="ecodimb_lookup();" 
readonly="readonly"> 
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_select_ecodimb_help"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                               </tr>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/ecodimb_form.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/templates/base/ecodimb_view.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/ecodimb_view.xsl      
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/ecodimb_view.xsl      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+<!-- $Id$ -->
+
+       <xsl:template name="ecodimb_view">
+               <xsl:apply-templates select="ecodimb_data"/>
+       </xsl:template>
+
+       <xsl:template match="ecodimb_data">
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_ecodimb"/>
+                               </td>
+                               <td>
+                                       <xsl:value-of select="value_ecodimb"/>
+                                       <xsl:text> [</xsl:text>
+                                       <xsl:value-of 
select="value_ecodimb_descr"/>
+                                       <xsl:text>]</xsl:text>
+                               </td>
+                       </tr>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/ecodimb_view.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/templates/base/entity.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/entity.xsl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/entity.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -208,7 +208,34 @@
                        <xsl:value-of select="lookup_functions"/>
                </script>
 
-               <div align="left">
+               <script language="JavaScript">
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       edit_action             :       
<xsl:value-of select="edit_action"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>
+                                                       
+               <div class="yui-navset" id="entity_edit_tabview">
+                       <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
+                       <form ENCTYPE="multipart/form-data" method="post" 
name="form" action="{$form_action}">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <div class="yui-content">               
+                               <div id="general">
                
                <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
@@ -221,7 +248,7 @@
                                </xsl:when>
                        </xsl:choose>
                        <xsl:choose>
-                               <xsl:when test="attributes_values !=''">
+                               <xsl:when test="value_id !=''">
                                        <tr>
                                                <td class="th_text" valign 
="top">
                                                        <a href="{link_pdf}" 
target="_blank">PDF</a>
@@ -229,13 +256,14 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-                       <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
-                       <form ENCTYPE="multipart/form-data" method="post" 
name="form" action="{$form_action}">
                        <tr>
                                <td colspan = "2" align = "center">
                                        <xsl:apply-templates 
select="table_apply"/>
                                </td>
                        </tr>
+               </table>
+
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:call-template name="target"/>
                        <xsl:for-each select="origin_list" >
                                <tr>
@@ -243,7 +271,7 @@
                                                <xsl:value-of select="name"/>
                                        </td>
                                        <td class="th_text">
-                                               <a href="{link}"  
title="{//lang_origin_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
+                                               <a href="{link}"  
title="{statustext}"><xsl:value-of select="id"/></a>
                                        </td>
                                </tr>
                        </xsl:for-each>
@@ -316,7 +344,7 @@
                                                        <tr>
                
                                                        <td class="th_text"  
align="left" >
-                                                               <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                               <a 
href="{link}"  title="{statustext}"><xsl:value-of select="id"/></a>
                                                        </td>
                                                        </tr>
                                                        </xsl:for-each>
@@ -336,7 +364,7 @@
                                                                        
<xsl:for-each select="data">
                                                                                
<tr>
                                                                                
        <td class="th_text"  align="left" >
-                                                                               
                <a href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                               
                <a href="{link}"  title="{statustext}"><xsl:value-of 
select="id"/></a>
                                                                                
                <xsl:text> </xsl:text>
                                                                                
        </td>
                                                                                
</tr>
@@ -360,9 +388,25 @@
                                </xsl:when>
                        </xsl:choose>
 
+               </table>
+               </div>
+               
+               <xsl:call-template name="attributes_values"/>
+
+               <div id="files">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                         
                        <xsl:choose>
                                <xsl:when test="files!=''">
-                                       <xsl:call-template name="file_list"/>
+                                       <!-- <xsl:call-template 
name="file_list"/> -->
+                                       <tr>
+                                               <td align="left" valign="top">
+                                                       <xsl:value-of 
select="//lang_files"/>
+                                               </td>
+                                               <td>
+                                                       <div 
id="datatable-container_0"></div>
+                                               </td>
+                                       </tr>
                                </xsl:when>
                        </xsl:choose>
 
@@ -371,17 +415,44 @@
                                        <xsl:call-template name="file_upload"/>
                                </xsl:when>
                        </xsl:choose>
+               </table>
+               </div>
+
+               <div id="jasper">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                         
+                       <xsl:choose>
+                               <xsl:when test="jasperfiles!=''">
                        <tr>
-                               <td colspan="2" width="50%" align="left">
-                                       <xsl:call-template 
name="attributes_form"/>                                                     
+                                               <td align="left" valign="top">
+                                                       <xsl:value-of 
select="//lang_files"/>
+                                               </td>
+                                               <td>
+                                                       <div 
id="datatable-container_1"></div>
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
+               
+                       <xsl:choose>
+                               <xsl:when test="cat_list='' and jasperupload = 
1">
+                                       <xsl:call-template 
name="jasper_upload"/>
+                               </xsl:when>
+                       </xsl:choose>
+               </table>
+               </div>
+
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr height="50">
                                <td colspan="2" align = "center">
                                        <xsl:apply-templates 
select="table_apply"/>
                                </td>
                        </tr>
+               </table>
+               </div>
                        </form>
+
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="start_project!=''">
                                        <tr>
@@ -420,10 +491,8 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-
                </table>
                </div>
-
        </xsl:template>
 
 
@@ -464,8 +533,6 @@
                </table>
        </xsl:template>
 
-
-
 <!-- view -->
        <xsl:template match="view">
                <div align="left">              
@@ -485,7 +552,7 @@
                                                <xsl:for-each select="data">
                                                        <tr>
                                                                <td 
class="th_text"  align="left" >
-                                                                       <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                       <a 
href="{link}"  title="{statustext}"><xsl:value-of select="id"/></a>
                                                                        
<xsl:text> </xsl:text>
                                                                </td>
                                                        </tr>
@@ -618,7 +685,7 @@
                                                                        
<xsl:for-each select="data">
                                                                                
<tr>
                                                                                
        <td class="th_text"  align="left" >
-                                                                               
                <a href="{link}"  title="{//lang_target_statustext}" style 
="cursor:help"><xsl:value-of select="type"/><xsl:text> #</xsl:text> 
<xsl:value-of select="id"/></a>
+                                                                               
                <a href="{link}"  
title="{//lang_target_statustext}"><xsl:value-of select="type"/><xsl:text> 
#</xsl:text> <xsl:value-of select="id"/></a>
                                                                                
                <xsl:text> </xsl:text>
                                                                                
        </td>
                                                                                
</tr>

Added: people/sigurdne/modules/property/trunk/templates/base/event.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/event.xsl             
                (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/event.xsl     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,335 @@
+<!-- $Id$ -->
+
+       <xsl:template name="app_data">
+               <xsl:choose>
+                       <xsl:when test="edit">
+                               <xsl:apply-templates select="edit"/>
+                       </xsl:when>
+                       <xsl:when test="schedule">
+                               <xsl:apply-templates select="schedule"/>
+                       </xsl:when>
+               </xsl:choose>
+       </xsl:template>
+
+<!-- add / edit  -->
+       <xsl:template match="edit" xmlns:php="http://php.net/xsl";>
+               <xsl:choose>
+                       <xsl:when test="msgbox_data != ''">
+                               <xsl:call-template name="msgbox"/>
+                       </xsl:when>
+               </xsl:choose>
+
+               <div class="yui-navset" id="general_edit_tabview" align="left">
+                       <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
+                       <form method="post" action="{$form_action}">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <div class="yui-content">               
+                               <div id="general">
+                                       <table cellpadding="2" cellspacing="2" 
width="79%" align="center">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="value_id != ''">
+                                                               <tr>
+                                                                       <td 
valign="top">
+                                                                               
<xsl:value-of select="lang_id"/>
+                                                                       </td>
+                                                                       <td>
+                                                                               
<xsl:value-of select="value_id"/>
+                                                                       </td>
+                                                               </tr>
+                                                       </xsl:when>
+                                               </xsl:choose>   
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_descr"/>
+                                                       </td>
+                                                       <td>
+                                                               <textarea 
cols="{textareacols}" rows="{textarearows}" name="values[descr]" wrap="virtual">
+                                                                       
<xsl:value-of select="value_descr"/>            
+                                                               </textarea>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_responsible"/>
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="responsible"/>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_action"/>
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="action"/>
+                                                       </td>
+                                               </tr>
+
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_enabled"/>
+                               </td>
+                               <td>
+                                       <xsl:choose>
+                                               <xsl:when test="value_enabled = 
'1'">
+                                                       <input type="checkbox" 
name="values[enabled]" value="1" checked="checked" 
onMouseout="window.status='';return true;">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="lang_enabled_on_statustext"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <input type="checkbox" 
name="values[enabled]" value="1" onMouseout="window.status='';return true;">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="lang_enabled_off_statustext"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </td>
+                       </tr>
+
+
+                                       </table>
+                               </div>
+                               <div id="repeat">
+                                       <table cellpadding="2" cellspacing="2" 
width="79%" align="center">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="value_id != ''">
+
+                                                               <tr>
+                                                                       <td 
valign="top">
+                                                                               
<xsl:value-of select="lang_next_run"/>
+                                                                       </td>
+                                                                       <td>
+                                                                               
<xsl:value-of select="value_next_run"/>
+                                                                       </td>
+                                                               </tr>
+                                                       </xsl:when>
+                                               </xsl:choose>
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_start_date"/>
+                                                       </td>
+                                                       <td>
+                                                               <input 
type="text" id="values_start_date" name="values[start_date]" size="10" 
value="{value_start_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                                                       
<xsl:attribute name="title">
+                                                                               
<xsl:value-of select="lang_start_date_statustext"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <img 
id="values_start_date-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_end_date"/>
+                                                       </td>
+                                                       <td>
+                                                               <input 
type="text" id="values_end_date" name="values[end_date]" size="10" 
value="{value_end_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                                                       
<xsl:attribute name="title">
+                                                                               
<xsl:value-of select="lang_end_date_statustext"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <img 
id="values_end_date-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_repeat_type"/>
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="repeat_type"/>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_repeat_day"/>
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
disable-output-escaping="yes" select="repeat_day"/>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                                               <xsl:value-of 
select="lang_repeat_interval"/>
+                                                       </td>
+                                                       <td>
+                                                               <input 
type="text" id="values_repeat_interval" name="values[repeat_interval]" size="4" 
value="{value_repeat_interval}">
+                                                                       
<xsl:attribute name="title">
+                                                                               
<xsl:value-of select="lang_repeat_interval_statustext"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                       </td>
+                                               </tr>                   
+<!--
+                                               <tr>
+                                                       <td valign="top">
+                                               <a>
+                                               <xsl:attribute 
name="href"><xsl:value-of select="link_schedule"/></xsl:attribute>
+                                               <xsl:value-of 
select="php:function('lang', 'plan')" />
+                                           </a>
+                                                       </td>
+                                               </tr>
+-->
+
+                                       </table>
+                               </div>
+                               <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
+                               <div id="plan">
+                                       <form method="post" name="alarm" 
action="{$edit_url}">
+                                          <input type="hidden" 
name="values[location_id]" value="{value_location_id}" ></input>
+                                          <input type="hidden" 
name="values[location_item_id]" value="{value_location_item_id}" ></input>
+                                          <table cellpadding="2" 
cellspacing="2" width="79%" align="center" border="0">
+                                       <tr>
+                                               <td width="79%" class="center" 
align="left">
+                                                               <xsl:value-of 
select="php:function('lang', 'alarm')" />
+                                               </td>
+                                       </tr>
+
+                             <!-- DataTable 0 EDIT -->
+                                       <tr>
+                                       <td class="center" align="left" 
colspan="10">
+                                               <div 
id="datatable-container_0"></div>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td class="center" 
align="center" colspan="10">
+                                                       <div 
id="datatable-buttons_0"></div>
+                                               </td>
+                                       </tr>
+                             <!-- <xsl:call-template name="alarm_form"/>  -->
+
+                                         </table>
+                                       </form>
+                               </div>
+
+                               <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
+                                       <tr height="50">
+                                               <td valign="bottom">
+                                                       <input type="submit" 
name="values[save]" value="{lang_save}" onMouseout="window.status='';return 
true;">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="lang_save_statustext"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                               <td valign="bottom">
+                                                       <input type="submit" 
name="values[apply]" value="{lang_apply}" onMouseout="window.status='';return 
true;">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="lang_apply_statustext"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                               <td align="right" 
valign="bottom">
+                                                       <input type="submit" 
name="values[cancel]" value="{lang_cancel}" onMouseout="window.status='';return 
true;">
+                                                               <xsl:attribute 
name="title">
+                                                                               
<xsl:value-of select="lang_cancel_statustext"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="value_id != ''">
+                                                               <td 
align="right" valign="bottom">
+                                                                       <input 
type="submit" name="values[delete]" value="{lang_delete}">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="lang_delete_statustext"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                       </xsl:when>
+                                               </xsl:choose>   
+                                       </tr>
+                               </table>
+                       </div>
+               </form>
+               </div>
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+                       var myButtons = new Array();
+                   var td_count = <xsl:value-of select="td_count" />;
+
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       permission              :       
<xsl:value-of select="permission"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+                       <xsl:for-each select="myButtons">
+                               myButtons[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>
+
+       </xsl:template>
+
+       <xsl:template match="schedule" xmlns:php="http://php.net/xsl";>
+               <div class="yui-navset" id="edit_tabview">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <div class="yui-content">
+                               <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
+                               <div id="general">
+                                       <form method="post" name="alarm" 
action="{$edit_url}">
+                                          <input type="hidden" 
name="values[location_id]" value="{value_location_id}" ></input>
+                                          <input type="hidden" 
name="values[location_item_id]" value="{value_location_item_id}" ></input>
+                                          <table cellpadding="2" 
cellspacing="2" width="79%" align="center" border="0">
+                                       <tr>
+                                               <td width="79%" class="center" 
align="left">
+                                                               <xsl:value-of 
select="php:function('lang', 'alarm')" />
+                                               </td>
+                                       </tr>
+
+                             <!-- DataTable 0 EDIT -->
+                                       <tr>
+                                       <td class="center" align="left" 
colspan="10">
+                                               <div 
id="datatable-container_0"></div>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td class="center" 
align="center" colspan="10">
+                                                       <div 
id="datatable-buttons_0"></div>
+                                               </td>
+                                       </tr>
+                             <!-- <xsl:call-template name="alarm_form"/>  -->
+
+                                         </table>
+                                       </form>
+                               </div>
+                       </div>
+               </div>
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+                       var myButtons = new Array();
+                   var td_count = <xsl:value-of select="td_count" />;
+
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       permission              :       
<xsl:value-of select="permission"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+                       <xsl:for-each select="myButtons">
+                               myButtons[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>
+       </xsl:template>
+


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/event.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision

Added: people/sigurdne/modules/property/trunk/templates/base/event_form.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/event_form.xsl        
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/event_form.xsl        
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,73 @@
+<!-- $Id$ -->
+
+       <xsl:template name="event_form">
+               <xsl:apply-templates select="event_data"/>
+       </xsl:template>
+
+       <xsl:template match="event_data" xmlns:php="http://php.net/xsl";>
+               <script language="JavaScript">
+                       self.name="first_Window";
+                       function event_lookup_<xsl:value-of select="name"/>()
+                       {
+                               Window1=window.open('<xsl:value-of 
select="event_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+                       }               
+               </script>
+               <tr>
+                       <td valign="top">
+                               <xsl:value-of select="event_name"/>
+                       <!--    <a href="javascript:event_lookup_{name}()" 
title="{lang_select_event_help}"><xsl:value-of select="event_name"/></a> -->
+                       </td>
+                       <td>
+                               <xsl:choose>
+                               <xsl:when test="warning!=''">
+                                       <xsl:value-of select="warning"/>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:variable 
name="event_descr"><xsl:value-of 
select="name"/><xsl:text>_descr</xsl:text></xsl:variable>
+                                       <xsl:variable 
name="lookup_function"><xsl:text>event_lookup_</xsl:text><xsl:value-of 
select="name"/><xsl:text>();</xsl:text></xsl:variable>
+                                       <table>
+                                               <tr>
+                                                       <td>
+                                                               <input 
type="text" name="{name}" value="{value}" onClick="{$lookup_function}" 
readonly="readonly" size="6"></input>
+                                                               <input  
size="30" type="text" name="{$event_descr}" value="{descr}"  
onClick="{$lookup_function}" readonly="readonly"> 
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="disabled!=''">
+                                                                               
        <xsl:attribute name="disabled">
+                                                                               
                <xsl:text> disabled</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                               </input>
+                                                       </td>
+                                               </tr>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="next!=''">
+                                                               <tr>
+                                                                       <td>
+                                                                               
<xsl:value-of select="lang_next_run"/>
+                                                                               
<xsl:text>: </xsl:text>
+                                                                               
<xsl:value-of select="next"/>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td>
+                                                                               
<xsl:value-of select="lang_enabled"/>
+                                                                               
<xsl:text>: </xsl:text>
+                                                                               
<xsl:value-of select="enabled"/>
+                                                                       </td>
+                                                               </tr>
+                                                               <tr>
+                                                                       <td>
+                                                                               
<xsl:value-of select="php:function('lang', 'count')" />
+                                                                               
<xsl:text>: </xsl:text>
+                                                                               
<xsl:value-of select="count"/>
+                                                                       </td>
+                                                               </tr>
+                                                       </xsl:when>
+                                               </xsl:choose>
+                                       </table>
+                               </xsl:otherwise>
+                               </xsl:choose>
+                       </td>
+               </tr>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/event_form.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/templates/base/event_schedule.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/event_schedule.xsl    
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/event_schedule.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,27 @@
+<xsl:template match="data">
+       <div id="content">
+
+               <xsl:call-template name="msgbox"/>
+               <xsl:call-template name="yui_property_i18n"/>
+               
+               <h4><xsl:value-of select="lang/resource_schedule"/></h4>
+               <div id="schedule_container"/>
+       </div>
+
+<script type="text/javascript">
+var id = <xsl:value-of select="resource/id"/>;
+YAHOO.util.Event.addListener(window, "load", function() {
+<![CDATA[
+       var url = 
'index.php?menuaction=property.boevent.event_schedule_data&id=' + id + 
'&phpgw_return_as=json&';
+]]>
+       var colDefs = [{key: 'time', label: '#'}, 
+                       <xsl:for-each select="resource/cols">
+                               {key: '<xsl:value-of select="key"/>', label: 
'<xsl:value-of select="label"/>', formatter: 
YAHOO.booking.backendScheduleColorFormatter},
+                       </xsl:for-each>{hidden: true}];
+       YAHOO.booking.inlineTableHelper('schedule_container', url, colDefs, {
+               formatRow: YAHOO.booking.scheduleRowFormatter
+       }, true);
+});
+</script>
+
+</xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/event_schedule.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/templates/base/event_schedule_week.xsl
===================================================================
--- 
people/sigurdne/modules/property/trunk/templates/base/event_schedule_week.xsl   
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/templates/base/event_schedule_week.xsl   
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,55 @@
+<xsl:template match="data">
+       <div id="content">
+               <ul class="pathway">
+                       <li>
+                               <a>
+                                       <xsl:attribute 
name="href"><xsl:value-of select="resource/buildings_link"/></xsl:attribute>
+                                       <xsl:value-of select="lang/buildings"/>
+                               </a>
+                       </li>
+                       <li>
+                               <a>
+                                       <xsl:attribute 
name="href"><xsl:value-of select="resource/building_link"/></xsl:attribute>
+                                       <xsl:value-of 
select="resource/building_name"/>
+                               </a>
+                       </li>
+                       <li>
+                               <a>
+                                       <xsl:attribute 
name="href"><xsl:value-of select="resource/resource_link"/></xsl:attribute>
+                                       <xsl:value-of select="resource/name"/>
+                               </a>
+                       </li>
+                       <li><xsl:value-of select="lang/schedule"/></li>
+               </ul>
+
+               <xsl:call-template name="msgbox"/>
+               <xsl:call-template name="yui_property_i18n"/>
+               
+               <h4><xsl:value-of select="lang/resource_schedule"/></h4>
+               <ul id="week-selector">
+                       <li><a><xsl:attribute name="href"><xsl:value-of 
select="resource/prev_link"/></xsl:attribute><xsl:value-of 
select="lang/prev_week"/></a></li>
+                       <li><xsl:value-of select="lang/week"/>: <xsl:value-of 
select="resource/week"/></li>
+                       <li><a><xsl:attribute name="href"><xsl:value-of 
select="resource/next_link"/></xsl:attribute><xsl:value-of 
select="lang/next_week"/></a></li>
+               </ul>
+
+               <div id="schedule_container"/>
+       </div>
+
+<script type="text/javascript">
+var resource_id = <xsl:value-of select="resource/id"/>;
+var date = '<xsl:value-of select="resource/date"/>';
+YAHOO.util.Event.addListener(window, "load", function() {
+<![CDATA[
+       var url = 
'index.php?menuaction=property.boevent.event_schedule_week_data&date=' + date + 
'&resource_id=' + resource_id + '&phpgw_return_as=json&';
+]]>
+       var colDefs = [{key: 'time', label: '<xsl:value-of 
select="resource/year"/>' + '<br/><xsl:value-of select="lang/time"/>'}, 
+                       <xsl:for-each select="resource/days">
+                               {key: '<xsl:value-of select="key"/>', label: 
'<xsl:value-of select="label"/>', formatter: 
YAHOO.booking.backendScheduleColorFormatter},
+                       </xsl:for-each>{hidden: true}];
+       YAHOO.booking.inlineTableHelper('schedule_container', url, colDefs, {
+               formatRow: YAHOO.booking.scheduleRowFormatter
+       }, true);
+});
+</script>
+
+</xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/event_schedule_week.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/templates/base/files.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/files.xsl     
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/files.xsl     
2009-11-20 10:29:01 UTC (rev 20848)
@@ -1,6 +1,6 @@
        <xsl:template name="file_list">
                        <tr>
-                               <td align="left" valign="top">
+                               <td width="19%" align="left" valign="top">
                                        <xsl:value-of select="//lang_files"/>
                                </td>
                                <td>
@@ -32,11 +32,11 @@
                                                <xsl:choose>
                                                        <xsl:when 
test="//link_to_files!=''">
                                                                <xsl:variable 
name="link_to_file"><xsl:value-of select="//link_to_files"/>/<xsl:value-of 
select="directory"/>/<xsl:value-of select="file_name"/></xsl:variable>
-                                                               <a 
href="{$link_to_file}" target="_blank" title="{//lang_view_file_statustext}" 
style="cursor:help"><xsl:value-of select="name"/></a>
+                                                               <a 
href="{$link_to_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
                                                        </xsl:when>
                                                        <xsl:otherwise>
                                                                <xsl:variable 
name="link_view_file"><xsl:value-of 
select="//link_view_file"/>&amp;file_name=<xsl:value-of 
select="file_name"/></xsl:variable>
-                                                               <a 
href="{$link_view_file}" target="_blank" title="{//lang_view_file_statustext}" 
style="cursor:help"><xsl:value-of select="name"/></a>
+                                                               <a 
href="{$link_view_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
                                                        </xsl:otherwise>
                                                </xsl:choose>
                                                <xsl:text> </xsl:text>
@@ -89,11 +89,11 @@
                                                                <xsl:choose>
                                                                        
<xsl:when test="//link_to_files!=''">
                                                                                
<xsl:variable name="link_to_file"><xsl:value-of 
select="//link_to_files"/>/<xsl:value-of select="directory"/>/<xsl:value-of 
select="file_name"/></xsl:variable>
-                                                                               
<a href="{$link_to_file}" target="_blank" title="{//lang_view_file_statustext}" 
style="cursor:help"><xsl:value-of select="name"/></a>
+                                                                               
<a href="{$link_to_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
                                                                        
</xsl:when>
                                                                        
<xsl:otherwise>
                                                                                
<xsl:variable name="link_view_file"><xsl:value-of 
select="//link_view_file"/>&amp;file_name=<xsl:value-of 
select="file_name"/></xsl:variable>
-                                                                               
<a href="{$link_view_file}" target="_blank" 
title="{//lang_view_file_statustext}" style="cursor:help"><xsl:value-of 
select="name"/></a>
+                                                                               
<a href="{$link_view_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
                                                                        
</xsl:otherwise>
                                                                </xsl:choose>
                                                                <xsl:text> 
</xsl:text>
@@ -119,3 +119,18 @@
                        </td>
                </tr>
        </xsl:template>
+
+       <xsl:template name="jasper_upload" xmlns:php="http://php.net/xsl";>
+               <tr>
+                       <td valign="top">
+                               <xsl:value-of select="php:function('lang', 
'jasper upload')"/>
+                       </td>
+                       <td>
+                               <input type="file" name="jasperfile" size="40">
+                                       <xsl:attribute name="title">
+                                               <xsl:value-of 
select="php:function('lang', 'upload a jasper definition file')"/>
+                                       </xsl:attribute>
+                               </input>
+                       </td>
+               </tr>
+       </xsl:template>

Modified: people/sigurdne/modules/property/trunk/templates/base/group_select.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/group_select.xsl      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/group_select.xsl      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        <xsl:template name="group_select">
        <xsl:variable name="lang_group_statustext"><xsl:value-of 
select="lang_group_statustext"/></xsl:variable>
        <xsl:variable name="select_group_name"><xsl:value-of 
select="select_group_name"/></xsl:variable>
-               <select name="{$select_group_name}" class="forms" 
onMouseover="window.status='{$lang_group_statustext}'; return true;" 
onMouseout="window.status='';return true;">
+               <select name="{$select_group_name}" class="forms" title = 
"{$lang_group_statustext}" 
onMouseover="window.status='{$lang_group_statustext}'; return true;" 
onMouseout="window.status='';return true;">
                        <option value=""><xsl:value-of 
select="lang_no_group"/></option>
                                <xsl:apply-templates select="group_list"/>
                </select>

Modified: people/sigurdne/modules/property/trunk/templates/base/location.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/location.xsl  
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/location.xsl  
2009-11-20 10:29:01 UTC (rev 20848)
@@ -43,6 +43,7 @@
                <table width="100%" cellpadding="0" cellspacing="1" 
align="center">
                        <tr>
                                <td>
+                                       <!-- FILTER TABLE -->
                                        <table>
                                                <tr>
                                                        <td>
@@ -61,20 +62,29 @@
                                                                        </td>
                                                                </xsl:when>
                                                        </xsl:choose>
+
+                                                       <td align="left">
+                                                               
<xsl:call-template name="owner_filter"/>
+                                                       </td>
+
+                                                       <td align="left" >
+                                                               
<xsl:call-template name="search_field"/>
+                                                       </td>
+                                                       <td align="left" >
+                                                       <div id="paging"></div>
+                                                       </td>
+
                                                </tr>
+                                       <!-- /FILTER TABLE -->
                                        </table>
                                </td>
                        </tr>
-                       <tr>
+                       <!-- <tr>
                                <td colspan="{colspan}" width="100%">
                                        <table width="100%">
                                                <tr>
-                                                       <td align="left">
-                                                               
<xsl:call-template name="owner_filter"/>
-                                                       </td>
-                                                       <td align="right" 
colspan="{colspan}" width="100%">
-                                                               
<xsl:call-template name="search_field"/>
-                                                       </td>
+
+
                                                        <td valign ="top">
                                                                <table>
                                                                        <tr>
@@ -110,14 +120,14 @@
                                        <xsl:call-template name="nextmatchs"/>
                                        
                                </td>
-                       </tr>
+                       </tr>-->
                </table>
-               <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
+               <div class="datatable-container">
+               <table width="100%" class="datatable" cellpadding="2" 
cellspacing="2" align="center">
                        <tr class="th">
                                <xsl:choose>
                                        <xsl:when test="//lookup=1">
                                                <td>
-                                               <!-- make room for hidden 
fields -->
                                                </td>
                                        </xsl:when>
                                </xsl:choose>
@@ -141,6 +151,8 @@
                                        </xsl:when>
                                </xsl:choose>
                </table>
+               </div>
+               <xsl:call-template name="datatable-yui-definition" />
                <xsl:choose>
                        <xsl:when test="lookup=1">
                                <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
@@ -258,9 +270,14 @@
                        <xsl:value-of select="lookup_functions"/>
                </script>
 
-               <div align="left">
+               <div class="yui-navset" id="location_edit_tabview">
+                       <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
+                       <form method="post" name="form" action="{$form_action}">
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <div class="yui-content">               
+                               <div id="general">
                
-               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+               <table cellpadding="2" cellspacing="2" width="100%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -270,9 +287,8 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-                       <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
-                       <form method="post" name="form" action="{$form_action}">
-
+               </table>
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="change_type_list != ''">
                                        <tr>
@@ -329,10 +345,8 @@
                                                        </xsl:when>
                                                        <xsl:otherwise>
                                                                <input 
type="text" name="{input_name}" value="{value}" size="{size}" 
onMouseout="window.status='';return true;">
-                                                                       
<xsl:attribute name="onMouseover">
-                                                                               
<xsl:text>window.status='</xsl:text>
+                                                                       
<xsl:attribute name="title">
                                                                                
        <xsl:value-of select="statustext"/>
-                                                                               
<xsl:text>'; return true;</xsl:text>
                                                                        
</xsl:attribute>
                                                                </input>
                                                        </xsl:otherwise>
@@ -395,11 +409,6 @@
                                </xsl:when>
                        </xsl:choose>
 
-                       <tr>
-                               <td colspan="2" width="50%" align="left">
-                                       <xsl:call-template 
name="attributes_form"/>                                                     
-                               </td>
-                       </tr>
                        <xsl:choose>
                                <xsl:when test="edit_street = 1">
                                        <tr>
@@ -453,44 +462,90 @@
                                </xsl:when>
                        </xsl:choose>
 
+               </table>
+               </div>
+
+               <xsl:call-template name="attributes_values"/>
+                       <xsl:choose>
+                               <xsl:when test="documents != ''">
+                                       <div id="document">
+                                               <!-- Some style for the 
expand/contract section-->
+                                               <style>
+                                                       #expandcontractdiv 
{border:1px dotted #dedede; margin:0 0 .5em 0; padding:0.4em;}
+                                                       #treeDiv1 { background: 
#fff; padding:1em; margin-top:1em; }
+                                               </style>
+                                               <script>
+                                                       var documents = 
<xsl:value-of select="documents" />;
+                                               </script>
+
+                                               <!-- markup for expand/contract 
links -->
+                                               <div id="expandcontractdiv">
+                                                       <a id="expand" 
href="#"><xsl:value-of select="lang_expand_all"/></a>
+                                                       <xsl:text> </xsl:text>
+                                                       <a id="collapse" 
href="#"><xsl:value-of select="lang_collapse_all"/></a>
+                                               </div>
+
+                                               <div id="treeDiv1"></div>
+                                       </div>
+                               </xsl:when>
+                       </xsl:choose>
+                       <xsl:choose>
+                               <xsl:when test="related_link != ''">
+                               <div id="related">
+                                       <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
+                                               <tr>
+                                                       <td>
+                                                               <table 
width="100%" cellpadding="2" cellspacing="2" align="center">
+                                                                       
<xsl:apply-templates select="related_link"/>
+                                                               </table>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </div>
+                               </xsl:when>
+                       </xsl:choose>
+
+                       <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+
                        <tr height="50">
+                       <xsl:choose>
+                               <xsl:when test="edit != ''">
                                <td>
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
-                                       <input type="submit" name="save" 
value="{$lang_save}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                               <input type="submit" 
name="save" value="{$lang_save}">
+                                                       <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_save_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
+                               </xsl:when>
+                       </xsl:choose>
                        <xsl:choose>
                                <xsl:when test="check_history != ''">
                                <td>
                                        <xsl:variable 
name="lang_history"><xsl:value-of select="lang_history"/></xsl:variable>
-                                       <input type="submit" name="get_history" 
value="{$lang_history}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                       <input type="submit" name="get_history" 
value="{$lang_history}">
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_history_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
                                </xsl:when>
                        </xsl:choose>
                        </tr>
+                       </table>
+                       </div>
 
                        </form>
+                       <table>
                        <tr>
                                <td>
                                        <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
                                        <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
                                        <form method="post" 
action="{$done_action}">
-                                               <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
+                                               <input type="submit" 
name="done" value="{$lang_done}">
+                                                       <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="lang_done_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
                                                        </xsl:attribute>
                                                </input>
                                        </form>
@@ -508,6 +563,7 @@
                </div>
        </xsl:template>
 
+
        <xsl:template match="owner_list">
        <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
                <xsl:choose>
@@ -728,6 +784,8 @@
                        </xsl:when>
                </xsl:choose>
                </div>
+
+               <xsl:call-template name="datatable-yui-definition" />
        </xsl:template>
 
 <!-- update_cat -->
@@ -803,7 +861,26 @@
                        </tr>
        </xsl:template>
 
+       <xsl:template match="document_link">
+               <xsl:variable name="lang_entity_statustext"><xsl:value-of 
select="lang_entity_statustext"/></xsl:variable>
+               <xsl:variable name="entity_link"><xsl:value-of 
select="entity_link"/></xsl:variable>
+                       <tr >
+                               <td class="small_text" align="left">
+                                       <a href="{$entity_link}" 
title="{$lang_entity_statustext}" onMouseout="window.status='';return 
true;"><xsl:value-of select="text_entity"/></a>
+                               </td>
+                       </tr>
+       </xsl:template>
 
+       <xsl:template match="related_link">
+               <xsl:variable name="lang_entity_statustext"><xsl:value-of 
select="lang_entity_statustext"/></xsl:variable>
+               <xsl:variable name="entity_link"><xsl:value-of 
select="entity_link"/></xsl:variable>
+                       <tr >
+                               <td class="small_text" align="left">
+                                       <a href="{$entity_link}" 
onMouseover="window.status='{$lang_entity_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="text_entity"/></a>
+                               </td>
+                       </tr>
+       </xsl:template>
+
        <xsl:template match="summary">
                <xsl:apply-templates select="menu"/> 
                <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
@@ -910,3 +987,35 @@
                </xsl:for-each>
        </xsl:template>
 
+       <func:function name="phpgw:conditional">
+       <xsl:param name="test"/>
+       <xsl:param name="true"/>
+       <xsl:param name="false"/>
+
+       <func:result>
+               <xsl:choose>
+                       <xsl:when test="$test">
+                       <xsl:value-of select="$true"/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$false"/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </func:result>
+</func:function>
+
+       <xsl:template name="datatable-yui-definition">
+       <script>
+               var myColumnDefs = [
+                       <xsl:for-each select="//table_header">
+                               {
+                                       key: "<xsl:value-of select="name"/>",
+                                       label: "<xsl:value-of select="text" />",
+                                       resizeable:true,
+                                       sortable: <xsl:value-of 
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+                                       visible: <xsl:value-of 
select="phpgw:conditional(not(visible = 0), 'true', 'false')"/>
+                               }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+                       </xsl:for-each>
+               ];
+       </script>
+</xsl:template>

Modified: people/sigurdne/modules/property/trunk/templates/base/lookup.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/lookup.xsl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/lookup.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -138,8 +138,13 @@
                <script LANGUAGE="JavaScript">
                        function ExchangeVendor(thisform)
                        {
-                               opener.document.form.<xsl:value-of 
select="contact_id"/>.value = thisform.elements[0].value;
-                               opener.document.form.<xsl:value-of 
select="org_name"/>.value = thisform.elements[1].value;
+                               /* opener.document.form.<xsl:value-of 
select="contact_id"/>.value = thisform.elements[0].value;
+                               opener.document.form.<xsl:value-of 
select="org_name"/>.value = thisform.elements[1].value;*/
+
+                               //cramirez: modifying this seccion for use in 
datatable YUI
+                               opener.document.forms[0].<xsl:value-of 
select="contact_id"/>.value = thisform.elements[0].value;
+                               opener.document.forms[0].<xsl:value-of 
select="org_name"/>.value = thisform.elements[1].value;
+
                                window.close()
                        }
                </script>

Modified: people/sigurdne/modules/property/trunk/templates/base/project.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/project.xsl   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/project.xsl   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -1,4 +1,28 @@
 <!-- $Id$ -->
+<!--
+       Function
+       phpgw:conditional( expression $test, mixed $true, mixed $false )
+       Evaluates test expression and returns the contents in the true variable 
if
+       the expression is true and the contents of the false variable if its 
false
+
+       Returns mixed
+-->
+<func:function name="phpgw:conditional">
+       <xsl:param name="test"/>
+       <xsl:param name="true"/>
+       <xsl:param name="false"/>
+
+       <func:result>
+               <xsl:choose>
+                       <xsl:when test="$test">
+                       <xsl:value-of select="$true"/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$false"/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </func:result>
+</func:function>
 
        <xsl:template name="app_data">
                <xsl:choose>
@@ -86,6 +110,11 @@
 <!-- add / edit -->
 
        <xsl:template match="edit">
+               <script language="JavaScript">
+                       self.name="first_Window";
+                       <xsl:value-of select="lookup_functions"/>
+               </script>
+
                <table cellpadding="2" cellspacing="2" align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -120,19 +149,17 @@
                                        <xsl:value-of 
disable-output-escaping="yes" select="tabs" />
                                        <div class="yui-content">
 <div id="general">
-       <table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="value_project_id!=''">
                                        <tr>
-                                               <td 
title="{lang_copy_project_statustext}" style="cursor:help">
+                                               <td 
title="{lang_copy_project_statustext}">
                                                        <xsl:value-of 
select="lang_copy_project"/>
                                                </td>
                                                <td>
-                                                       <input type="checkbox" 
name="values[copy_project]" value="True"  onMouseout="window.status='';return 
true;">
-                                                               <xsl:attribute 
name="onMouseover">
-                                                                       
<xsl:text>window.status='</xsl:text>
+                                                       <input type="checkbox" 
name="values[copy_project]" value="True">
+                                                               <xsl:attribute 
name="title">
                                                                                
<xsl:value-of select="lang_copy_project_statustext"/>
-                                                                       
<xsl:text>'; return true;</xsl:text>
                                                                </xsl:attribute>
                                                        </input>
                                                </td>
@@ -149,7 +176,7 @@
 
                                        <tr>
                                                <td valign="top">
-                                                       <a 
href="{link_select_request}"  title="{lang_select_request_statustext}" style 
="cursor:help"><xsl:value-of select="lang_select_request"/></a>
+                                                       <a 
href="{link_select_request}"  
title="{lang_select_request_statustext}"><xsl:value-of 
select="lang_select_request"/></a>
                                                </td>
                                        </tr>
 
@@ -166,7 +193,7 @@
                                                        <tr>
 
                                                        <td class="th_text"  
align="left" >
-                                                               <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                               <a 
href="{link}"  title="{statustext}"><xsl:value-of select="id"/></a>
                                                                <xsl:text> 
</xsl:text>
 
                                                                <xsl:choose>
@@ -175,9 +202,6 @@
                                                                                
<xsl:attribute name="title">
                                                                                
        <xsl:value-of select="//lang_delete_request_statustext"/>
                                                                                
</xsl:attribute>
-                                                                               
<xsl:attribute name="style">
-                                                                               
        <xsl:text>cursor:help</xsl:text>
-                                                                               
</xsl:attribute>
                                                                        </input>
                                                                        
</xsl:when>
                                                                </xsl:choose>
@@ -200,7 +224,7 @@
                                                                        
<xsl:for-each select="data">
                                                                                
<tr>
                                                                                
        <td class="th_text"  align="left" >
-                                                                               
                <a href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                               
                <a href="{link}"  title="{statustext}"><xsl:value-of 
select="id"/></a>
                                                                                
                <xsl:text> </xsl:text>
                                                                                
        </td>
                                                                                
</tr>
@@ -212,6 +236,7 @@
                                </xsl:otherwise>
                        </xsl:choose>
 
+                       <xsl:call-template name="project_group_form"/>
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_name"/>
@@ -245,6 +270,15 @@
                        </tr>
                        <tr>
                                <td>
+                                       <xsl:value-of 
select="lang_coordinator"/>
+                               </td>
+                               <td>
+                                       <xsl:call-template 
name="user_id_select"/>
+                               </td>
+                       </tr>
+                               <xsl:call-template name="contact_form"/>
+                       <tr>
+                               <td>
                                        <xsl:value-of select="lang_category"/>
                                </td>
                                <td>
@@ -277,13 +311,77 @@
                                </tr>
                                </xsl:when>
                        </xsl:choose>
-
-</table>
+       <!-- script>
+               var property_js = <xsl:value-of select="property_js" />
+               var datatable = new Array();
+
+               <xsl:for-each select="datatable">
+                       datatable[<xsl:value-of select="name"/>] = [
+                       {
+                               values                  :       <xsl:value-of 
select="values"/>,
+                               total_records   :       <xsl:value-of 
select="total_records"/>,
+                               is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                               edit_action             :       <xsl:value-of 
select="edit_action"/>,
+                               footer                  :       <xsl:value-of 
select="footer"/>
+                       }
+                       ]
+               <xsl:value-of select="phpgw:conditional(not(position() = 
last()), ',', '')"/>
+               </xsl:for-each>
+       </script-->
+               <xsl:choose>
+                       <xsl:when test="need_approval='1'">
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_ask_approval"/>
+                               </td>
+                               <td>
+                                       <table>
+                                               <xsl:for-each 
select="value_approval_mail_address" >
+                                                       <tr>
+                                                               <td>
+                                                                       <input 
type="checkbox" name="values[approval][{id}]" value="True">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="//lang_ask_approval_statustext"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" name="values[mail_address][{id}]" value="{address}">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="//lang_ask_approval_statustext"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:for-each>
+                                       </table>
+                               </td>
+                       </tr>
+                       </xsl:when>
+               </xsl:choose>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_remark"/>
+                               </td>
+                               <td>
+                                       <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_remark_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:value-of 
select="value_remark"/>
+                                       </textarea>
+                               </td>
+                       </tr>
+       </table>
 </div>
 
+
+
 <div id="location">
 
-<table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="location_type='form'">
                                        <xsl:call-template 
name="location_form"/>
@@ -293,26 +391,27 @@
                                </xsl:otherwise>
                        </xsl:choose>
 
+                       <xsl:choose>
+                               <xsl:when test="suppressmeter =''">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of 
select="lang_power_meter"/>
                                </td>
                                <td>
                                        <input type="text" 
name="values[power_meter]" value="{value_power_meter}" size="12" 
onMouseout="window.status='';return true;" >
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_power_meter_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
                        </tr>
-
+                               </xsl:when>
+                       </xsl:choose>
 </table>
 </div>
 
 <div id="budget">
-       <table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_start_date"/>
@@ -344,6 +443,18 @@
                                </td>
                        </tr>
 
+                       <xsl:choose>
+                               <xsl:when test="ecodimb_data!=''">
+                                       <xsl:call-template name="ecodimb_form"/>
+                               </xsl:when>
+                       </xsl:choose>
+
+                       <xsl:choose>
+                               <xsl:when test="b_account_data!=''">
+                                       <xsl:call-template 
name="b_account_form"/>
+                               </xsl:when>
+                       </xsl:choose>
+
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_budget"/>
@@ -385,6 +496,15 @@
                        </tr>
                        <tr>
                                <td valign="top">
+                                       <xsl:value-of select="lang_remainder"/>
+                               </td>
+                               <td>
+                                       <xsl:value-of select="value_remainder"/>
+                                       <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
                                        <xsl:value-of 
select="lang_reserve_remainder"/>
                                </td>
                                <td>
@@ -394,7 +514,18 @@
                                        <xsl:text> % )</xsl:text>
                                </td>
                        </tr>
+
                        <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_planned_cost"/>
+                               </td>
+                               <td>
+                                       <xsl:value-of 
select="value_planned_cost"/>
+                                       <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
+                               </td>
+                       </tr>
+
+                       <tr>
                                <td class="th_text" valign="top">
                                        <xsl:value-of 
select="lang_workorder_id"/>
                                </td>
@@ -406,7 +537,11 @@
                                        </xsl:when>
                                        <xsl:otherwise>
                                        <td>
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                       <!-- DataTable -->
+                                       <div id="paging_0"> </div>
+                                       <div id="datatable-container_0"></div>
+                                       
+                                       <!-- table width="100%" cellpadding="2" 
cellspacing="2" align="center">
                                                <xsl:apply-templates 
select="table_header_workorder_budget"/>
                                                <xsl:apply-templates 
select="workorder_budget"/>
                                                <tr class="th">
@@ -424,7 +559,31 @@
                                                        <td>
                                                        </td>
                                                </tr>
-                                       </table>
+                                       </table> -->
+                                       
+                                       <!--  DATATABLE DEFINITIONS-->
+                                       <script>
+                                               var property_js = <xsl:value-of 
select="property_js" />;
+                                               var datatable = new Array();
+                                               var myColumnDefs = new Array();
+
+                                               <xsl:for-each 
select="datatable">
+                                                       datatable[<xsl:value-of 
select="name"/>] = [
+                                                       {
+                                                               values          
        :       <xsl:value-of select="values"/>,
+                                                               total_records   
:       <xsl:value-of select="total_records"/>,
+                                                               edit_action     
        :       <xsl:value-of select="edit_action"/>,
+                                                               is_paginator    
:       <xsl:value-of select="is_paginator"/>,
+                                                               footer          
        :       <xsl:value-of select="footer"/>
+                                                       }
+                                                       ]
+                                               </xsl:for-each>
+
+                                               <xsl:for-each 
select="myColumnDefs">
+                                                       
myColumnDefs[<xsl:value-of select="name"/>] = <xsl:value-of select="values"/>
+                                               </xsl:for-each>
+                                       </script>
+
                                        </td>
                                        </xsl:otherwise>
                                </xsl:choose>
@@ -441,17 +600,12 @@
 </table>
 </div>
 
+<xsl:choose>
+<xsl:when test="suppresscoordination =''">
+
 <div id="coordination">
-       <table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
-                               <td>
-                                       <xsl:value-of 
select="lang_coordinator"/>
-                               </td>
-                               <td>
-                                       <xsl:call-template 
name="user_id_select"/>
-                               </td>
-                       </tr>
-                       <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_branch"/>
                                </td>
@@ -514,64 +668,12 @@
                        </tr>
 </table>
 </div>
+</xsl:when>
+</xsl:choose>
 
-<div id="extra">
-       <table class="contenttab" align="left">
-                       <tr>
-                       <xsl:choose>
-                               <xsl:when test="need_approval='yes'">
-                               <td valign="top">
-                                       <xsl:value-of 
select="lang_ask_approval"/>
-                               </td>
-                               <td>
-                               <table>
-                               <tr>
-                               <td>
-                                       <input type="checkbox" 
name="values[approval]" value="True"  onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_ask_approval_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                               <td>
-                                       <input type="text" 
name="values[mail_address]" value="{value_approval_mail_address}" size="40" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_ask_approval_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                               </tr>
-                               </table>
-                               </td>
-                               </xsl:when>
-                       </xsl:choose>
-                       </tr>
-
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_remark"/>
-                               </td>
-                               <td>
-                                       <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_remark_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_remark"/>
-                                       </textarea>
-                               </td>
-                       </tr>
-       </table>
-</div>
-
 <div id="history">
-               <hr noshade="noshade" width="100%" align="center" size="1"/>
-               <table width="80%" cellpadding="2" cellspacing="2" align="left">
+               <!-- <hr noshade="noshade" width="100%" align="center" 
size="1"/>
+               table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="record_history=''">
                                        <tr>
@@ -590,8 +692,12 @@
                                        <xsl:apply-templates 
select="record_history"/>
                                </xsl:otherwise>
                        </xsl:choose>
-               </table>
+               </table> -->
+               <div id="paging_1"> </div>
+               <div id="datatable-container_1"></div>
+
 </div>
+<xsl:call-template name="attributes_values"/>
 </div>
 </div>
                <table>
@@ -627,6 +733,7 @@
                        </tr>
                </table>
 
+               <!-- AQUI VA EL SCRIPT -->
        </xsl:template>
 
        <xsl:template match="workorder_budget">
@@ -789,7 +896,7 @@
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
                        <div class="yui-content">
 <div id="general">
-               <table cellpadding="2" cellspacing="2" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td>
                                        <xsl:value-of select="lang_project_id"/>
@@ -806,13 +913,19 @@
                                        </td>
                                                <td class="th_text"  
align="left" >
                                                <xsl:for-each select="data">
-                                                       <a href="{link}"  
title="{//lang_origin_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
+                                                       <a href="{link}"  
title="{statustext}"><xsl:value-of select="id"/></a>
                                                        <xsl:text> </xsl:text>
                                                </xsl:for-each>
                                        </td>
                                </tr>
                        </xsl:for-each>
 
+                       <xsl:choose>
+                               <xsl:when test="project_group_data!=''">
+                                       <xsl:call-template 
name="project_group_view"/>
+                               </xsl:when>
+                       </xsl:choose>
+
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_name"/>
@@ -831,6 +944,21 @@
                        </tr>
                        <tr>
                                <td>
+                                       <xsl:value-of 
select="lang_coordinator"/>
+                               </td>
+                               <xsl:for-each select="user_list" >
+                                       <xsl:choose>
+                                               <xsl:when test="selected">
+                                                       <td>
+                                                               <xsl:value-of 
select="name"/>
+                                                       </td>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </xsl:for-each>
+                       </tr>
+
+                       <tr>
+                               <td>
                                        <xsl:value-of select="lang_category"/>
                                </td>
                                <xsl:for-each select="cat_list" >
@@ -847,7 +975,7 @@
 </div>
 
 <div id="location">
-<table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:call-template name="location_view"/>
 
                        <xsl:choose>
@@ -863,6 +991,8 @@
                                </xsl:when>
                        </xsl:choose>
 
+                       <xsl:choose>
+                               <xsl:when test="suppressmeter =''">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of 
select="lang_power_meter"/>
@@ -871,11 +1001,13 @@
                                        <xsl:value-of 
select="value_power_meter"/>
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
 </table>
 </div>
 
 <div id="budget">
-       <table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_budget"/>
@@ -963,24 +1095,13 @@
 </table>
 </div>
 
+<xsl:choose>
+<xsl:when test="suppresscoordination =''">
+
 <div id="coordination">
-       <table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td>
-                                       <xsl:value-of 
select="lang_coordinator"/>
-                               </td>
-                               <xsl:for-each select="user_list" >
-                                       <xsl:choose>
-                                               <xsl:when test="selected">
-                                                       <td>
-                                                               <xsl:value-of 
select="name"/>
-                                                       </td>
-                                               </xsl:when>
-                                       </xsl:choose>
-                               </xsl:for-each>
-                       </tr>
-                       <tr>
-                               <td>
                                        <xsl:value-of select="lang_status"/>
                                </td>
                                        <xsl:for-each select="status_list" >
@@ -1073,15 +1194,13 @@
                        </tr>
 </table>
 </div>
+</xsl:when>
+</xsl:choose>
 
-<div id="extra">
-       <table class="contenttab" align="left">
-</table>
-</div>
 
 <div id="history">
                <hr noshade="noshade" width="100%" align="center" size="1"/>
-               <table width="80%" cellpadding="2" cellspacing="2" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="record_history=''">
                                        <tr>
@@ -1136,3 +1255,6 @@
                        </tr>
                </table>
        </xsl:template>
+
+
+

Added: 
people/sigurdne/modules/property/trunk/templates/base/project_group_form.xsl
===================================================================
--- 
people/sigurdne/modules/property/trunk/templates/base/project_group_form.xsl    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/templates/base/project_group_form.xsl    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,35 @@
+<!-- $Id$ -->
+
+       <xsl:template name="project_group_form">
+               <xsl:apply-templates select="project_group_data"/>
+       </xsl:template>
+
+       <xsl:template match="project_group_data">
+               <script language="JavaScript">
+                       self.name="first_Window";
+                       function project_group_lookup()
+                       {
+                               Window1=window.open('<xsl:value-of 
select="project_group_url"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+                       }               
+               </script>
+
+                       <tr>
+                               <td valign="top">
+                                       <a 
href="javascript:project_group_lookup()" 
title="{lang_select_project_group_help}" ><xsl:value-of 
select="lang_project_group"/>
+                                       </a>
+                               </td>
+                               <td>
+                                       <input size="9" type="text" 
name="project_group" value="{value_project_group}">
+                                               <xsl:attribute name="title">
+                                                               <xsl:value-of 
select="lang_select_project_group_help"/>
+                                               </xsl:attribute>
+                                       </input>
+                                       <input  size="30" type="text" 
name="project_group_descr" value="{value_project_group_descr}"  
onClick="project_group_lookup();" readonly="readonly"> 
+                                               <xsl:attribute name="title">
+                                                               <xsl:value-of 
select="lang_select_project_group_help"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/project_group_form.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: 
people/sigurdne/modules/property/trunk/templates/base/project_group_view.xsl
===================================================================
--- 
people/sigurdne/modules/property/trunk/templates/base/project_group_view.xsl    
                            (rev 0)
+++ 
people/sigurdne/modules/property/trunk/templates/base/project_group_view.xsl    
    2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,19 @@
+<!-- $Id$ -->
+
+       <xsl:template name="project_group_view">
+               <xsl:apply-templates select="project_group_data"/>
+       </xsl:template>
+
+       <xsl:template match="project_group_data">
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_project_group"/>
+                               </td>
+                               <td>
+                                       <xsl:value-of 
select="value_project_group"/>
+                                       <xsl:text> [</xsl:text>
+                                       <xsl:value-of 
select="value_project_group_descr"/>
+                                       <xsl:text>]</xsl:text>
+                               </td>
+                       </tr>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/project_group_view.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Modified: people/sigurdne/modules/property/trunk/templates/base/r_agreement.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/r_agreement.xsl       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/r_agreement.xsl       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -354,7 +354,11 @@
                        self.name="first_Window";
                        <xsl:value-of select="lookup_functions"/>
                </script>
-               <div align="left">
+               <div class="yui-navset" id="edit_tabview">
+               <xsl:value-of disable-output-escaping="yes" select="tabs" />
+                       <div class="yui-content">
+                       <div id="details">      
+
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
                <table cellpadding="2" cellspacing="2"  width="90%" 
align="center">
                        <tr><td>
@@ -480,12 +484,15 @@
                        </xsl:choose>
 
                        <xsl:choose>
-                               <xsl:when test="attributes_values != ''">
-                                       <tr>
-                                               <td colspan="2" width="50%" 
align="left">                               
-                                                       <xsl:call-template 
name="attributes_form"/>
-                                               </td>
-                                       </tr>
+                               <xsl:when test="attributes_group != ''">
+                                       <tr><td colspan= "2">
+                                       <table>
+                                       <tr><td>
+                                       <xsl:call-template 
name="attributes_values"/>
+                                       </td></tr>
+                                       </table>
+                                       </td></tr>
+                                       
                                </xsl:when>
                        </xsl:choose>
                        <xsl:choose>
@@ -561,6 +568,8 @@
                </td>
                </tr>
                </table>
+               </div>
+               <div id="details">
                <xsl:choose>
                        <xsl:when test="value_r_agreement_id!=''">
                        <table>
@@ -657,6 +666,8 @@
                        </xsl:when>
                </xsl:choose>                                           
                </div>
+               </div>
+               </div>
        </xsl:template>
 
 

Modified: people/sigurdne/modules/property/trunk/templates/base/request.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/request.xsl   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/request.xsl   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -42,6 +42,14 @@
                </table>
                </div>
                </form> 
+               <!-- to reload the table -->
+               <xsl:choose>
+                       <xsl:when test="//exchange_values!=''">
+                               <script type="text/javascript">
+                                       <xsl:value-of 
select="//exchange_values"/>
+                               </script>
+                       </xsl:when>
+               </xsl:choose>
        </xsl:template>
 
        <xsl:template match="priority_key">
@@ -230,6 +238,13 @@
                        </tr>
        </xsl:template>
 
+
+
+
+
+
+
+
 <!-- add / edit -->
 
        <xsl:template match="edit">
@@ -246,7 +261,7 @@
                        </xsl:choose>
                        <xsl:choose>
                                <xsl:when test="value_request_id!=''">
-                                               <td valign="top">
+                                               <td valign="top" align="center">
                                                        <xsl:variable 
name="generate_project_action"><xsl:value-of 
select="generate_project_action"/></xsl:variable>
                                                        <xsl:variable 
name="lang_generate_project"><xsl:value-of 
select="lang_generate_project"/></xsl:variable>
                                                        <form method="post" 
action="{$generate_project_action}">
@@ -270,8 +285,16 @@
                                                </td>
                                </xsl:when>
                        </xsl:choose>
+                       </table>
+                       </div>
+
                        <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
                        <form ENCTYPE="multipart/form-data" method="post" 
name="form" action="{$form_action}">
+                               <div class="yui-navset yui-navset-top" 
id="project_tabview">
+                                       <xsl:value-of 
disable-output-escaping="yes" select="tabs" />
+                                       <div class="yui-content">
+                                       <div id="general">
+                                               <table cellpadding="2" 
cellspacing="2" width="80%" align="center">
                        <input type="hidden" name="values[origin]" 
value="{value_origin_type}"></input>
                        <input type="hidden" name="values[origin_id]" 
value="{value_origin_id}"></input>
                        <xsl:choose>
@@ -310,6 +333,451 @@
                                                        <tr>
                
                                                        <td class="th_text"  
align="left" >
+                                                                               
                <a href="{link}"  title="{statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                               
                <xsl:text> </xsl:text>
+
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="location ='.project.request'">
+                                                                               
                        <input type="checkbox" name="values[delete_request][]" 
value="{id}"  onMouseout="window.status='';return true;">
+                                                                               
                                <xsl:attribute name="onMouseover">
+                                                                               
                                        <xsl:text>window.status='</xsl:text>
+                                                                               
                                                <xsl:value-of 
select="//lang_delete_request_statustext"/>
+                                                                               
                                        <xsl:text>'; return true;</xsl:text>
+                                                                               
                                </xsl:attribute>
+                                                                               
                        </input>
+                                                                               
                        </xsl:when>
+                                                                               
                </xsl:choose>
+                                                                               
        </td>
+                                                                               
        </tr>
+                                                                               
        </xsl:for-each>
+                                                                               
        </table>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                       
</xsl:for-each>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       
<xsl:for-each select="value_origin" >
+                                                                               
<tr>
+                                                                               
        <td class="th_text" valign ="top">
+                                                                               
                <xsl:value-of select="descr"/>
+                                                                               
        </td>
+                                                                               
        <td>
+                                                                               
                <table>
+                                                                               
                        <xsl:for-each select="data">
+                                                                               
                                <tr>
+                                                                               
                                        <td class="th_text"  align="left" >
+                                                                               
                                                <a href="{link}"  
title="{statustext}" style ="cursor:help"><xsl:value-of select="id"/></a>
+                                                                               
                                                <xsl:text> </xsl:text>
+                                                                               
                                        </td>
+                                                                               
                                </tr>
+                                                                               
                        </xsl:for-each>
+                                                                               
                </table>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                       
</xsl:for-each>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                                       <xsl:for-each 
select="value_target" >
+                                                               <tr>
+                                                                       <td 
class="th_text" valign ="top">
+                                                                               
<xsl:value-of select="descr"/>
+                                                                       </td>
+                                                                               
<td class="th_text"  align="left" >
+                                                                               
<xsl:for-each select="data">
+                                                                               
        <a href="{link}"  title="{//lang_target_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                               
        <xsl:text> </xsl:text>
+                                                                               
</xsl:for-each>
+                                                                       </td>
+                                                               </tr>
+                                                       </xsl:for-each>
+
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="lang_title"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" name="values[title]" value="{value_title}" 
onMouseout="window.status='';return true;">
+                                                                               
<xsl:attribute name="onMouseover">
+                                                                               
        <xsl:text>window.status='</xsl:text>
+                                                                               
                <xsl:value-of select="lang_title_statustext"/>
+                                                                               
        <xsl:text>'; return true;</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="lang_descr"/>
+                                                               </td>
+                                                               <td>
+                                                                       
<textarea cols="60" rows="6" name="values[descr]" wrap="virtual" 
onMouseout="window.status='';return true;">
+                                                                               
<xsl:attribute name="onMouseover">
+                                                                               
        <xsl:text>window.status='</xsl:text>
+                                                                               
                <xsl:value-of select="lang_descr_statustext"/>
+                                                                               
        <xsl:text>'; return true;</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:value-of select="value_descr"/>
+                                                                       
</textarea>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       
<xsl:value-of select="lang_category"/>
+                                                               </td>
+                                                               <td>
+                                                                       
<xsl:call-template name="categories"/>
+                                                               </td>
+                                                       </tr>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="location_type='form'">
+                                                                       
<xsl:call-template name="location_form"/>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       
<xsl:call-template name="location_view"/>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="contact_phone !=''">
+                                                                               
        <tr>
+                                                                               
                <td class="th_text"  align="left">
+                                                                               
                        <xsl:value-of select="lang_contact_phone"/>
+                                                                               
                </td>
+                                                                               
                <td  align="left">
+                                                                               
                        <xsl:value-of select="contact_phone"/>
+                                                                               
                </td>
+                                                                               
        </tr>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="lang_power_meter"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" name="values[power_meter]" value="{value_power_meter}" size="12" 
onMouseout="window.status='';return true;" >
+                                                                               
<xsl:attribute name="onMouseover">
+                                                                               
        <xsl:text>window.status='</xsl:text>
+                                                                               
                <xsl:value-of select="lang_power_meter_statustext"/>
+                                                                               
        <xsl:text>'; return true;</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="lang_budget"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" name="values[budget]" value="{value_budget}" 
onMouseout="window.status='';return true;">
+                                                                               
<xsl:attribute name="onMouseover">
+                                                                               
        <xsl:text>window.status='</xsl:text>
+                                                                               
                <xsl:value-of select="lang_budget_statustext"/>
+                                                                               
        <xsl:text>'; return true;</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       
<xsl:value-of select="lang_coordinator"/>
+                                                               </td>
+                                                               <td>
+                                                                       
<xsl:call-template name="user_id_select"/>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
+                                                                       
<xsl:value-of select="lang_status"/>
+                                                               </td>
+                                                               <td>
+                                                                       
<xsl:call-template name="status_select"/>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="lang_start_date"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_start_date" name="values[start_date]" size="10" 
value="{value_start_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                                                               
<xsl:attribute name="onMouseover">
+                                                                               
        <xsl:text>window.status='</xsl:text>
+                                                                               
                <xsl:value-of select="lang_start_date_statustext"/>
+                                                                               
        <xsl:text>'; return true;</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       <img 
id="values_start_date-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="lang_end_date"/>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_end_date" name="values[end_date]" size="10" 
value="{value_end_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                                                               
<xsl:attribute name="onMouseover">
+                                                                               
        <xsl:text>window.status='</xsl:text>
+                                                                               
                <xsl:value-of select="lang_end_date_statustext"/>
+                                                                               
        <xsl:text>'; return true;</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       <img 
id="values_end_date-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="lang_branch"/>
+                                                               </td>
+                                                               <td>
+                                                                       
<xsl:variable name="lang_branch_statustext"><xsl:value-of 
select="lang_branch_statustext"/></xsl:variable>
+                                                                               
<select name="values[branch_id]" class="forms" 
onMouseover="window.status='{$lang_branch_statustext}'; return true;" 
onMouseout="window.status='';return true;">
+                                                                               
        <option value=""><xsl:value-of select="lang_no_branch"/></option>
+                                                                               
        <xsl:apply-templates select="branch_list"/>
+                                                                               
</select>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="notify='yes'">
+                                                                               
<td valign="top">
+                                                                               
        <xsl:value-of select="lang_notify"/>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <input type="checkbox" name="values[notify]" value="True"  
onMouseout="window.status='';return true;">
+                                                                               
                <xsl:attribute name="onMouseover">
+                                                                               
                        <xsl:text>window.status='</xsl:text>
+                                                                               
                                <xsl:value-of select="lang_notify_statustext"/>
+                                                                               
                        <xsl:text>'; return true;</xsl:text>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+
+                                                                               
        <input type="text" name="values[mail_address]" 
value="{value_notify_mail_address}" onMouseout="window.status='';return true;">
+                                                                               
                <xsl:attribute name="onMouseover">
+                                                                               
                        <xsl:text>window.status='</xsl:text>
+                                                                               
                                <xsl:value-of select="lang_notify_statustext"/>
+                                                                               
                        <xsl:text>'; return true;</xsl:text>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+                                                                               
</td>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                               </tr>
+                                                                               
</table>
+                                               </div>
+
+
+                                               <div id="importance">
+                                                       <table>
+                                                               <tr>
+                                                                       <td 
class="th_text" valign="top">
+                                                                               
<xsl:value-of select="lang_importance"/>
+                                                                       </td>
+                                                                               
<td>
+                                                                               
        <table width="100%" cellpadding="2" cellspacing="2" align="center">
+                                                                               
                <xsl:apply-templates select="table_header_importance"/>
+                                                                               
                <xsl:apply-templates select="condition_list"/>
+                                                                               
                <tr>
+                                                                               
                        <td align="left">
+                                                                               
                                <xsl:value-of 
select="lang_authorities_demands"/>
+                                                                               
                        </td>
+                                                                               
                        <td align="center">
+                                                                               
                                <xsl:choose>
+                                                                               
                                        <xsl:when 
test="authorities_demands='1'">
+                                                                               
                                                <input type="checkbox" 
name="values[authorities_demands]" value="1" checked="checked" 
onMouseout="window.status='';return true;">
+                                                                               
                                                        <xsl:attribute 
name="onMouseover">
+                                                                               
                                                                
<xsl:text>window.status='</xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="lang_authorities_demands_statustext"/>
+                                                                               
                                                                <xsl:text>'; 
return true;</xsl:text>
+                                                                               
                                                        </xsl:attribute>
+                                                                               
                                                </input>
+                                                                               
                                        </xsl:when>
+                                                                               
                                        <xsl:otherwise>
+                                                                               
                                                <input type="checkbox" 
name="values[authorities_demands]" value="1"  
onMouseout="window.status='';return true;">
+                                                                               
                                                        <xsl:attribute 
name="onMouseover">
+                                                                               
                                                                
<xsl:text>window.status='</xsl:text>
+                                                                               
                                                                        
<xsl:value-of select="lang_authorities_demands_statustext"/>
+                                                                               
                                                                <xsl:text>'; 
return true;</xsl:text>
+                                                                               
                                                        </xsl:attribute>
+                                                                               
                                                </input>
+                                                                               
                                        </xsl:otherwise>
+                                                                               
                                </xsl:choose>
+                                                                               
                        </td>
+                                                                               
                </tr>
+                                                                               
        </table>
+                                                                               
</td>
+                                                               </tr>
+                                                       </table>
+                                               </div>
+
+
+                                               <div id="documents">
+                                                       <table>
+                                                               <tr>
+                                                                       <td 
align="left">
+                                                                               
<xsl:value-of select="lang_score"/>
+                                                                       </td>
+                                                                       <td>
+                                                                               
<xsl:value-of select="value_score"/>
+                                                                       </td>
+                                                               </tr>
+
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="files!=''">
+                                                                               
<!-- <xsl:call-template name="file_list"/> -->
+                                                                               
<tr>
+                                                                               
        <td width="19%" align="left" valign="top">
+                                                                               
                <xsl:value-of select="//lang_files"/>
+                                                                               
        </td>
+                                                                               
        <td>
+                                                                               
                <div id="datatable-container_1"></div>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                       
</xsl:when>
+                                                               </xsl:choose>
+
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="fileupload = 1">
+                                                                               
<xsl:call-template name="file_upload"/>
+                                                                       
</xsl:when>
+                                                               </xsl:choose>
+
+                                                               <tr height="50">
+                                                                       <td>
+                                                                               
<xsl:variable name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+                                                                               
<input type="submit" name="values[save]" value="{$lang_save}" 
onMouseout="window.status='';return true;">
+                                                                               
        <xsl:attribute name="onMouseover">
+                                                                               
                <xsl:text>window.status='</xsl:text>
+                                                                               
                        <xsl:value-of select="lang_save_statustext"/>
+                                                                               
                <xsl:text>'; return true;</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
</input>
+                                                                       </td>
+                                                               </tr>
+                                                       </table>
+                                               </div>
+
+                                               <div id="history">
+                                                       <!--table width="80%" 
cellpadding="2" cellspacing="2" align="center">
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="record_history=''">
+                                                                               
<tr>
+                                                                               
        <td class="th_text" align="center">
+                                                                               
                <xsl:value-of select="lang_no_history"/>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<tr>
+                                                                               
        <td class="th_text" align="left">
+                                                                               
                <xsl:value-of select="lang_history"/>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                               
<xsl:apply-templates select="table_header_history"/>
+                                                                               
<xsl:apply-templates select="record_history"/>
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </table-->
+                                                       <div id="paging_0"> 
</div>
+                                                       <div 
id="datatable-container_0"></div>
+                                                       <div 
id="contextmenu_0"></div>
+
+                                                       <script>
+                                                               var property_js 
= <xsl:value-of select="property_js" />;
+                                                               var datatable = 
new Array();
+                                                               var 
myColumnDefs = new Array();
+
+                                                               <xsl:for-each 
select="datatable">
+                                                                       
datatable[<xsl:value-of select="name"/>] = [
+                                                                       {
+                                                                               
values                  :       <xsl:value-of select="values"/>,
+                                                                               
total_records   :       <xsl:value-of select="total_records"/>,
+                                                                               
edit_action             :       <xsl:value-of select="edit_action"/>,
+                                                                               
is_paginator    :       <xsl:value-of select="is_paginator"/>,
+                                                                               
footer                  :       <xsl:value-of select="footer"/>
+                                                                       }
+                                                                       ]
+                                                               </xsl:for-each>
+
+                                                               <xsl:for-each 
select="myColumnDefs">
+                                                                       
myColumnDefs[<xsl:value-of select="name"/>] = <xsl:value-of select="values"/>
+                                                               </xsl:for-each>
+                                                       </script>
+                                               </div>
+                                       </div>
+                               </div>
+                               <table>
+                                       <tr height="50">
+                                               <td>
+                                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+                                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
+                                                               <xsl:attribute 
name="onMouseover">
+                                                                       
<xsl:text>window.status='</xsl:text>
+                                                                               
<xsl:value-of select="lang_save_statustext"/>
+                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </form>
+
+                       <table>
+                               <tr>
+                                       <td>
+                                               <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+                                               <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+                                               <form method="post" 
action="{$done_action}">
+                                                       <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+                                                               <xsl:attribute 
name="onMouseover">
+                                                                       
<xsl:text>window.status='</xsl:text>
+                                                                               
<xsl:value-of select="lang_done_statustext"/>
+                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </form>
+                                       </td>
+                               </tr>
+                       </table>
+
+                       <!-- input type="hidden" name="values[origin]" 
value="{value_origin_type}"></input>
+                       <input type="hidden" name="values[origin_id]" 
value="{value_origin_id}"></input>
+                       <xsl:choose>
+                               <xsl:when test="value_request_id!=''">
+                                       <tr>
+                                               <td>
+                                                       <xsl:value-of 
select="lang_copy_request"/>
+                                               </td>
+                                               <td>
+                                                       <input type="checkbox" 
name="values[copy_request]" value="True"  onMouseout="window.status='';return 
true;">
+                                                               <xsl:attribute 
name="onMouseover">
+                                                                       
<xsl:text>window.status='</xsl:text>
+                                                                               
<xsl:value-of select="lang_copy_request_statustext"/>
+                                                                       
<xsl:text>'; return true;</xsl:text>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <xsl:value-of 
select="lang_request_id"/>
+                                               </td>
+                                               <td>
+                                                       <xsl:value-of 
select="value_request_id"/>
+                                               </td>
+                                       </tr>
+                                       <xsl:for-each select="value_origin" >
+                                               <tr>
+                                                       <td class="th_text" 
valign ="top">
+                                                               <xsl:value-of 
select="descr"/>
+                                                       </td>
+                                                       <td>
+                                                       <table>
+
+                                                       <xsl:for-each 
select="data">
+                                                       <tr>
+
+                                                       <td class="th_text"  
align="left" >
                                                                <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
                                                                <xsl:text> 
</xsl:text>
                
@@ -515,11 +983,21 @@
                                </td>
                        </tr>
 
+
+
+
+
+
+
+
+
                        <tr>
                                <td class="th_text" valign="top">
                                        <xsl:value-of select="lang_importance"/>
                                </td>
                                        <td>
+
+
                                        <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
                                                <xsl:apply-templates 
select="table_header_importance"/>
                                                <xsl:apply-templates 
select="condition_list"/>
@@ -552,9 +1030,19 @@
                                                </tr>
 
                                        </table>
+
+
+
                                        </td>
                        </tr>
 
+
+
+
+
+
+
+
                        <tr>
                                <td align="left">
                                        <xsl:value-of select="lang_score"/>
@@ -634,6 +1122,8 @@
                        </tr>
                </table>
                <hr noshade="noshade" width="100%" align="center" size="1"/>
+               <div id="paging_0"> </div>
+               <div id="datatable-container_0" style="left:330px; 
position:absolute;"></div>
                <table width="80%" cellpadding="2" cellspacing="2" 
align="center">
                        <xsl:choose>
                                <xsl:when test="record_history=''">
@@ -654,10 +1144,40 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </table>
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       edit_action             :       
<xsl:value-of select="edit_action"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>
+
                </div>
-               <hr noshade="noshade" width="100%" align="center" size="1"/>
+               <hr noshade="noshade" width="100%" align="center" size="1"/>-->
        </xsl:template>
 
+
+
+
+
+
+
+
+
        <xsl:template match="condition_list">
                        <tr>
                                <xsl:attribute name="class">
@@ -1084,7 +1604,7 @@
                                                <xsl:for-each select="data">
                                                        <tr>
                                                                <td 
class="th_text"  align="left" >
-                                                                       <a 
href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                       <a 
href="{link}"  title="{statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
                                                                        
<xsl:text> </xsl:text>
                                                                </td>
                                                        </tr>

Modified: people/sigurdne/modules/property/trunk/templates/base/responsible.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/responsible.xsl       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/responsible.xsl       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -123,13 +123,13 @@
                                <td align="center">
                                        <xsl:value-of select="active"/>
                                </td>
-                               <td align="center" title="{lang_contacts_text}" 
style="cursor:help">
+                               <td align="center" title="{lang_contacts_text}">
                                        <xsl:variable 
name="link_contacts"><xsl:value-of select="link_contacts"/></xsl:variable>
                                        <a href="{link_contacts}"><xsl:value-of 
select="text_contacts"/></a>
                                </td>
                                <xsl:choose>
                                        <xsl:when test="link_edit != ''">
-                                               <td align="center" 
title="{lang_edit_text}" style="cursor:help">
+                                               <td align="center" 
title="{lang_edit_text}">
                                                        <xsl:variable 
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
                                                        <a 
href="{link_edit}"><xsl:value-of select="text_edit"/></a>
                                                </td>
@@ -137,7 +137,7 @@
                                </xsl:choose>
                                <xsl:choose>
                                        <xsl:when test="link_delete != ''">
-                                               <td align="center" 
title="{lang_delete_text}" style="cursor:help">
+                                               <td align="center" 
title="{lang_delete_text}">
                                                        <xsl:variable 
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
                                                        <a 
href="{link_delete}"><xsl:value-of select="text_delete"/></a>
                                                </td>
@@ -177,8 +177,12 @@
                        <tr>
                                <td class="th_text" align="left">
                                        <xsl:value-of select="location_name"/>
+                                       <xsl:choose>
+                                               <xsl:when test="category_name 
!= ''">
                                        <xsl:text>::</xsl:text>
                                        <xsl:value-of select="category_name"/>
+                                               </xsl:when>
+                                       </xsl:choose>
                                        <xsl:text>::</xsl:text>
                                        <xsl:value-of select="type_name"/>
                                </td>
@@ -214,6 +218,9 @@
                                <xsl:value-of select="lang_contact"/>
                        </td>
                        <td class="th_text" width="10%" align="left">
+                               <a href="{sort_ecodimb}"><xsl:value-of 
select="lang_ecodimb"/></a>
+                       </td>
+                       <td class="th_text" width="10%" align="left">
                                <a href="{$sort_location}"><xsl:value-of 
select="lang_location"/></a>
                        </td>
                        <td class="th_text" width="5%" align="center">
@@ -261,6 +268,9 @@
                                        <xsl:value-of select="contact_name"/>
                                </td>
                                <td align="left">
+                                       <xsl:value-of select="ecodimb"/>
+                               </td>
+                               <td align="left">
                                        <xsl:value-of select="location_code"/>
                                </td>
                                <td align="left">
@@ -283,7 +293,7 @@
                                </td>
                                <xsl:choose>
                                        <xsl:when test="link_edit != ''">
-                                               <td align="center" 
title="{lang_edit_text}" style="cursor:help">
+                                               <td align="center" 
title="{lang_edit_text}">
                                                        <xsl:variable 
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
                                                        <a 
href="{link_edit}"><xsl:value-of select="text_edit"/></a>
                                                </td>
@@ -291,7 +301,7 @@
                                </xsl:choose>
                                <xsl:choose>
                                        <xsl:when test="link_delete != ''">
-                                               <td align="center" 
title="{lang_delete_text}" style="cursor:help">
+                                               <td align="center" 
title="{lang_delete_text}">
                                                        <xsl:variable 
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
                                                        <a 
href="{link_delete}"><xsl:value-of select="text_delete"/></a>
                                                </td>
@@ -312,9 +322,6 @@
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_add_statustext"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                </form>
                        </td>
@@ -326,9 +333,6 @@
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="lang_cancel_statustext"/>
                                                                </xsl:attribute>
-                                                               <xsl:attribute 
name="style">
-                                                                       
<xsl:text>cursor:help</xsl:text>
-                                                               </xsl:attribute>
                                                        </input>
                                                </form>
                                        </td>
@@ -381,7 +385,7 @@
                                </td>
                        </tr>
                        <tr>
-                               <td valign="top" width="10%"  
title="{lang_name_status_text}" style="cursor:help">
+                               <td valign="top" width="10%"  
title="{lang_name_status_text}">
                                        <xsl:value-of select="lang_name"/>
                                </td>
                                <td>
@@ -390,7 +394,7 @@
                                </td>
                        </tr>
                        <tr>
-                               <td valign="top"  
title="{lang_descr_status_text}" style="cursor:help">
+                               <td valign="top"  
title="{lang_descr_status_text}">
                                        <xsl:value-of select="lang_descr"/>
                                </td>
                                <td>
@@ -410,9 +414,6 @@
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="lang_active_on_statustext"/>
                                                                </xsl:attribute>
-                                                               <xsl:attribute 
name="style">
-                                                                       
<xsl:text>cursor:help</xsl:text>
-                                                               </xsl:attribute>
                                                        </input>
                                                </xsl:when>
                                                <xsl:otherwise>
@@ -420,9 +421,6 @@
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="lang_active_off_statustext"/>
                                                                </xsl:attribute>
-                                                               <xsl:attribute 
name="style">
-                                                                       
<xsl:text>cursor:help</xsl:text>
-                                                               </xsl:attribute>
                                                        </input>
                                                </xsl:otherwise>
                                        </xsl:choose>
@@ -438,9 +436,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="lang_save_status_text"/>
                                                                        
</xsl:attribute>
-                                                                       
<xsl:attribute name="style">
-                                                                               
<xsl:text>cursor:help</xsl:text>
-                                                                       
</xsl:attribute>
                                                                </input>
                                                        </td>
                                                        <td valign="bottom">
@@ -449,9 +444,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="lang_apply_status_text"/>
                                                                        
</xsl:attribute>
-                                                                       
<xsl:attribute name="style">
-                                                                               
<xsl:text>cursor:help</xsl:text>
-                                                                       
</xsl:attribute>
                                                                </input>
                                                        </td>
                                                        <td align="left" 
valign="bottom">
@@ -460,9 +452,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="lang_cancel_status_text"/>
                                                                        
</xsl:attribute>
-                                                                       
<xsl:attribute name="style">
-                                                                               
<xsl:text>cursor:help</xsl:text>
-                                                                       
</xsl:attribute>
                                                                </input>
                                                        </td>
                                                </tr>
@@ -523,21 +512,15 @@
                                        <xsl:value-of 
select="lang_responsibility"/>
                                </td>
                                <td>
-                                       <input type="text" 
name="responsibility_id" value="{value_responsibility_id}" 
onClick="lookup_responsibility()" readonly="readonly" size="5" 
onMouseout="window.status='';return true;" >
+                                       <input type="text" 
name="responsibility_id" value="{value_responsibility_id}" readonly="readonly" 
size="5" onMouseout="window.status='';return true;" >
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_responsibility_status_text"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
-                                       <input  size="30" type="text" 
name="responsibility_name" value="{value_responsibility_name}"  
onClick="lookup_responsibility()" readonly="readonly"> 
+                                       <input  size="30" type="text" 
name="responsibility_name" value="{value_responsibility_name}" 
readonly="readonly"> 
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_responsibility_status_text"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                </td>
                        </tr>
@@ -550,21 +533,16 @@
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_contact_status_text"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                        <input  size="30" type="text" 
name="contact_name" value="{value_contact_name}"  onClick="lookup_contact()" 
readonly="readonly"> 
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_contact_status_text"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                </td>
                        </tr>
 
+                       <xsl:call-template name="ecodimb_form"/>
                        <xsl:call-template name="location_form"/>
 
                        <tr>
@@ -576,9 +554,6 @@
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_active_from_statustext"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                        <img id="values_active_from-trigger" 
src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;" />
                                </td>
@@ -592,9 +567,6 @@
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_active_to_statustext"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                        <img id="values_active_to-trigger" 
src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;" />
                                </td>
@@ -602,7 +574,7 @@
 
 
                        <tr>
-                               <td valign="top"  
title="{lang_remark_status_text}" style="cursor:help">
+                               <td valign="top"  
title="{lang_remark_status_text}">
                                        <xsl:value-of select="lang_remark"/>
                                </td>
                                <td>
@@ -621,9 +593,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="lang_save_status_text"/>
                                                                        
</xsl:attribute>
-                                                                       
<xsl:attribute name="style">
-                                                                               
<xsl:text>cursor:help</xsl:text>
-                                                                       
</xsl:attribute>
                                                                </input>
                                                        </td>
                                                        <td valign="bottom">
@@ -632,9 +601,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="lang_apply_status_text"/>
                                                                        
</xsl:attribute>
-                                                                       
<xsl:attribute name="style">
-                                                                               
<xsl:text>cursor:help</xsl:text>
-                                                                       
</xsl:attribute>
                                                                </input>
                                                        </td>
                                                        <td align="left" 
valign="bottom">
@@ -643,9 +609,6 @@
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="lang_cancel_status_text"/>
                                                                        
</xsl:attribute>
-                                                                       
<xsl:attribute name="style">
-                                                                               
<xsl:text>cursor:help</xsl:text>
-                                                                       
</xsl:attribute>
                                                                </input>
                                                        </td>
                                                </tr>

Modified: people/sigurdne/modules/property/trunk/templates/base/s_agreement.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/s_agreement.xsl       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/s_agreement.xsl       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -221,12 +221,15 @@
                        self.name="first_Window";
                        <xsl:value-of select="lookup_functions"/>
                </script>
-               <div align="left">
+               <div class="yui-navset" id="edit_tabview">
+               <xsl:value-of disable-output-escaping="yes" select="tabs" />
+                       <div class="yui-content">
+
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
-               <table cellpadding="2" cellspacing="2" align="center">
-                       <tr><td>
+                       <div id="general">
                <form ENCTYPE="multipart/form-data" method="post" name="form" 
action="{$edit_url}">
-               <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
+
+               <table cellpadding="2" cellspacing="2" width="79%" 
align="center" border="0">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -287,8 +290,43 @@
                                </td>
                        </tr>
                        <xsl:call-template name="vendor_form"/>
+
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_budget"/>
+                               </td>
+                               <td>
+                                       <input type="text" 
name="values[budget]" value="{value_budget}" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_budget_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                                       <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_year"/>
+                               </td>
+                               <td valign="top">
+                                       <select name="values[year]" 
class="forms" title="{lang_year_statustext}">
+                                               <xsl:apply-templates 
select="year"/>
+                                       </select>
+                               </td>
+                       </tr>
+
+                       <xsl:call-template name="ecodimb_form"/>
                        <xsl:call-template name="b_account_form"/>
                        <tr>
+                               <td>
+                                       <xsl:value-of select="lang_category"/>
+                               </td>
+                               <td>
+                                       <xsl:call-template name="categories"/>
+                               </td>
+                       </tr>
+                       <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_start_date"/>
                                </td>
@@ -335,27 +373,6 @@
                        </tr>
                        
                        <xsl:choose>
-                               <xsl:when test="files!=''">
-                                       <xsl:call-template name="file_list"/>
-                               </xsl:when>
-                       </xsl:choose>
-
-                       <xsl:choose>
-                               <xsl:when test="fileupload = 1">
-                                       <xsl:call-template name="file_upload"/>
-                               </xsl:when>
-                       </xsl:choose>
-
-                       <xsl:choose>
-                               <xsl:when test="attributes_values != ''">
-                                       <tr>
-                                               <td colspan="2" width="50%" 
align="left">                               
-                                                       <xsl:call-template 
name="attributes_form"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                       </xsl:choose>
-                       <xsl:choose>
                                <xsl:when test="member_of_list != ''">
                                <tr>
                                        <td valign="top">
@@ -370,6 +387,50 @@
                                </tr>
                                </xsl:when>
                        </xsl:choose>
+
+                                               <tr>
+                                                       <td width="19%" 
align="left" valign="top">
+                                                               <xsl:value-of 
select="lang_budget"/>
+                                                       </td>
+                                                       <td>
+                                                               <!-- DataTable 
2 EDIT -->
+                                                               <div 
id="datatable-container_3"></div>
+                                                       </td>
+                                               </tr>                           
                
+
+
+                       </table>
+                       
+                       <table cellpadding="2" cellspacing="2" width="79%" 
align="center" border="0">
+                       <tr><td><xsl:call-template 
name="attributes_values"/></td></tr>
+                       
+                       </table>
+
+
+                       <table cellpadding="2" cellspacing="2" width="79%" 
align="center" border="0">
+                               <xsl:choose>
+                                       <xsl:when test="files!=''">
+                                               <!-- <xsl:call-template 
name="file_list"/> -->                                          
+                                               <tr>
+                                                       <td width="19%" 
align="left" valign="top">
+                                                               <xsl:value-of 
select="//lang_files"/>
+                                                       </td>
+                                                       <td>
+                                                               <!-- DataTable 
2 EDIT -->
+                                                               <div 
id="datatable-container_2"></div>
+                                                       </td>
+                                               </tr>                           
                
+                                       </xsl:when>
+                               </xsl:choose>
+                               
+                               <xsl:choose>
+                                       <xsl:when test="fileupload = 1">
+                                               <xsl:call-template 
name="file_upload"/>
+                                       </xsl:when>
+                               </xsl:choose>
+                       </table>
+                       
+                       <table cellpadding="2" cellspacing="2" width="79%" 
align="center" border="0">
                        <tr height="50">
                                <td valign="bottom">
                                        <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
@@ -380,8 +441,8 @@
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
-                               </td>
-                               <td valign="bottom">
+                               <!-- </td> 
+                               <td valign="bottom">-->
                                        <xsl:variable 
name="lang_apply"><xsl:value-of select="lang_apply"/></xsl:variable>
                                        <input type="submit" 
name="values[apply]" value="{$lang_apply}" onMouseout="window.status='';return 
true;">
                                                <xsl:attribute 
name="onMouseover">
@@ -390,8 +451,8 @@
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
-                               </td>
-                               <td align="right" valign="bottom">
+                               <!-- </td> 
+                               <td valign="bottom">-->
                                        <xsl:variable 
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
                                        <input type="submit" 
name="values[cancel]" value="{$lang_cancel}" 
onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
@@ -404,21 +465,56 @@
                        </tr>
                </table>
                </form>
-               </td></tr>
-               <tr><td>
+
+
                <form method="post" name="alarm" action="{$edit_url}">
                        <input type="hidden" name="values[entity_id]" 
value="{value_s_agreement_id}" ></input>
-                       <table>
-                               <tr>
-                                       <td class="th_text" align="left" 
colspan="5">
-                                               <xsl:value-of 
select="lang_alarm"/>
-                                       </td>
-                               </tr>
-                               <xsl:call-template name="alarm_form"/>
+                  <table cellpadding="2" cellspacing="2" width="79%" 
align="center" border="0">
+                  <tr><td width="79%" class="center" 
align="left"><br/></td></tr>
+                   <tr><td width="79%" class="center" 
align="left"><xsl:value-of select="lang_alarm"/></td></tr>
+
+                     <!-- DataTable 0 EDIT -->
+                      <tr><td class="center" align="left" colspan="10"><div 
id="datatable-container_0"></div></td></tr>
+                      <tr><td class="center" align="right" colspan="10"><div 
id="datatable-buttons_0"></div></td></tr>
+                      <tr><td class="center" align="left" 
colspan="10"><xsl:value-of 
select="alarm_data/add_alarm/lang_add_alarm"/><xsl:text> : 
</xsl:text><xsl:value-of 
select="alarm_data/add_alarm/lang_day_statustext"/><xsl:value-of 
select="alarm_data/add_alarm/lang_hour_statustext"/><xsl:value-of 
select="alarm_data/add_alarm/lang_minute_statustext"/><xsl:value-of 
select="alarm_data/add_alarm/lang_user"/></td></tr>
+                      <tr><td class="center" align="left" colspan="10"><div 
id="datatable-buttons_1"></div></td></tr>
+                     <!-- <xsl:call-template name="alarm_form"/>  -->
+
                        </table>
                </form>
-               </td>
-               </tr>
+
+
+
+               </div>
+               <div id="items">
+                                       <script>
+                                               var property_js = <xsl:value-of 
select="property_js" />;
+                                               var base_java_url = 
<xsl:value-of select="base_java_url" />;
+                                               var datatable = new Array();
+                                               var myColumnDefs = new Array();
+                                               var myButtons = new Array();
+                                           var td_count = <xsl:value-of 
select="td_count" />;
+
+                                               <xsl:for-each 
select="datatable">
+                                                       datatable[<xsl:value-of 
select="name"/>] = [
+                                                       {
+                                                               values          
        :       <xsl:value-of select="values"/>,
+                                                               total_records   
:       <xsl:value-of select="total_records"/>,
+                                                               is_paginator    
:       <xsl:value-of select="is_paginator"/>,
+                                                               permission      
        :       <xsl:value-of select="permission"/>,
+                                                               footer          
        :       <xsl:value-of select="footer"/>
+                                                       }
+                                                       ]
+                                               </xsl:for-each>
+
+                                               <xsl:for-each 
select="myColumnDefs">
+                                                       
myColumnDefs[<xsl:value-of select="name"/>] = <xsl:value-of select="values"/>
+                                               </xsl:for-each>
+                                               <xsl:for-each 
select="myButtons">
+                                                       myButtons[<xsl:value-of 
select="name"/>] = <xsl:value-of select="values"/>
+                                               </xsl:for-each>
+                                       </script>
+               <table>
                <xsl:choose>
                        <xsl:when test="value_s_agreement_id!=''">
                                <tr>
@@ -452,6 +548,15 @@
                                                        </table>
                                                </form>
                                        </td>
+                                       <td class="small_text" valign="bottom" 
align="center">
+                                               <xsl:variable 
name="link_download"><xsl:value-of select="link_download"/></xsl:variable>
+                                               <xsl:variable 
name="lang_download_help"><xsl:value-of 
select="lang_download_help"/></xsl:variable>
+                                               <xsl:variable 
name="lang_download"><xsl:value-of select="lang_download"/></xsl:variable>
+                                               <a href="javascript:var 
w=window.open('{$link_download}','','')"
+                                                       
onMouseOver="overlib('{$lang_download_help}', CAPTION, '{$lang_download}')"
+                                                       onMouseOut="nd()">
+                                               <xsl:value-of 
select="lang_download"/></a>
+                                       </td>
                                </tr>
                        </xsl:when>
                </xsl:choose>
@@ -461,7 +566,47 @@
                        <xsl:variable name="update_action"><xsl:value-of 
select="update_action"/></xsl:variable>
                                <form method="post" name="form2" 
action="{$update_action}">
                                        <input type="hidden" 
name="values[agreement_id]" value="{value_s_agreement_id}" ></input>
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+
+                                       <!-- DataTable 1 EDIT -->
+                                       <div id="paging_1"> </div>
+                                       <div id="datatable-container_1"></div>
+                                       <div id="contextmenu_1"></div>
+                                       <div style="height:15px;"></div>
+                                       <div id="datatable-buttons_2" 
class="div-buttons">
+                                               <input type="text" 
id="values_date" class="calendar-opt" name="values[date]" size="10" 
value="{date}" readonly="readonly" onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                               
<xsl:text>window.status='</xsl:text>
+                                               <xsl:value-of 
select="lang_date_statustext"/>
+                                               <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                               </input>
+                                               <img id="values_date-trigger" 
class="calendar-opt" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+                                               <div 
style="width:25px;height:15px;position:relative;float:left;"></div>
+                                       </div>
+                                       <style type="text/css">
+                                               .calendar-opt
+                                               {
+                                                       position:relative;
+                                                       float:left;
+                                               }
+                                               .index-opt
+                                               {
+                                                       position:relative;
+                                                       float:left;
+                                                       margin-top:2px;
+                                               }
+                                               .div-buttons
+                                               {
+                                                       position:relative;
+                                                       float:left;
+                                                       width:750px;
+                                                       height:100px;
+                                               }
+                                       </style> 
+
+
+
+                                       <!-- table width="100%" cellpadding="2" 
cellspacing="2" align="center">
                                                <tr>
                                                        <xsl:for-each 
select="set_column" >
                                                                <td></td>
@@ -487,10 +632,12 @@
                                                                 <a 
href="javascript:check_all_checkbox2('values[select]')"><img src="{$img_check}" 
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
                                                        </td>
                                                </tr>
-                                       </table>
-                                       <table width="70%" cellpadding="2" 
cellspacing="2" align="center">
+                                       </table> -->
+
+
+                                       <!-- table width="70%" cellpadding="2" 
cellspacing="2" align="center">
                                                <xsl:apply-templates 
select="table_update"/>
-                                       </table>
+                                       </table> -->
                                </form>
                        </xsl:when>
                </xsl:choose>                                           
@@ -502,6 +649,9 @@
                        </xsl:when>
                </xsl:choose>                                           
                </div>
+               </div>
+               </div>
+
        </xsl:template>
 
 <!-- add item / edit item -->
@@ -511,8 +661,37 @@
                        self.name="first_Window";
                        <xsl:value-of select="lookup_functions"/>
                </script>
+    <script>
+      var property_js = <xsl:value-of select="property_js" />;
+      var base_java_url = <xsl:value-of select="base_java_url" />;
+      var datatable = new Array();
+      var myColumnDefs = new Array();
+      var myButtons = new Array();
+
+      <xsl:for-each select="datatable">
+        datatable[<xsl:value-of select="name"/>] = [
+        {
+          values                       :       <xsl:value-of select="values"/>,
+          total_records        :       <xsl:value-of select="total_records"/>,
+          is_paginator :       <xsl:value-of select="is_paginator"/>,
+          permission           :       <xsl:value-of select="permission"/>,
+          footer                       :       <xsl:value-of select="footer"/>
+        }
+        ]
+      </xsl:for-each>
+
+      <xsl:for-each select="myColumnDefs">
+        myColumnDefs[<xsl:value-of select="name"/>] = <xsl:value-of 
select="values"/>
+      </xsl:for-each>
+      <xsl:for-each select="myButtons">
+        myButtons[<xsl:value-of select="name"/>] = <xsl:value-of 
select="values"/>
+      </xsl:for-each>
+    </script>
+
+               <div class="yui-navset" id="edit_tabview">
+                       <div class="yui-content">
+
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
-               <div align="left">
                <form name="form" method="post" action="{$edit_url}">
                <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
                        <xsl:choose>
@@ -567,12 +746,11 @@
                                        </input>
                                </td>
                        </tr>
-
                        <xsl:choose>
-                               <xsl:when test="attributes_values != ''">
+                               <xsl:when test="attributes_group != ''">
                                        <tr>
-                                               <td colspan="2" width="50%" 
align="left">                               
-                                                       <xsl:call-template 
name="attributes_form"/>
+                                               <td colspan = '2'>
+                                               <xsl:call-template 
name="attributes_values"/>
                                                </td>
                                        </tr>
                                </xsl:when>
@@ -611,42 +789,73 @@
                        </tr>
                </table>
                </form>
+       <style type="text/css">
+               .calendar-opt
+               {
+                       position:relative;
+                       float:left;
+               }
+               .index-opt
+               {
+                       position:relative;
+                       float:left;
+                       margin-top:2px;
+               }
+               .div-buttons
+               {
+                       position:relative;
+                       float:left;
+                       width:750px;
+                       height:100px;
+               }
+       </style>
                
                <xsl:choose>
                        <xsl:when test="values != ''">
                
                                <xsl:variable 
name="update_action"><xsl:value-of select="update_action"/></xsl:variable>
+
                                <form method="post" name="form2" 
action="{$update_action}">
+
                                        <input type="hidden" 
name="values[agreement_id]" value="{value_s_agreement_id}" ></input>
                                        <input type="hidden" 
name="values[item_id]" value="{value_id}" ></input>
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
-                                               <xsl:call-template 
name="table_header"/>
-                                               <xsl:call-template 
name="values2"/>
-                                       </table>
-                                       <table width="70%" cellpadding="2" 
cellspacing="2" align="center">
-                                       <xsl:choose>
-                                               <xsl:when 
test="table_update!=''">
-                                                       <xsl:apply-templates 
select="table_update"/>
-                                               </xsl:when>
-                                       </xsl:choose>
-                                               <tr>
-                                                       <td></td><td></td>
-                                                       <td class="small_text" 
align="left">
-                                                               <a 
href="{delete_action}" 
onMouseover="window.status='{lang_delete_last_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of 
select="lang_delete_last"/></a>
-                                                       </td>
-                                               </tr>
 
+           <table cellpadding="2" cellspacing="2" width="79%" align="center" 
border="0">
+               <tr><td><br/></td></tr>
+              <!-- DataTable 0 EDIT_ITEM-->
+              <div id="contextmenu_0"></div>
+
+               <tr><td class="center" align="left" colspan="10"><div 
id="datatable-container_0"></div></td></tr>
+               <tr><td><br/></td></tr>
+               <tr><td class="center" align="left" colspan="10">
+
+              <div id="datatable-buttons_0" class="div-buttons">
+                <input type="text" class="calendar-opt" id="values_date" 
name="values[date]" size="10" value="{date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                <xsl:attribute name="onMouseover">
+                  <xsl:text>window.status='</xsl:text>
+                    <xsl:value-of select="lang_date_statustext"/>
+                  <xsl:text>'; return true;</xsl:text>
+                </xsl:attribute>
+                </input>
+                <img id="values_date-trigger" src="{img_cal}" 
alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; 
cursor:hand;" class="calendar-opt" />
+                <div 
style="width:25px;height:15px;position:relative;float:left;"></div>
+
+              </div>
+            </td></tr>
                                        </table>
                                </form>
                        </xsl:when>
                </xsl:choose>
+
+
                </div>
+               </div>
        </xsl:template>
 
 
        <xsl:template match="table_update">
                        <tr>
-                               <td>
+                               <!-- <td>
                                        <xsl:value-of select="lang_new_index"/>
                                        <input type="text" 
name="values[new_index]"  size="12" onMouseout="window.status='';return true;" >
                                                <xsl:attribute 
name="onMouseover">
@@ -655,18 +864,29 @@
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
-                               </td>
+                               </td>-->
                                <td>
-                                       <input type="text" id="values_date" 
name="values[date]" size="10" value="{date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
+                                       <!-- input type="text" id="values_date" 
name="values[date]" size="10" value="{date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
                                                <xsl:attribute 
name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>
                                                                <xsl:value-of 
select="lang_date_statustext"/>
                                                        <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
+                                       <img id="values_date-trigger" 
src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;" /-->
+                                       <div id="datatable-buttons_0">
+                                               <input type="text" 
id="values_date" name="values[date]" class="actionsFilter" size="10" 
value="{date}" readonly="readonly" onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_date_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
                                        <img id="values_date-trigger" 
src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;" />
+                                       </div>
+
                                </td>
-                               <td height="50">
+                               <!-- td height="50">
                                        <xsl:variable 
name="lang_update"><xsl:value-of select="lang_update"/></xsl:variable>
                                                <input type="submit" 
name="values[update]" value="{$lang_update}" 
onMouseout="window.status='';return true;">
                                                        <xsl:attribute 
name="onMouseover">
@@ -675,7 +895,7 @@
                                                                <xsl:text>'; 
return true;</xsl:text>
                                                        </xsl:attribute>
                                                </input>
-                               </td>
+                               </td-->
                        </tr>
        </xsl:template>
 
@@ -684,6 +904,34 @@
 
        <xsl:template match="view">
                <div align="left">
+               
+               <script>
+                               var property_js = <xsl:value-of 
select="property_js" />;
+                               var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                               var datatable = new Array();
+                               var myColumnDefs = new Array();
+                               var myButtons = new Array();
+
+                               <xsl:for-each select="datatable">
+                                       datatable[<xsl:value-of 
select="name"/>] = [
+                                       {
+                                               values                  :       
<xsl:value-of select="values"/>,
+                                               total_records   :       
<xsl:value-of select="total_records"/>,
+                                               is_paginator    :       
<xsl:value-of select="is_paginator"/>,
+                                               permission              :       
<xsl:value-of select="permission"/>,
+                                               footer                  :       
<xsl:value-of select="footer"/>
+                                       }
+                                       ]
+                               </xsl:for-each>
+
+                               <xsl:for-each select="myColumnDefs">
+                                       myColumnDefs[<xsl:value-of 
select="name"/>] = <xsl:value-of select="values"/>
+                               </xsl:for-each>
+                               <xsl:for-each select="myButtons">
+                                       myButtons[<xsl:value-of 
select="name"/>] = <xsl:value-of select="values"/>
+                               </xsl:for-each>
+               </script>
+                                                       
                <table cellpadding="2" cellspacing="2" align="center">
                        <tr><td>
                        <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
@@ -759,9 +1007,27 @@
                                                <input type="text" 
id="termination_date" name="termination_date" size="10" 
value="{value_termination_date}" readonly="readonly" 
onMouseout="window.status='';return true;" ></input>
                                        </td>
                                </tr>
+                               <tr>
+                                       <td width="19%" align="left" 
valign="top">
+                                               <xsl:value-of 
select="lang_budget"/>
+                                       </td>
+                                       <td>
+                                               <div 
id="datatable-container_3"></div>
+                                       </td>
+                               </tr>                                           
+
                                <xsl:choose>
                                        <xsl:when test="files!=''">
-                                               <xsl:call-template 
name="file_list_view"/>
+                                               <!-- <xsl:call-template 
name="file_list_view"/> -->                                     
+                                               <tr>
+                                                       <td width="19%" 
align="left" valign="top">
+                                                               <xsl:value-of 
select="//lang_files"/>
+                                                       </td>
+                                                       <td>
+                                                               <!-- DataTable 
2 VIEW -->
+                                                               <div 
id="datatable-container_2"></div>
+                                                       </td>
+                                               </tr>                           
                        
                                        </xsl:when>
                                </xsl:choose>                           
                                <xsl:choose>
@@ -798,28 +1064,46 @@
                        </table>
                        </td></tr>
                        <tr><td>
-                       <table>
+                       <table align="center">
                                <tr>
                                        <td class="th_text" align="left" 
colspan="4">
                                                <xsl:value-of 
select="lang_alarm"/>
                                        </td>
                                </tr>
-                               <xsl:call-template name="alarm_view"/>
+                               <!--  DataTable 0 VIEW -->
+                               <tr>
+                                       <td align="left" colspan="4">
+                                               <div 
id="datatable-container_0"></div>
+                                       </td>
+                               </tr>                           
+                               <!-- <xsl:call-template name="alarm_view"/> -->
                        </table>
                        </td>
                        </tr>
                        </table>
+                       <br/><br/>
                        <xsl:choose>
                                <xsl:when test="values!=''">
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
-                                               <tr><td align = "center" 
colspan="10">  
+                                       <table width="79%" cellpadding="2" 
cellspacing="2" align="center">
+                                               <tr>
+                                                       <td align="center">
                                                <xsl:value-of 
select="lang_total_records"/>
                                                <xsl:text> </xsl:text>
                                                <xsl:value-of 
select="total_records"/>
-                                               </td></tr>
-
+                                                       </td>
+                                               </tr>
+                                               <!--  DataTable 1 VIEW -->
+                                               <tr>
+                                                       <td>
+                                                               <div 
id="paging_1"> </div>
+                                                               <div 
id="datatable-container_1"></div>
+                                                               <div 
id="contextmenu_1"></div>
+                                                       </td>
+                                               </tr>
+                                               <!--                            
                
                                                <xsl:call-template 
name="table_header"/>
                                                <xsl:call-template 
name="values"/>
+                                               -->
                                        </table>
                                </xsl:when>
                        </xsl:choose>                                           
@@ -848,6 +1132,34 @@
 
        <xsl:template match="view_item">
                <div align="left">
+
+               <script>
+                               var property_js = <xsl:value-of 
select="property_js" />;
+                               var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                               var datatable = new Array();
+                               var myColumnDefs = new Array();
+                               var myButtons = new Array();
+
+                               <xsl:for-each select="datatable">
+                                       datatable[<xsl:value-of 
select="name"/>] = [
+                                       {
+                                               values                  :       
<xsl:value-of select="values"/>,
+                                               total_records   :       
<xsl:value-of select="total_records"/>,
+                                               is_paginator    :       
<xsl:value-of select="is_paginator"/>,
+                                               permission              :       
<xsl:value-of select="permission"/>,
+                                               footer                  :       
<xsl:value-of select="footer"/>
+                                       }
+                                       ]
+                               </xsl:for-each>
+
+                               <xsl:for-each select="myColumnDefs">
+                                       myColumnDefs[<xsl:value-of 
select="name"/>] = <xsl:value-of select="values"/>
+                               </xsl:for-each>
+                               <xsl:for-each select="myButtons">
+                                       myButtons[<xsl:value-of 
select="name"/>] = <xsl:value-of select="values"/>
+                               </xsl:for-each>
+               </script>
+                               
                <table cellpadding="2" cellspacing="2" width="79%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -910,9 +1222,18 @@
                        <xsl:when test="values != ''">
                
                                <xsl:variable 
name="update_action"><xsl:value-of select="update_action"/></xsl:variable>
-                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                       <table width="79%" cellpadding="2" 
cellspacing="2" align="center">
+                                               <!--  DataTable 0 VIEW ITEM -->
+                                               <tr>
+                                                       <td align="left" 
colspan="4">
+                                                               <div 
id="datatable-container_0"></div>
+                                                               <div 
id="contextmenu_0"></div>
+                                                       </td>
+                                               </tr>
+                                               <!--                            
        
                                                <xsl:call-template 
name="table_header"/>
                                                <xsl:call-template 
name="values2"/>
+                                               -->
                                        </table>
                        </xsl:when>
                </xsl:choose>
@@ -1401,3 +1722,16 @@
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
+
+       <xsl:template match="year">
+       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+               <xsl:choose>
+                       <xsl:when test="selected='selected'">
+                               <option value="{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="id"/></option>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <option value="{$id}"><xsl:value-of 
disable-output-escaping="yes" select="id"/></option>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+

Modified: people/sigurdne/modules/property/trunk/templates/base/tenant_claim.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/tenant_claim.xsl      
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/tenant_claim.xsl      
2009-11-20 10:29:01 UTC (rev 20848)
@@ -160,7 +160,6 @@
 <!-- add / edit -->
 
        <xsl:template match="edit">
-
                <script language="JavaScript">
                        self.name="first_Window";
                        function tenant_lookup()
@@ -169,8 +168,11 @@
                        }               
                </script>
 
+               <div class="yui-navset" id="edit_tabview">
+                       <div class="yui-content">
+
+
                <xsl:variable name="edit_url"><xsl:value-of 
select="edit_url"/></xsl:variable>
-               <div align="left">
                <form name="form" method="post" action="{$edit_url}">
                <table cellpadding="2" cellspacing="2" width="79%" align="left">
                        <xsl:choose>
@@ -325,38 +327,9 @@
                        </tr>
 
                        <tr>
-                               <xsl:choose>
-                                       <xsl:when 
test="sum_workorder_budget=''">
-                                               <td class="th_text">
-                                                       <xsl:value-of 
select="lang_no_workorders"/>
+                       <td colspan ='2'>
+                          <div id="datatable-container_0"></div>
                                                </td>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                       <td colspan="2">
-                                       <table width="80%" cellpadding="2" 
cellspacing="2" align="left">
-                                               <xsl:apply-templates 
select="table_header_workorder"/>
-                                               <xsl:apply-templates 
select="workorder_budget"/>
-                                               <tr class="th">
-                                                       <td class="th_text" 
align="right">
-                                                               <xsl:value-of 
select="lang_sum"/>
-                                                       </td>
-                                                       <td class="th_text"  
align="right">
-                                                               <xsl:value-of 
select="sum_workorder_budget"/>
-                                                       </td>
-                                                       <td class="th_text"  
align="right">
-                                                               <xsl:value-of 
select="sum_workorder_calculation"/>
-                                                       </td>
-                                                       <td>
-                                                       </td>
-                                                       <td>
-                                                       </td>
-                                                       <td>
-                                                       </td>
-                                               </tr>
-                                       </table>
-                                       </td>
-                                       </xsl:otherwise>
-                               </xsl:choose>
                        </tr>
 
                        <tr>
@@ -512,6 +485,30 @@
                        </tr>
                </table>
                </form>
+
+                               <script>
+                                       var property_js = <xsl:value-of 
select="property_js" />;
+                                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                                       var datatable = new Array();
+                                       var myColumnDefs = new Array();
+
+                                       <xsl:for-each select="datatable">
+                                               datatable[<xsl:value-of 
select="name"/>] = [
+                                               {
+                                                       values                  
:       <xsl:value-of select="values"/>,
+                                                       total_records   :       
<xsl:value-of select="total_records"/>,
+                                                       is_paginator    :       
<xsl:value-of select="is_paginator"/>,
+                                                       footer                  
:       <xsl:value-of select="footer"/>,
+                                                       edit_action             
:       <xsl:value-of select="edit_action"/>
+                                               }
+                                               ]
+                                       </xsl:for-each>
+
+                                       <xsl:for-each select="myColumnDefs">
+                                               myColumnDefs[<xsl:value-of 
select="name"/>] = <xsl:value-of select="values"/>
+                                       </xsl:for-each>
+                               </script>
+                       </div>
                </div>
        </xsl:template>
 
@@ -902,3 +899,4 @@
 
                        </tr>
        </xsl:template>
+

Modified: people/sigurdne/modules/property/trunk/templates/base/tts.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/tts.xsl       
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/tts.xsl       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -11,7 +11,7 @@
                        <xsl:when test="view">
                                <xsl:apply-templates select="view"/>
                        </xsl:when>
-                       <xsl:when test="view">
+                       <xsl:when test="view2">
                                <xsl:apply-templates select="view2"/>
                        </xsl:when>
                        <xsl:when test="list2">
@@ -389,8 +389,6 @@
 <!-- add -->
 
        <xsl:template match="add">
-               <div align="left">              
-               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -402,6 +400,11 @@
                        </xsl:choose>
                        <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
                        <form ENCTYPE="multipart/form-data" name="form" 
method="post" action="{$form_action}">
+                               <div class="yui-navset" id="ticket_tabview">
+                                       <div class="yui-content">
+
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+
                                <xsl:for-each select="value_origin" >
                                        <tr>
                                                <td valign ="top">
@@ -411,9 +414,9 @@
                                                        <table>                 
                                
                                                                <xsl:for-each 
select="data">
                                                                        <tr>
-                                                                               
<td class="th_text"  align="left" >
+                                                                               
<td align="left" >
                                                                                
        <xsl:variable name="link_request"><xsl:value-of 
select="//link_request"/>&amp;id=<xsl:value-of select="id"/></xsl:variable>
-                                                                               
        <a href="{link}"  title="{//lang_origin_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                               
        <a href="{link}"  title="{//lang_origin_statustext}"><xsl:value-of 
select="id"/></a>
                                                                                
        <xsl:text> </xsl:text>
                                                                                
</td>
                                                                        </tr>
@@ -426,14 +429,18 @@
                                <input type="hidden" name="values[origin_id]" 
value="{value_origin_id}"></input>
                                
                        <xsl:call-template name="location_form"/>
+
                        <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_assign_to"/>
+                               <td>
+                                       <xsl:value-of select="lang_category"/>
                                </td>
                                <td>
-                                       <xsl:call-template 
name="user_id_select"/>
+                                       <xsl:call-template name="categories"/>
                                </td>
                        </tr>
+
+                       <xsl:choose>
+                               <xsl:when test="simple !='1'">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_group"/>
@@ -442,7 +449,15 @@
                                        <xsl:call-template name="group_select"/>
                                </td>
                        </tr>
-
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_assign_to"/>
+                               </td>
+                               <td>
+                                       <xsl:call-template 
name="user_id_select"/>
+                               </td>
+                       </tr>
+                       <xsl:call-template name="contact_form"/>        
                        <xsl:choose>
                                <xsl:when test="mailnotification != ''">
                                        <tr>
@@ -475,6 +490,7 @@
                                </xsl:when>
                        </xsl:choose>
 
+
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_priority"/>
@@ -482,21 +498,15 @@
                                <td>
                                <xsl:variable 
name="lang_priority_statustext"><xsl:value-of 
select="lang_priority_statustext"/></xsl:variable>
                                <xsl:variable 
name="select_priority_name"><xsl:value-of 
select="select_priority_name"/></xsl:variable>
-                                       <select name="{$select_priority_name}" 
class="forms" onMouseover="window.status='{$lang_priority_statustext}'; return 
true;" onMouseout="window.status='';return true;">
+                                       <select name="{$select_priority_name}" 
onMouseover="window.status='{$lang_priority_statustext}'; return true;" 
onMouseout="window.status='';return true;">
                                                        <xsl:apply-templates 
select="priority_list"/>
                                        </select>                       
                                </td>
                        </tr>
+                       <xsl:choose>
+                               <xsl:when test="show_finnish_date ='1'">
                        <tr>
                                <td>
-                                       <xsl:value-of select="lang_category"/>
-                               </td>
-                               <td>
-                                       <xsl:call-template name="categories"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
                                        <xsl:value-of 
select="lang_finnish_date"/>
                                </td>
                                <td>
@@ -504,25 +514,25 @@
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="lang_finnish_date_statustext"/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                        <img id="values_finnish_date-trigger" 
src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;" />
                                </td>
                        </tr>
+                       </xsl:when>
+                       </xsl:choose>
 
+                       </xsl:when>
+                       </xsl:choose>
 
+
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_subject"/>
                                </td>
                                <td>
                                        <input type="text" 
name="values[subject]" value="{value_subject}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_subject_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
 
@@ -563,38 +573,35 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-
+               </table>
+</div>
+               <table cellpadding="2" cellspacing="2" width="50%" 
align="center">
                        <tr height="50">
                                <td>
-                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
-                                       <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                       <input type="submit" 
name="values[save]" value="{lang_send}">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_send_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                               <td>
+                                       <input type="submit" 
name="values[apply]" value="{lang_save}">
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_save_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
-                       </tr>
-                       </form>
-                       <tr>
                                <td>
-                                       <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
-                                       <form method="post" 
action="{$done_action}">
-                                               <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_done_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
+                                       <input type="submit" 
name="values[cancel]" value="{lang_cancel}">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_cancel_statustext"/>
                                                        </xsl:attribute>
                                                </input>
-                                       </form>
                                </td>
                        </tr>
                </table>
-               </div>
-
+</div>
+                       </form>
        </xsl:template>
 
 <!-- add2 -->
@@ -618,35 +625,12 @@
 
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_priority"/>
-                               </td>
-                               <td>
-                               <xsl:variable 
name="lang_priority_statustext"><xsl:value-of 
select="lang_priority_statustext"/></xsl:variable>
-                               <xsl:variable 
name="select_priority_name"><xsl:value-of 
select="select_priority_name"/></xsl:variable>
-                                       <select name="{$select_priority_name}" 
class="forms" onMouseover="window.status='{$lang_priority_statustext}'; return 
true;" onMouseout="window.status='';return true;">
-                                                       <xsl:apply-templates 
select="priority_list"/>
-                                       </select>                       
-                               </td>
-                       </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of select="lang_category"/>
-                               </td>
-                               <td>
-                                       <xsl:call-template name="categories"/>
-                               </td>
-                       </tr>
-
-                       <tr>
-                               <td valign="top">
                                        <xsl:value-of 
select="lang_contact_phone"/>
                                </td>
                                <td>
                                        <input type="text" 
name="values[extra][contact_phone]" value="{value_contact_phone}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_contact_phone_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
@@ -657,10 +641,8 @@
                                </td>
                                <td>
                                        <input type="text" 
name="values[extra][contact_email]" value="{value_contact_email}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
+                                               <xsl:attribute name="title">
                                                                <xsl:value-of 
select="lang_contact_email_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
                                                </xsl:attribute>
                                        </input>
                                </td>
@@ -759,7 +741,7 @@
        </xsl:template>
 
 <!-- view -->
-       <xsl:template match="view">
+       <xsl:template match="view" xmlns:php="http://php.net/xsl";>
                <script language="JavaScript">
                        self.name="first_Window";
                        function generate_order()
@@ -771,9 +753,7 @@
                                Window1=window.open('<xsl:value-of 
select="request_link"/>');
                        }               
                </script>
-               <div align="left">
-               
-               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+               <table cellpadding="2" cellspacing="2" width="95%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
@@ -783,19 +763,23 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
+               </table>
                        <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
                        <form ENCTYPE="multipart/form-data" name="form" 
method="post" action="{$form_action}">
+                               <div class="yui-navset" id="ticket_tabview">
+                                       <xsl:value-of 
disable-output-escaping="yes" select="tabs" />
+                                       <div class="yui-content">
+<div id="general">
+               <table cellpadding="2" cellspacing="2" width="95%" 
align="center">
                        <tr class="th">
                                <td class="th_text" valign="top">
-                                       <xsl:value-of select="lang_ticket"/>
+                                       <xsl:value-of 
select="php:function('lang', 'Ticket')" />
                                </td>
                                <td class="th_text" valign="top">
                                        <xsl:value-of select="value_id"/>
-                                       <input type="text" 
name="values[subject]" value="{value_subject}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_subject_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                                       <input type="text" 
name="values[subject]" value="{value_subject}">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'update subject')" />
                                                </xsl:attribute>
                                        </input>
                                </td>
@@ -810,7 +794,7 @@
                                                        <xsl:for-each 
select="data">
                                                                <tr>
                                                                        <td 
class="th_text"  align="left" >
-                                                                               
<a href="{link}"  title="{//lang_target_statustext}" style 
="cursor:help"><xsl:value-of select="id"/></a>
+                                                                               
<a href="{link}"  title="{statustext}"><xsl:value-of select="id"/></a>
                                                                                
<xsl:text> </xsl:text>
                                                                        </td>
                                                                </tr>
@@ -819,12 +803,20 @@
                                        </td>
                                </tr>
                        </xsl:for-each>
+                       <xsl:choose>
+                               <xsl:when test="lookup_type ='view'">
                        <xsl:call-template name="location_view"/>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:call-template 
name="location_form"/>
+                               </xsl:otherwise>
+                       </xsl:choose>
+
                        <xsl:choose>
                                <xsl:when test="contact_phone !=''">
                                        <tr>
                                                <td class="th_text"  
align="left">
-                                                       <xsl:value-of 
select="lang_contact_phone"/>
+                                                       <xsl:value-of 
select="php:function('lang', 'Contact phone')" />
                                                </td>
                                                <td  align="left">
                                                        <xsl:value-of 
select="contact_phone"/>                                  
@@ -833,9 +825,10 @@
                                </xsl:when>
                        </xsl:choose>
 
+<!--
                        <tr>
                                <td class="th_text" valign="top">
-                                       <xsl:value-of select="lang_opendate"/>
+                                       <xsl:value-of 
select="php:function('lang', 'Open Date')" />
                                </td>
                                <td valign="top">
                                        <xsl:value-of select="value_opendate"/>
@@ -843,36 +836,23 @@
                        </tr>
                        <tr>
                                <td class="th_text" valign="top">
-                                       <xsl:value-of 
select="lang_assignedfrom"/>
+                                       <xsl:value-of 
select="php:function('lang', 'Assigned from')" />
                                </td>
                                <td valign="top">
                                        <xsl:value-of 
select="value_assignedfrom"/>
                                </td>
                        </tr>
+
                        <tr>
                                <td class="th_text" valign="top">
-                                       <xsl:value-of select="lang_assignedto"/>
+                                       <xsl:value-of 
select="php:function('lang', 'Assigned to')" />
                                </td>
                                <td valign="top">
-                                       <xsl:value-of 
select="value_assignedto"/>
+                                       <xsl:value-of 
select="value_assignedto_name"/>
                                </td>
                        </tr>
-                       <tr>
-                               <td class="th_text" valign="top">
-                                       <xsl:value-of select="lang_priority"/>
-                               </td>
-                               <td valign="top">
-                                       <xsl:value-of select="value_priority"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td class="th_text" valign="top">
-                                       <xsl:value-of select="lang_category"/>
-                               </td>
-                               <td valign="top">
-                                       <xsl:value-of 
select="value_category_name"/>
-                               </td>
-                       </tr>
+-->
+                       <xsl:call-template name="contact_form"/>
 
                        <xsl:for-each select="value_target" >
                                <tr>
@@ -881,80 +861,99 @@
                                        </td>
                                                <td class="th_text"  
align="left" >
                                                <xsl:for-each select="data">
-                                                       <a href="{link}"  
title="{//lang_target_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
+                                                       <a href="{link}"  
title="{statustext}"><xsl:value-of select="id"/></a>
                                                        <xsl:text> </xsl:text>
                                                </xsl:for-each>
                                        </td>
                                </tr>
                        </xsl:for-each>
 
+<!--
                        <tr>
                                <td class="th_text" valign="top">
-                                       <xsl:value-of select="lang_details"/>
+                                       <xsl:value-of 
select="php:function('lang', 'details')" />
                                </td>
                                <td valign="top">
                                        <xsl:value-of select="value_details"/>
                                </td>
                        </tr>
+
+-->
                        <tr>
                                <td class="th_text" valign="top">
-                                       <xsl:value-of 
select="lang_additional_notes"/>
+                                       <xsl:value-of 
select="php:function('lang', 'details')" />
                                </td>
                                <xsl:choose>
                                        <xsl:when test="additional_notes=''">
                                                <td class="th_text">
-                                                       <xsl:value-of 
select="lang_no_additional_notes"/>
+                                                       <xsl:value-of 
select="php:function('lang', 'no additional notes')" />
                                                </td>
                                        </xsl:when>
                                        <xsl:otherwise>
                                        <td>
                                        <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
-                                               <xsl:apply-templates 
select="table_header_additional_notes"/>
-                                               <xsl:apply-templates 
select="additional_notes"/>
+                                               <!--  DATATABLE 0-->
+                                               <!--  <xsl:apply-templates 
select="table_header_additional_notes"/><xsl:apply-templates 
select="additional_notes"/>-->
+                                               <td><div 
id="paging_0"></div><div id="datatable-container_0"></div> </td>
                                        </table>
                                        </td>
                                        </xsl:otherwise>
                                </xsl:choose>
                        </tr>
+               <xsl:choose>
+               <xsl:when test="simple !='1'">
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_assignedto"/>
+                                       <xsl:value-of 
select="php:function('lang', 'group')" />
                                </td>
                                <td>
+                                       <xsl:call-template name="group_select"/>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="php:function('lang', 'assigned to')" />
+                               </td>
+                               <td>
                                        <xsl:call-template 
name="user_id_select"/>
                                </td>
                        </tr>
+                       <xsl:choose>
+                               <xsl:when test="lang_takeover != ''">
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_group"/>
+                                                       <xsl:value-of 
select="lang_takeover"/>
                                </td>
                                <td>
-                                       <xsl:call-template name="group_select"/>
+                                                       <input type="checkbox" 
name="values[takeover]" value="1">
+                                                               <xsl:attribute 
name="title">                            
+                                                                       
<xsl:value-of select="php:function('lang', 'Take over the assignment for this 
ticket')" />
+                                                               </xsl:attribute>
+                                                       </input>
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
+
                        <xsl:choose>
                                <xsl:when test="mailnotification != ''">
                                        <tr>
                                                <td>
-                                                       <xsl:value-of 
select="lang_mailnotification"/>
+                                                       <xsl:value-of 
select="php:function('lang', 'Send e-mail')" />
                                                </td>
                                                <td>
                                                        <xsl:choose>
                                                                        
<xsl:when test="pref_send_mail = 1">
-                                                                               
<input type="checkbox" name="values[send_mail]" value="1" checked="checked" 
onMouseout="window.status='';return true;">
-                                                                               
        <xsl:attribute name="onMouseover">
-                                                                               
                <xsl:text>window.status='</xsl:text>
-                                                                               
                        <xsl:value-of 
select="lang_mailnotification_statustext"/>
-                                                                               
                <xsl:text>'; return true;</xsl:text>
+                                                                               
<input type="checkbox" name="values[send_mail]" value="1" checked="checked">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="php:function('lang', 'Choose to send 
mailnotification')" />
                                                                                
        </xsl:attribute>
                                                                                
</input>
                                                                        
</xsl:when>
                                                                        
<xsl:otherwise>
-                                                                               
<input type="checkbox" name="values[send_mail]" value="1" 
onMouseout="window.status='';return true;">
-                                                                               
        <xsl:attribute name="onMouseover">
-                                                                               
                <xsl:text>window.status='</xsl:text>
-                                                                               
                        <xsl:value-of 
select="lang_mailnotification_statustext"/>
-                                                                               
                <xsl:text>'; return true;</xsl:text>
+                                                                               
<input type="checkbox" name="values[send_mail]" value="1">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="php:function('lang', 'Choose to send 
mailnotification')" />
                                                                                
        </xsl:attribute>
                                                                                
</input>
                                                                        
</xsl:otherwise>
@@ -966,62 +965,79 @@
 
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_priority"/>
+                                       <xsl:value-of 
select="php:function('lang', 'Priority')" />
                                </td>
                                <td>
-                               <xsl:variable 
name="lang_priority_statustext"><xsl:value-of 
select="lang_priority_statustext"/></xsl:variable>
+                               <xsl:variable 
name="lang_priority_statustext"><xsl:value-of select="php:function('lang', 
'Select the priority the selection belongs to')" /></xsl:variable>
                                <xsl:variable 
name="select_priority_name"><xsl:value-of 
select="select_priority_name"/></xsl:variable>
-                                       <select name="{$select_priority_name}" 
class="forms" onMouseover="window.status='{$lang_priority_statustext}'; return 
true;" onMouseout="window.status='';return true;">
+                                       <select name="{$select_priority_name}" 
class="forms" title = "{$lang_priority_statustext}" 
onMouseover="window.status='{$lang_priority_statustext}'; return true;" 
onMouseout="window.status='';return true;">
                                                        <xsl:apply-templates 
select="priority_list"/>
                                        </select>                       
                                </td>
                        </tr>
+                       <xsl:choose>
+                               <xsl:when test="value_order_id=''">
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_status"/>
+                                       <xsl:value-of 
select="php:function('lang', 'status')" />
                                </td>
                                <td>
-                               <xsl:variable 
name="lang_status_statustext"><xsl:value-of 
select="lang_status_statustext"/></xsl:variable>
                                <xsl:variable name="status_name"><xsl:value-of 
select="status_name"/></xsl:variable>
-                                       <select name="{$status_name}" 
class="forms" onMouseover="window.status='{$lang_status_statustext}'; return 
true;" onMouseout="window.status='';return true;">
+                                                       <select 
name="{$status_name}" class="forms">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'Set the status of the ticket')" />
+                                                               </xsl:attribute>
                                                        <xsl:apply-templates 
select="status_list"/>
                                        </select>                       
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
                        <tr>
                                <td>
-                                       <xsl:value-of select="lang_category"/>
+                                       <xsl:value-of 
select="php:function('lang', 'category')" />
                                </td>
                                <td>
                                        <xsl:call-template name="categories"/>
                                </td>
                        </tr>
+                       <xsl:choose>
+                               <xsl:when test="show_finnish_date ='1'">
                        <tr>
                                <td>
-                                       <xsl:value-of 
select="lang_finnish_date"/>
+                                       <xsl:value-of 
select="php:function('lang', 'finnish date')" />
                                </td>
                                <td>
                                        <input type="text" 
id="values_finnish_date" name="values[finnish_date]" size="10" 
value="{value_finnish_date}" readonly="readonly" 
onMouseout="window.status='';return true;" >
                                                <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="lang_finnish_date_statustext"/>
+                                                       <xsl:value-of 
select="php:function('lang', 'select the estimated date for closing the task')" 
/>
                                                </xsl:attribute>
-                                               <xsl:attribute name="style">
-                                                       
<xsl:text>cursor:help</xsl:text>
-                                               </xsl:attribute>
                                        </input>
                                        <img id="values_finnish_date-trigger" 
src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;" />
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
+
+               </xsl:when>
+               <xsl:otherwise>
+                               <input type="hidden" name="values[status]" 
value="{value_status}"></input>
+                               <input type="hidden" name="values[assignedto]" 
value="{value_assignedto_id}"></input>
+                               <input type="hidden" name="values[group_id]" 
value="{value_group_id}"></input>
+                               <input type="hidden" name="values[priority]" 
value="{value_priority}"></input>
+                               <input type="hidden" name="values[cat_id]" 
value="{value_cat_id}"></input>
+                               <input type="hidden" 
name="values[finnish_date]" value="{value_finnish_date}"></input>
+                       </xsl:otherwise>
+       </xsl:choose>
+
                        <tr>
                                <td valign="top">
-                                       <xsl:value-of select="lang_new_note"/>
+                       <xsl:value-of select="php:function('lang', 'new note')" 
/>
                                </td>
                                <td>
-                                       <textarea cols="60" rows="10" 
name="values[note]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_details_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                                       <textarea cols="{textareacols}" 
rows="{textarearows}" name="values[note]" wrap="virtual">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'add new comments')" />
                                                </xsl:attribute>
                                        </textarea>
 
@@ -1030,7 +1046,15 @@
 
                        <xsl:choose>
                                <xsl:when test="files!=''">
-                                       <xsl:call-template name="file_list"/>
+                                       <!-- <xsl:call-template 
name="file_list"/> -->                                          
+                                       <tr>
+                                               <td width="19%" align="left" 
valign="top">
+                                                       <xsl:value-of 
select="php:function('lang', 'files')" />
+                                               </td>
+                                               <td>
+                                                       <div 
id="datatable-container_2"></div>
+                                               </td>
+                                       </tr>   
                                </xsl:when>
                        </xsl:choose>
 
@@ -1040,29 +1064,181 @@
                                </xsl:when>
                        </xsl:choose>
 
+                       <xsl:choose>
+                               <xsl:when test="access_order = 1">
+                                       <xsl:choose>
+                                               <xsl:when 
test="value_order_id=''">
+                                                       <tr>
+                                                               <td>
+                                                           <xsl:value-of 
select="php:function('lang', 'make order')" />
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="checkbox" name="values[make_order]" value="True">
+                                                                               
<xsl:attribute name="title">
+                                                                           
<xsl:value-of select="php:function('lang', 'make order')" />
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:when>
+                                       </xsl:choose>
+
+                                       <xsl:choose>
+                                               <xsl:when 
test="value_order_id!=''">
+                                               <tr class="th">
+                                                       <td class="th_text">
+                                                   <xsl:value-of 
select="php:function('lang', 'order id')" />
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
select="value_order_id"/>
+                                                       </td>
+                                               </tr>
+
+                                               <xsl:call-template 
name="vendor_form"/>
+                                               <xsl:call-template 
name="ecodimb_form"/>
+                                               <xsl:call-template 
name="b_account_form"/>
+
+                                               <tr>
+                                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'cost estimate')" />
+                                                       </td>
+                                                       <td>
+                                                               <input 
type="text" name="values[budget]" value="{value_budget}">
+                                                                       
<xsl:attribute name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'Enter the budget')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <xsl:text> 
</xsl:text> [ <xsl:value-of select="currency"/> ]
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                                   <xsl:value-of 
select="php:function('lang', 'actual cost')" />
+                                                       </td>
+                                                       <td>
+                                                               <xsl:value-of 
select="value_actual_cost"/>
+                                                               <xsl:text> 
</xsl:text> [ <xsl:value-of select="currency"/> ]
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'description')" />
+                                                       </td>
+                                                       <td>
+                                                               <textarea 
cols="{textareacols}" rows="{textarearows}" name="values[order_descr]" 
wrap="virtual">
+                                                                       
<xsl:attribute name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'description order')" />
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:value-of select="value_order_descr"/>
+                                                               </textarea>
+                                                       </td>
+                                               </tr>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="need_approval='1'">
+                                                               <tr>
+                                                                       <td 
valign="top">
+                                                               <xsl:value-of 
select="php:function('lang', 'ask for approval')" />
+                                                                       </td>
+                                                                       <td>
+                                                                               
<table>
+                                                                               
        <xsl:for-each select="value_approval_mail_address" >
+                                                                               
                <tr>
+                                                                               
                        <td>
+                                                                               
                                <input type="checkbox" 
name="values[approval][{id}]" value="True">
+                                                                               
                                        <xsl:attribute name="title">
+                                                                               
                                                <xsl:value-of 
select="//lang_ask_approval_statustext"/>
+                                                                               
                                        </xsl:attribute>
+                                                                               
                                </input>
+                                                                               
                        </td>
+                                                                               
                        <td valign='top'>
+                                                                               
                                <xsl:value-of select="address"/>
+                                                                               
                                <input type="hidden" 
name="values[mail_address][{id}]" value="{address}">
+                                                                               
                                </input>
+                                                                               
                        </td>
+                                                                               
                </tr>
+                                                                               
        </xsl:for-each>
+                                                                               
</table>
+                                                                       </td>
+                                                               </tr>
+                                                       </xsl:when>
+                                               </xsl:choose>
+                                               <tr>
+                                                       <td>
+                                                   <xsl:value-of 
select="php:function('lang', 'send order')" />
+                                                       </td>
+                                                       <td>
+                                                               <table>
+                                                                       <tr>
+                                                                               
<td>
+                                                                               
        <input type="checkbox" name="values[send_order]" value="True">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
            <xsl:value-of select="php:function('lang', 'send order')" />
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+                                                                               
</td>
+                                                                               
<td>                                                                            
            
+                                                                               
        <select name="values[vendor_email]">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
            <xsl:value-of select="php:function('lang', 'The address to which 
this order will be sendt')" />
+                                                                               
                </xsl:attribute>
+                                                                               
                <option value="">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'select 
email')" />
+                                                                               
                </option>
+                                                                               
                <xsl:apply-templates select="vendor_email"/>
+                                                                               
        </select>
+                                                                               
</td>
+                                                                       </tr>
+                                                               </table>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td valign="top">
+                                               <xsl:value-of 
select="php:function('lang', 'status')" />
+                                                       </td>
+                                                       <td>
+                                                               <xsl:variable 
name="status_name"><xsl:value-of select="status_name"/></xsl:variable>
+                                                               <select 
name="{$status_name}" class="forms">
+                                                                       
<xsl:attribute name="title">
+                                                                               
<xsl:value-of select="php:function('lang', 'Set the status of the ticket')" />
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:apply-templates select="status_list"/>
+                                                               </select>       
                
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
+                       </xsl:when>
+               </xsl:choose>
+               </table>
+</div>
+<div id="history">
+                               <div id="paging_1"></div>
+                               <div id="datatable-container_1"></div>  
+</div>
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr height="50">
                                <td>
-                                       <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+                                       <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
                                        <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_save_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'save the ticket')" />
                                                </xsl:attribute>
                                        </input>
                                </td>
                        </tr>
+               </table>
+</div>
+</div>
                        </form>
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td>
                                        <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
-                                       <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+                                       <xsl:variable 
name="lang_done"><xsl:value-of select="php:function('lang', 'done')" 
/></xsl:variable>
                                        <form method="post" 
action="{$done_action}">
                                                <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
-                                                                       
<xsl:value-of select="lang_done_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'Back to the ticket list')" />
                                                        </xsl:attribute>
                                                </input>
                                        </form>
@@ -1072,32 +1248,50 @@
                <hr noshade="noshade" width="100%" align="center" size="1"/>
                <table width="80%" cellpadding="2" cellspacing="2" 
align="center">
                        <tr>
+                       <xsl:choose>
+                               <xsl:when test="request_link != ''">
                                <td valign="top">
                                        <xsl:variable 
name="request_link"><xsl:value-of select="request_link"/></xsl:variable>
                                        <form method="post" 
action="{$request_link}">
-                                       <xsl:variable 
name="lang_generate_request"><xsl:value-of 
select="lang_generate_request"/></xsl:variable>
+                                       <xsl:variable 
name="lang_generate_request"><xsl:value-of select="php:function('lang', 
'Generate Request')" /></xsl:variable>
                                        <input type="submit" name="location" 
value="{$lang_generate_request}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_generate_request_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'click this to generate a request with this 
information')" />
                                                </xsl:attribute>
                                        </input>
                                        </form>
                                </td>
+                               </xsl:when>
+                       </xsl:choose>
+
+                       <xsl:choose>
+                               <xsl:when test="order_link != ''">
+
                                <td valign="top">
                                        <xsl:variable 
name="order_link"><xsl:value-of select="order_link"/></xsl:variable>
                                        <form method="post" 
action="{$order_link}">
-                                       <xsl:variable 
name="lang_generate_order"><xsl:value-of 
select="lang_generate_order"/></xsl:variable>
-                                       <input type="submit" name="location" 
value="{$lang_generate_order}" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_generate_order_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
+                                       <xsl:variable 
name="lang_generate_project"><xsl:value-of select="php:function('lang', 
'generate new project')" /></xsl:variable>
+                                       <input type="submit" name="location" 
value="{$lang_generate_project}" onMouseout="window.status='';return true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'click this to generate a project with this 
information')" />
                                                </xsl:attribute>
                                        </input>
                                        </form>
                                </td>
+                               <td valign="top">
+                                       <xsl:variable 
name="add_to_project_link"><xsl:value-of 
select="add_to_project_link"/></xsl:variable>
+                                       <form method="post" 
action="{$add_to_project_link}">
+                                       <xsl:variable 
name="lang_add_to_project"><xsl:value-of select="php:function('lang', 'add to 
project')" /></xsl:variable>
+                                       <input type="submit" name="location" 
value="{$lang_add_to_project}" onMouseout="window.status='';return true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'click this to add an order to an existing 
project')" />
+                                               </xsl:attribute>
+                                       </input>
+                                       </form>
+                               </td>
+                               </xsl:when>
+                       </xsl:choose>
+
                                <xsl:choose>
                                        <xsl:when test="link_entity!=''">
                                                <xsl:for-each 
select="link_entity" >
@@ -1106,10 +1300,8 @@
                                                        <form method="post" 
action="{$link}">
                                                        <xsl:variable 
name="name"><xsl:value-of select="name"/></xsl:variable>
                                                        <input type="submit" 
name="location" value="{$name}" onMouseout="window.status='';return true;">
-                                                               <xsl:attribute 
name="onMouseover">
-                                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:attribute 
name="title">
                                                                                
<xsl:value-of select="lang_start_statustext"/>
-                                                                       
<xsl:text>'; return true;</xsl:text>
                                                                </xsl:attribute>
                                                        </input>
                                                        </form>
@@ -1121,23 +1313,31 @@
                </table>
 
                <hr noshade="noshade" width="100%" align="center" size="1"/>
-               <table width="80%" cellpadding="2" cellspacing="2" 
align="center">
-                       <xsl:choose>
-                               <xsl:when test="record_history=''">
-                                       <tr>
-                                               <td class="th_text" 
align="center">
-                                                       <xsl:value-of 
select="lang_no_history"/>
-                                               </td>
-                                       </tr>
-                               </xsl:when>
-                               <xsl:otherwise>
-                                       <xsl:apply-templates 
select="table_header_history"/>
-                                       <xsl:apply-templates 
select="record_history"/>
-                               </xsl:otherwise>
-                       </xsl:choose>
-               </table>
-               </div>
-               <hr noshade="noshade" width="100%" align="center" size="1"/>
+               
+               <!--  DATATABLE DEFINITIONS-->
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+       
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+                       
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>       
+        
+               
+       
        </xsl:template>
 
 <!-- view2 -->
@@ -1217,7 +1417,7 @@
                                        <xsl:value-of select="lang_assignedto"/>
                                </td>
                                <td valign="top">
-                                       <xsl:value-of 
select="value_assignedto"/>
+                                       <xsl:value-of 
select="value_assignedto_name"/>
                                </td>
                        </tr>
                        <tr>
@@ -1244,7 +1444,7 @@
                                        </td>
                                                <td class="th_text"  
align="left" >
                                                <xsl:for-each select="data">
-                                                       <a href="{link}"  
title="{//lang_origin_statustext}" style ="cursor:help"><xsl:value-of 
select="id"/></a>
+                                                       <a href="{link}"  
title="{statustext}"><xsl:value-of select="id"/></a>
                                                        <xsl:text> </xsl:text>
                                                </xsl:for-each>
                                        </td>
@@ -1262,7 +1462,7 @@
                                        <xsl:for-each select="link_info" >
                                                <xsl:variable 
name="link_entity_origin"><xsl:value-of select="link"/>&amp;id=<xsl:value-of 
select="id"/></xsl:variable>
                                                <xsl:variable 
name="lang_entity_statustext"><xsl:value-of select="entry_date"/></xsl:variable>
-                                               <a href="{$link_entity_origin}" 
onMouseover="window.status='{$lang_entity_statustext}';return true;" 
onMouseout="window.status='';return true;"><xsl:value-of select="id"/></a>
+                                               <a href="{$link_entity_origin}" 
title="{statustext}" onMouseout="window.status='';return true;"><xsl:value-of 
select="id"/></a>
                                                <xsl:text> </xsl:text>
                                        </xsl:for-each>
                                </td>
@@ -1297,6 +1497,7 @@
                                        </xsl:otherwise>
                                </xsl:choose>
                        </tr>
+<!--
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_priority"/>
@@ -1321,7 +1522,7 @@
                                        </select>                       
                                </td>
                        </tr>
-<!--                   <tr>
+                       <tr>
                                <td>
                                        <xsl:value-of select="lang_category"/>
                                </td>
@@ -1329,7 +1530,7 @@
                                        <xsl:call-template name="categories"/>
                                </td>
                        </tr>
--->
+
                        <tr>
                                <td>
                                        <xsl:value-of 
select="lang_finnish_date"/>
@@ -1348,6 +1549,7 @@
                                        [<xsl:value-of 
select="lang_dateformat"/>]
                                </td>
                        </tr>
+-->
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_new_note"/>
@@ -1531,3 +1733,15 @@
                </xsl:choose>
        </xsl:template>
 
+       <xsl:template match="vendor_email">
+       <xsl:variable name="email"><xsl:value-of select="email"/></xsl:variable>
+               <xsl:choose>
+                       <xsl:when test="selected">
+                               <option value="{$email}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="email"/></option>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <option value="{$email}"><xsl:value-of 
disable-output-escaping="yes" select="email"/></option>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
+

Modified: 
people/sigurdne/modules/property/trunk/templates/base/user_id_select.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/user_id_select.xsl    
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/user_id_select.xsl    
2009-11-20 10:29:01 UTC (rev 20848)
@@ -3,7 +3,7 @@
        <xsl:template name="user_id_select">
        <xsl:variable name="lang_user_statustext"><xsl:value-of 
select="lang_user_statustext"/></xsl:variable>
        <xsl:variable name="select_user_name"><xsl:value-of 
select="select_user_name"/></xsl:variable>
-               <select name="{$select_user_name}" class="forms" 
onMouseover="window.status='{$lang_user_statustext}'; return true;" 
onMouseout="window.status='';return true;">
+               <select name="{$select_user_name}" class="forms" title = 
"{$lang_user_statustext}" onMouseover="window.status='{$lang_user_statustext}'; 
return true;" onMouseout="window.status='';return true;">
                        <option value=""><xsl:value-of 
select="lang_no_user"/></option>
                                <xsl:apply-templates select="user_list"/>
                </select>
@@ -11,12 +11,13 @@
 
        <xsl:template match="user_list">
        <xsl:variable name="user_id"><xsl:value-of 
select="user_id"/></xsl:variable>
+       <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
                <xsl:choose>
                        <xsl:when test="selected">
-                               <option value="{$user_id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
+                               <option value="{$user_id}{$id}" 
selected="selected"><xsl:value-of disable-output-escaping="yes" 
select="name"/></option>
                        </xsl:when>
                        <xsl:otherwise>
-                               <option value="{$user_id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
+                               <option value="{$user_id}{$id}"><xsl:value-of 
disable-output-escaping="yes" select="name"/></option>
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>

Modified: people/sigurdne/modules/property/trunk/templates/base/wo_hour.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/wo_hour.xsl   
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/wo_hour.xsl   
2009-11-20 10:29:01 UTC (rev 20848)
@@ -37,18 +37,15 @@
 
 
        <xsl:template match="list_deviation">
+                       <!-- DataTable 0 DESVIATION-->
+                       <div id="datatable-container_0"></div>
+                       <div id="contextmenu_0"></div>
+
                <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-                       <xsl:apply-templates select="table_header_deviation"/>
-                       <xsl:apply-templates select="values_deviation"/>
+                       <!--  <xsl:apply-templates 
select="table_header_deviation"/><xsl:apply-templates 
select="values_deviation"/> -->
+                       <!--  <tr><td></td><td class="small_text" 
align="right"><xsl:value-of select="sum_deviation"/></td></tr>  -->
                        <tr>
-                               <td>
-                               </td>
-                               <td class="small_text" align="right">
-                                       <xsl:value-of select="sum_deviation"/>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td height="50">
+                               <td height="50" width="4%">
                                        <xsl:variable 
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
                                        <xsl:variable 
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
                                        <form method="post" 
action="{$add_action}">
@@ -61,7 +58,7 @@
                                                </input>
                                        </form>
                                </td>
-                               <td height="50">
+                               <td height="50" width="96%">
                                        <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
                                        <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
                                        <form method="post" 
action="{$done_action}">
@@ -76,6 +73,30 @@
                                </td>
                        </tr>
                </table>
+
+               <!--  DATATABLE DEFINITIONS-->
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       permission              :       
<xsl:value-of select="permission"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>
        </xsl:template>
 
 
@@ -225,21 +246,52 @@
                        </tr>
                </table>
                <xsl:apply-templates select="workorder_data"/>
+               <hr noshade="noshade" width="100%" align="center" size="1"/>
+
                <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
-               <hr noshade="noshade" width="100%" align="center" size="1"/>
+
                        <tr >
-                               <td class="th_text" colspan="3" align="right">
+                               <td class="th_text" align="center" >
                                        <xsl:value-of 
select="lang_total_records"/>
                                        <xsl:text> : </xsl:text>
-                               </td>
-                               <td class="th_text" colspan="5" align="left">
                                        <xsl:value-of 
select="total_hours_records"/>
                                </td>
                        </tr>
-                       <xsl:apply-templates select="table_header_hour"/>
-                       <xsl:apply-templates select="values_hour"/>
+                       <tr>
+                               <td colspan="1">
+                                                       <!-- DataTable 0 -->
+                                                       <div id="paging_0"> 
</div>
+                                                       <div 
id="datatable-container_0"></div>
+                               </td>
+                       </tr>
+
+                       <!-- <xsl:apply-templates 
select="table_header_hour"/><xsl:apply-templates select="values_hour"/>  -->
+
                </table>
                </div>
+               <!--  DATATABLE DEFINITIONS-->
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var base_java_url = <xsl:value-of 
select="base_java_url" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+
+               </script>
        </xsl:template>
 
 
@@ -403,8 +455,16 @@
                                                                <xsl:value-of 
select="lang_history"/>
                                                        </td>
                                                </tr>                           
        
+                                               <tr>
+                                                       <td>
+                                                                       <div 
id="paging_1"> </div>
+                                                                       <div 
id="datatable-container_1"></div>
+                                                       </td>
+                                               </tr>
+                                               <!-- 
                                                <xsl:apply-templates 
select="table_header_history"/>
                                                <xsl:apply-templates 
select="workorder_history"/>
+                                                -->
                                        </xsl:otherwise>
                                </xsl:choose>
                                </table>
@@ -422,6 +482,28 @@
                        </xsl:when>
                </xsl:choose>
                </table>
+
+               <script>
+               var property_js = <xsl:value-of select="property_js" />;
+               var datatable = new Array();
+               var myColumnDefs = new Array();
+
+               <xsl:for-each select="datatable">
+                       datatable[<xsl:value-of select="name"/>] = [
+                       {
+                               values                  :       <xsl:value-of 
select="values"/>,
+                               total_records   :       <xsl:value-of 
select="total_records"/>,
+                               is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                               footer                  :       <xsl:value-of 
select="footer"/>
+                       }
+                       ]
+               </xsl:for-each>
+
+               <xsl:for-each select="myColumnDefs">
+                       myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+               </xsl:for-each>
+       </script>
+
        </xsl:template>
 
        <xsl:template match="table_header_history">
@@ -488,9 +570,18 @@
                        <tr>
                                <td class="th_text" align="left">
                                        <xsl:value-of select="lang_workorder"/>
+
                                </td>
                                <td  align="left" colspan="2">
                                        <xsl:value-of select="workorder_id"/>   
                                
+                                       <xsl:choose>
+                                               <xsl:when test="lang_reminder 
!=''">
+                                                       <xsl:text> - </xsl:text>
+                                                       <b><xsl:value-of 
select="lang_reminder"/></b>
+                                               </xsl:when>
+                                       </xsl:choose>
+
+
                                </td>
                        </tr>
                        <tr>
@@ -518,6 +609,11 @@
                                        <xsl:value-of select="from_email"/>     
                                
                                </td>
                        </tr>
+                       <xsl:choose>
+                               <xsl:when 
test="contact_data/value_contact_name">
+                                       <xsl:call-template name="contact_form"/>
+                               </xsl:when>
+                       </xsl:choose>
                        <xsl:call-template name="location_view"/>
 
                        <xsl:choose>
@@ -600,6 +696,8 @@
                                        <xsl:value-of select="lang_work"/>
                                </td>
                        </tr>
+                       <xsl:choose>
+                               <xsl:when test="branch_list/selected">
                        <tr>
                                <td class="th_text"  align="left" valign="top">
                                        <xsl:value-of select="lang_branch"/>
@@ -617,6 +715,11 @@
                                        </xsl:choose>           
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
+
+                       <xsl:choose>
+                               <xsl:when test="key_responsible_list/selected">
                        <tr>
                                <td class="th_text"  align="left">
                                        <xsl:value-of 
select="lang_key_responsible"/>
@@ -631,6 +734,9 @@
                                        </xsl:for-each>
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
+                         <xsl:if test="key_fetch_list/selected">
                        <tr>
                                <td class="th_text"  align="left">
                                        <xsl:value-of select="lang_key_fetch"/>
@@ -645,6 +751,8 @@
                                        </xsl:choose>
                                </xsl:for-each>
                        </tr>
+                       </xsl:if>
+                       <xsl:if test="key_deliver_list/selected">
                        <tr>
                                <td class="th_text"  align="left">
                                        <xsl:value-of 
select="lang_key_deliver"/>
@@ -659,15 +767,29 @@
                                        </xsl:choose>
                                </xsl:for-each>
                        </tr>
+                       </xsl:if>
                </table></td></tr>
                <xsl:choose>
                        <xsl:when test="values_view_order!=''">
-                               <tr><td><table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                               <tr><td colspand="3">
+                                       <table width="100%" cellpadding="2" 
cellspacing="2" align="center">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="use_yui_table='1'">
+                                                               <td>
+                                                                       <div 
id="paging_0"> </div>
+                                                                       <div 
id="datatable-container_0"></div> 
+                                                               </td>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
                                        <xsl:apply-templates 
select="table_header_view_order"/>
                                        <xsl:apply-templates 
select="values_view_order"/>
-                               </table></td></tr>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </table>
+                               </td></tr>
                        </xsl:when>
                </xsl:choose>
+
                <xsl:choose>
                        <xsl:when test="sms_data!=''">          
                                <xsl:apply-templates select="sms_data"/>
@@ -1678,6 +1800,14 @@
                                </td>
                                </form>
                        </tr>
+                       <tr>
+                               <td align="left" height="50">
+                                       <form method="post" 
action="{done_action}">
+                                               <input type="submit" 
name="save_done" value="{lang_done}">
+                                               </input>
+                                       </form>
+                               </td>
+                       </tr>
                </table>
        </xsl:template>
 

Modified: people/sigurdne/modules/property/trunk/templates/base/workorder.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/workorder.xsl 
2009-11-20 10:28:44 UTC (rev 20847)
+++ people/sigurdne/modules/property/trunk/templates/base/workorder.xsl 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -304,7 +304,7 @@
 
 <!-- add / edit -->
 
-       <xsl:template match="edit">
+       <xsl:template match="edit" xmlns:php="http://php.net/xsl";>
                <table cellpadding="2" cellspacing="2" align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -358,8 +358,8 @@
                                        <xsl:value-of 
disable-output-escaping="yes" select="tabs" />
                                        <div class="yui-content">
 
-<div id="project">
-<table class="contenttab" align="left">
+<div id="general">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="value_project_id!=''">
                                        <tr>
@@ -398,22 +398,8 @@
                                        <xsl:value-of 
select="value_project_name"/>
                                </td>
                        </tr>
-                       <tr>
-                               <td>
-                                       <xsl:value-of select="lang_category"/>
-                               </td>
-                               <xsl:for-each select="cat_list" >
-                                       <xsl:choose>
-                                               <xsl:when 
test="selected='selected'">
-                                                       <td>
-                                                               <xsl:value-of 
select="name"/>
-                                                       </td>
-                                               </xsl:when>
-                                       </xsl:choose>
-                               </xsl:for-each>
-                       </tr>
                        <xsl:choose>
-                               <xsl:when test="location_type='form'">
+                               <xsl:when test="location_template_type='form'">
                                        <xsl:call-template 
name="location_form"/>
                                </xsl:when>
                                <xsl:otherwise>
@@ -434,6 +420,8 @@
 
                                </xsl:otherwise>
                        </xsl:choose>
+                       <xsl:choose>
+                               <xsl:when test="suppressmeter =''">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of 
select="lang_power_meter"/>
@@ -442,6 +430,8 @@
                                        <xsl:value-of 
select="value_power_meter"/>
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
                        <tr>
                                <td>
                                        <xsl:value-of 
select="lang_coordinator"/>
@@ -475,11 +465,25 @@
                                        <xsl:value-of 
select="value_other_branch"/>
                                </td>
                        </tr>
-</table>
-</div>
-
-<div id="general">
-<table class="contenttab" align="left">
+                       <xsl:for-each select="value_origin" >
+                               <tr>
+                                       <td valign ="top">
+                                               <xsl:value-of select="descr"/>
+                                       </td>
+                                       <td>
+                                               <table>
+                                                       <xsl:for-each 
select="data">
+                                                               <tr>
+                                                                       <td 
class="th_text"  align="left" >
+                                                                               
<a href="{link}"  title="{statustext}"><xsl:value-of select="id"/></a>
+                                                                               
<xsl:text> </xsl:text>
+                                                                       </td>
+                                                               </tr>
+                                                       </xsl:for-each>
+                                               </table>
+                                       </td>
+                               </tr>
+                       </xsl:for-each>
                        <xsl:choose>
                                <xsl:when test="value_workorder_id!=''">
                                        <tr>
@@ -511,6 +515,9 @@
                                        <xsl:value-of select="lang_title"/>
                                </td>
                                <td>
+                                       <input type="hidden" 
name="values[origin]" value="{value_origin_type}"></input>
+                                       <input type="hidden" 
name="values[origin_id]" value="{value_origin_id}"></input>
+
                                        <input type="text" name="values[title]" 
value="{value_title}" onMouseout="window.status='';return true;">
                                                <xsl:attribute 
name="onMouseover">
                                                        
<xsl:text>window.status='</xsl:text>
@@ -561,12 +568,60 @@
                                </tr>
                                </xsl:when>
                        </xsl:choose>
+                       <xsl:choose>
+                               <xsl:when test="need_approval='1'">
+                               <tr>
+                               <td valign="top">
+                                       <xsl:value-of 
select="lang_ask_approval"/>
+                               </td>
+                               <td>
+                                       <table>
+                                               <xsl:for-each 
select="value_approval_mail_address" >
+                                                       <tr>
+                                                               <td>
+                                                                       <input 
type="checkbox" name="values[approval][{id}]" value="True">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="//lang_ask_approval_statustext"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" name="values[mail_address][{id}]" value="{address}">
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="//lang_ask_approval_statustext"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </td>
+                                                       </tr>
+                                               </xsl:for-each>
+                                       </table>
+                               </td>
+                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
 
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_remark"/>
+                               </td>
+                               <td>
+                                       <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_remark_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:value-of 
select="value_remark"/>
+                                       </textarea>
+                               </td>
+                       </tr>
 </table>
 </div>
 
+
+
 <div id="budget">
-<table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_start_date"/>
@@ -599,11 +654,38 @@
                                </td>
                        </tr>
 
-
+                               <xsl:call-template name="event_form"/>
                                <xsl:call-template name="vendor_form"/>
+                               <xsl:call-template name="ecodimb_form"/>
                                <xsl:call-template name="b_account_form"/>
 
+<!--
                        <tr>
+                               <td>
+                                       <xsl:value-of select="lang_category"/>
+                               </td>
+                               <xsl:for-each select="cat_list" >
+                                       <xsl:choose>
+                                               <xsl:when 
test="selected='selected'">
+                                                       <td>
+                                                               <xsl:value-of 
select="name"/>
+                                                       </td>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </xsl:for-each>
+                       </tr>
+-->
+                       <tr>
+                               <td>
+                                       <xsl:value-of select="lang_cat_sub"/>
+                               </td>
+                               <td>
+                                       <xsl:call-template 
name="cat_sub_select"/>
+                               </td>
+                       </tr>
+       
+
+                       <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_budget"/>
                                </td>
@@ -650,7 +732,14 @@
                        </tr>
                        <tr>
                                <td>
+                               <xsl:choose>
+                                       <xsl:when test="link_claim !=''">
+                                               <a 
href="{link_claim}"><xsl:value-of select="lang_charge_tenant"/></a>
+                                       </xsl:when>
+                                       <xsl:otherwise>
                                        <xsl:value-of 
select="lang_charge_tenant"/>
+                                       </xsl:otherwise>
+                               </xsl:choose>
                                </td>
                                <td>
                                <xsl:choose>
@@ -687,6 +776,16 @@
                        </tr>
                        <tr>
                                <td valign="top">
+                                       <xsl:value-of 
select="php:function('lang', 'sum estimated cost')" />
+                               </td>
+                               <td>
+                                       <xsl:value-of 
select="value_sum_estimated_cost"/>
+                                       <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
+                               </td>
+                       </tr>
+
+                       <tr>
+                               <td valign="top">
                                        <xsl:value-of 
select="lang_actual_cost"/>
                                </td>
                                <td>
@@ -698,8 +797,11 @@
 </table>
 </div>
 
+<xsl:choose>
+<xsl:when test="suppresscoordination =''">
+
 <div id="coordination">
-<table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td>
                                        <xsl:value-of select="lang_key_fetch"/>
@@ -740,68 +842,23 @@
                        </tr>
 </table>
 </div>
+</xsl:when>
+</xsl:choose>
 
-<div id="extra">
-<table class="contenttab" align="left">
-                       <tr>
-                       <xsl:choose>
-                               <xsl:when test="need_approval='yes'">
-                               <td valign="top">
-                                       <xsl:value-of 
select="lang_ask_approval"/>
-                               </td>
-                               <td>
-                               <table>
-                               <tr>
-                               <td>
+<div id="documents">
+<table cellpadding="2" cellspacing="2" width="80%" align="center">
 
-                                       <input type="checkbox" 
name="values[approval]" value="True"  onMouseout="window.status='';return 
true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_ask_approval_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                               <td>
-
-                                       <input type="text" 
name="values[mail_address]" value="{value_approval_mail_address}" 
onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_ask_approval_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                       </input>
-                               </td>
-                               </tr>
-                               </table>
-                               </td>
-                               </xsl:when>
-                       </xsl:choose>
-                       </tr>
-
+       <xsl:choose>
+               <xsl:when test="files!=''">
+                       <!-- <xsl:call-template name="file_list"/> -->
                        <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_remark"/>
+                               <td align="left" valign="top">
+                                       <xsl:value-of select="//lang_files"/>
                                </td>
                                <td>
-                                       <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                               <xsl:value-of 
select="lang_remark_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_remark"/>
-                                       </textarea>
+                                       <div id="datatable-container_1"></div>
                                </td>
                        </tr>
-</table>
-</div>
-
-<div id="documents">
-<table class="contenttab" align="left">
-       <xsl:choose>
-               <xsl:when test="files!=''">
-                       <xsl:call-template name="file_list"/>
                </xsl:when>
        </xsl:choose>
 
@@ -811,8 +868,9 @@
 </div>
 <div id="history">
 
+               <!--  
                <hr noshade="noshade" width="100%" align="center" size="1"/>
-               <table width="80%" cellpadding="2" cellspacing="2" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="record_history=''">
                                        <tr>
@@ -832,6 +890,32 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </table>
+               -->
+               <div id="paging_0"> </div>
+               <div id="datatable-container_0"></div>  
+
+               <script>
+                       var property_js = <xsl:value-of select="property_js" />;
+                       var datatable = new Array();
+                       var myColumnDefs = new Array();
+
+                       <xsl:for-each select="datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                               {
+                                       values                  :       
<xsl:value-of select="values"/>,
+                                       total_records   :       <xsl:value-of 
select="total_records"/>,
+                                       edit_action             :       
<xsl:value-of select="edit_action"/>,
+                                       is_paginator    :       <xsl:value-of 
select="is_paginator"/>,
+                                       footer                  :       
<xsl:value-of select="footer"/>
+                               }
+                               ]
+                       </xsl:for-each>
+
+                       <xsl:for-each select="myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>
+                                                       
 </div>
 </div>
 </div>
@@ -962,8 +1046,8 @@
                <div class="yui-navset" id="workorder_tabview">
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
                        <div class="yui-content">
-<div id="project">
-       <table align="left">
+<div id="general">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td width="25%" >
                                        <xsl:value-of select="lang_project_id"/>
@@ -1010,7 +1094,8 @@
                                        </tr>
                                </xsl:when>
                        </xsl:choose>
-
+                       <xsl:choose>
+                               <xsl:when test="suppressmeter =''">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of 
select="lang_power_meter"/>
@@ -1019,6 +1104,8 @@
                                        <xsl:value-of 
select="value_power_meter"/>
                                </td>
                        </tr>
+                               </xsl:when>
+                       </xsl:choose>
                        <tr>
                                <td>
                                        <xsl:value-of 
select="lang_coordinator"/>
@@ -1052,10 +1139,25 @@
                                        <xsl:value-of 
select="value_other_branch"/>
                                </td>
                        </tr>
-</table>
-</div>
-<div id="general">
-<table class="contenttab" align="left">
+                       <xsl:for-each select="value_origin" >
+                               <tr>
+                                       <td valign ="top">
+                                               <xsl:value-of select="descr"/>
+                                       </td>
+                                       <td>
+                                               <table>
+                                                       <xsl:for-each 
select="data">
+                                                               <tr>
+                                                                       <td 
class="th_text"  align="left" >
+                                                                               
<a href="{link}"  title="{statustext}"><xsl:value-of select="id"/></a>
+                                                                               
<xsl:text> </xsl:text>
+                                                                       </td>
+                                                               </tr>
+                                                       </xsl:for-each>
+                                               </table>
+                                       </td>
+                               </tr>
+                       </xsl:for-each>
 
                        <tr>
                                <td>
@@ -1090,15 +1192,33 @@
                                        <xsl:value-of select="lang_descr"/>
                                </td>
                                <td>
+                                       <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
+                                               <xsl:attribute name="readonly">
+                                                       
<xsl:text>readonly</xsl:text>
+                                               </xsl:attribute>
                                        <xsl:value-of select="value_descr"/>
+                                       </textarea>
+
                                </td>
                        </tr>
-</table>
+                       <tr>
+                               <td valign="top">
+                                       <xsl:value-of select="lang_remark"/>
+                               </td>
+                               <td>
+                                       <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
+                                               <xsl:attribute name="readonly">
+                                                       
<xsl:text>readonly</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:value-of 
select="value_remark"/>
+                                       </textarea>
+                               </td>
+                       </tr>
+               </table>
 </div>
 
 <div id="budget">
-<table class="contenttab" align="left">
-
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_vendor"/>
@@ -1109,6 +1229,12 @@
                                        <xsl:value-of 
select="value_vendor_name"/>
                                </td>
                        </tr>
+                       <xsl:choose>
+                               <xsl:when test="ecodimb_data!=''">
+                                       <xsl:call-template name="ecodimb_view"/>
+                               </xsl:when>
+                       </xsl:choose>
+
                        <tr>
                                <td valign="top">
                                        <xsl:value-of select="lang_b_account"/>
@@ -1196,9 +1322,11 @@
 </table>
 </div>
 
+<xsl:choose>
+<xsl:when test="suppresscoordination =''">
+
 <div id="coordination">
-<table class="contenttab" align="left">
-
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <tr>
                                <td>
                                        <xsl:value-of select="lang_key_fetch"/>
@@ -1243,28 +1371,11 @@
                        </tr>
 </table>
 </div>
-
-<div id="extra">
-<table class="contenttab" align="left">
-                       <tr>
-                               <td valign="top">
-                                       <xsl:value-of select="lang_remark"/>
-                               </td>
-                               <td>
-                                       <textarea cols="60" rows="6" 
name="values[remark]" wrap="virtual" onMouseout="window.status='';return true;">
-                                               <xsl:attribute name="readonly">
-                                                       
<xsl:text>readonly</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="value_remark"/>
-                                       </textarea>
-                               </td>
-                       </tr>
-</table>
-</div>
-
+</xsl:when>
+</xsl:choose>
 
 <div id="documents">
-<table class="contenttab" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="files!=''">
                                        <xsl:call-template 
name="file_list_view"/>
@@ -1276,7 +1387,7 @@
 <div id="history">
 
                <hr noshade="noshade" width="100%" align="center" size="1"/>
-               <table width="80%" cellpadding="2" cellspacing="2" align="left">
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="record_history=''">
                                        <tr>

Added: 
people/sigurdne/modules/property/trunk/templates/base/yui_property_i18n.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/yui_property_i18n.xsl 
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/base/yui_property_i18n.xsl 
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,16 @@
+       <xsl:template name="yui_property_i18n" xmlns:php="http://php.net/xsl";>
+               <xsl:if test="yui_property_i18n">
+                       <script type="text/javascript">
+                               YAHOO.booking.i18n = {};
+                               <xsl:for-each select="yui_property_i18n/*">
+                                       YAHOO.booking.i18n.<xsl:value-of 
select="local-name()"/> = function(cfg)
+                                       {
+                                               cfg = cfg || {};
+                                               <xsl:for-each select="./*">
+                                                       cfg["<xsl:value-of 
select="local-name()"/>"] = <xsl:value-of disable-output-escaping="yes" 
select="."/>;
+                                               </xsl:for-each>
+                                       };
+                               </xsl:for-each>
+                       </script>
+               </xsl:if>
+       </xsl:template>


Property changes on: 
people/sigurdne/modules/property/trunk/templates/base/yui_property_i18n.xsl
___________________________________________________________________
Added: svn:keywords
   + Id Revision
Added: svn:eol-style
   + native

Added: people/sigurdne/modules/property/trunk/templates/portico/css/base.css
===================================================================
--- people/sigurdne/modules/property/trunk/templates/portico/css/base.css       
                        (rev 0)
+++ people/sigurdne/modules/property/trunk/templates/portico/css/base.css       
2009-11-20 10:29:01 UTC (rev 20848)
@@ -0,0 +1,78 @@
+div.layout-center div.panel div.body
+{
+       padding: 1em;
+}
+div.layout-center div.panel div.body table
+{
+       margin: 0em 0em 0.2em 0em;
+}
+
+div.layout-center div.panel div.body table td
+{
+       padding-right: 0.4em;
+       border: none;
+}
+
+div.layout-center div.panel div.body table tr.th td, div.layout-center 
div.panel div.body table tr.row_on td, div.layout-center div.panel div.body 
table tr.row_off td
+{
+       padding: 0.2em 0.4em;
+}
+
+div.layout-center div.panel div.body table td.th_text
+{
+       color: #666;
+       font-weight: bold;
+       border: 1px solid #c0c0c0;
+       border-bottom: 1px solid #808080;
+}
+
+div.layout-center div.panel div.body table tr.row_on td, div.layout-center 
div.panel div.body table tr.row_off td
+{
+       border: 1px solid #c0c0c0;
+}
+
+div.layout-center div.panel div.body table tr.row_on
+{
+       background: #fafafa;
+}
+
+div.layout-center div.panel div.body table tr.row_on:hover, div.layout-center 
div.panel div.body table tr.row_off:hover
+{
+       background: #add8e6;
+}
+
+div.layout-center div.panel div.body div table {
+       border: 1px solid #c0c0c0;
+}
+
+div.layout-center div.panel div.body div table td {
+       padding: 0.2em 0.4em;
+       vertical-align: middle;
+}
+div.layout-center div.panel div.body div table td.th_text {
+       border: none;
+}
+
+div.layout-center div.panel div.body div table tr.row_on td, div.layout-center 
div.panel div.body div table tr.row_off td {
+       border: none;
+       background: #fff;
+}
+
+div.layout-center div.panel div.body div table tr.row_off td {
+       background: #eee;
+}
+
+div.layout-center div.panel div.body div table tr td input,
+div.layout-center div.panel div.body div table tr td select,
+div.layout-center div.panel div.body div table tr td textarea
+{
+       margin: 0;
+}
+
+div.layout-center div.panel div.body table.tabletab,
+div.layout-center div.panel div.body table.tabletab th,
+div.layout-center div.panel div.body table.tabletab table
+{
+       border: none;
+}
+

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/agreement.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/agreement.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/budget.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/budget.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/templates/portico/images/check.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/check.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/custom.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/custom.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/documentation.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/documentation.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/entity_1.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/entity_1.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/entity_2.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/entity_2.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/helpdesk.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/helpdesk.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: people/sigurdne/modules/property/trunk/templates/portico/images/ifc.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/ifc.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/invoice.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/invoice.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_1.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_1.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_2.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_2.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_3.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_3.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_4.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_4.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_gabnr.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_gabnr.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_summary.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_summary.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_tenant.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/location_tenant.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/navbar.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/navbar.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/project.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/project.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_request.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_request.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_template.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_template.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_tenant_claim.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_tenant_claim.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_workorder.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/project_workorder.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: 
people/sigurdne/modules/property/trunk/templates/portico/images/report.png
===================================================================
(Binary files differ)


Property changes on: 
people/sigurdne/modules/property/trunk/templates/portico/images/report.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: 
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh
===================================================================
--- 
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh
        2009-11-20 10:28:44 UTC (rev 20847)
+++ 
people/sigurdne/modules/property/trunk/tutorials/property/examples/install.apache.sh
        2009-11-20 10:29:01 UTC (rev 20848)
@@ -21,18 +21,21 @@
 #  * Name of the freetds package e.g freetds-stable.tgz
 #  * 
 #  * @var               string FREETDS, FREETDSTAR
+#  * Download: http://www.freetds.org/software.html
 #  */
 FREETDSTAR="freetds-stable.tgz"
-FREETDS="freetds-0.64"
+FREETDS="freetds-0.82"
 
-LIBXMLTAR="libxml2-2.6.30.tar.gz"
-LIBXML="libxml2-2.6.30"
+# Download: http://xmlsoft.org/downloads.html
+LIBXMLTAR="libxml2-2.7.6.tar.gz"
+LIBXML="libxml2-2.7.6"
 
-LIBXSLTAR="libxslt-1.1.22.tar.gz"
-LIBXSL="libxslt-1.1.22"
+LIBXSLTAR="libxslt-1.1.26.tar.gz"
+LIBXSL="libxslt-1.1.26"
 
-IMAPTAR="imap-2006k.tar.Z"
-IMAP="imap-2006k"
+# Download: ftp://ftp.cac.washington.edu/imap/
+IMAPTAR="imap-2007e.tar.Z"
+IMAP="imap-2007e"
 
 PHP_PREFIX="/usr/local"
 
@@ -40,26 +43,36 @@
 #  * Name of the APACHE tarball e.g httpd-2.2.6.tar.gz
 #  * 
 #  * @var               string APACHE, APACHETAR
+#  * Download: http://php.net/
 #  */
-APACHETAR="httpd-2.2.9.tar.gz"
-APACHE="httpd-2.2.9"
+APACHETAR="httpd-2.2.14.tar.gz"
+APACHE="httpd-2.2.14"
 
 #/**
 #  * Name of the PHP tarball e.g php-5.2.tar.gz
 #  * 
 #  * @var               string PHP, PHPTAR
+#  * Download: http://httpd.apache.org/
 #  */
-PHPTAR="php-5.2.6.tar.bz2"
-PHP="php-5.2.6"
+PHPTAR="php-5.3.0.tar.bz2"
+PHP="php-5.3.0"
 
 #/**
 #  * Name of the EACCELERATOR tarball e.g eaccelerator-0.9.5.tar.bz2
 #  * 
 #  * @var               string EACCELERATOR, EACCELERATORTAR
+#  * Download: http://eaccelerator.net/
 #  */
-EACCELERATORTAR="eaccelerator-0.9.5.2.tar.bz2"
-EACCELERATOR="eaccelerator-0.9.5.2"
+EACCELERATORTAR="eaccelerator-0.9.6-rc1.tar.bz2"
+EACCELERATOR="eaccelerator-0.9.6-rc1"
+$PHP_PREFIX = "/usr/local"
 
+# APC as Alternative:
+# Download: http://pecl.php.net/package/APC
+# APCTAR="APC-3.1.2.tgz"
+# APC="APC-3.1.2"
+
+
 # clean up from previous
 
 rm $FREETDS -rf &&\
@@ -80,10 +93,12 @@
 bunzip2 -c $PHPTAR | tar xvf -&&\
 bunzip2 -c $EACCELERATORTAR | tar xvf -&&\
 cd $FREETDS &&\
-./configure --prefix=/usr/local/freetds --with-tdsver=7.0 --enable-msdblib\
+./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib\
 --enable-dbmfix --with-gnu-ld --enable-shared --enable-static &&\
-gmake &&\
-gmake install &&\
+make &&\
+make install &&\
+touch /usr/local/freetds/include/tds.h &&\
+touch /usr/local/freetds/lib/libtds.a &&\
 cd ../$IMAP &&\
 make lmd SSLTYPE=unix.nopwd IP6=4 &&\
 ln -s c-client include &&\
@@ -124,8 +139,6 @@
  --with-imap-ssl\
  --with-sybase-ct=/usr/local/freetds\
  --with-apxs2=/usr/local/apache2/bin/apxs\
- --enable-mail\
- --with-xml\
  --with-xsl\
  --with-zlib\
  --with-pspell\
@@ -140,11 +153,15 @@
  --enable-sysvsem\
  --enable-sysvshm\
  --enable-calendar\
- --enable-pdo=shared\
- --with-pdo-sqlite=shared\
- --with-sqlite=shared\
+ --enable-pdo\
+ --with-pdo-sqlite\
+ --with-sqlite\
+ --with-pdo-pgsql\
  --with-openssl\
- --enable-mbstring &&\
+ --enable-mbstring\
+ --with-mcrypt\
+ --enable-soap\
+ --with-xmlrpc &&\
 make &&\
 make install &&\
 cd ../$EACCELERATOR &&\
@@ -155,4 +172,11 @@
 mkdir /tmp/eaccelerator &&\
 chmod 0777 /tmp/eaccelerator
 
+
+#cd ../$APC &&\
+#$PHP_PREFIX/bin/phpize &&\
+#./configure --enable-apc-mmap --with-apxs 
--with-php-config=$PHP_PREFIX/bin/php-config &&\
+#make &&\
+#make install
+
 # vim: set expandtab :





reply via email to

[Prev in Thread] Current Thread [Next in Thread]